PHP Classes
elePHPant
Icontem

Freeze My PHP Scalar Types: Implements scalar type values that work in PHP 5

Recommend this page to a friend!
  Info   View files Documentation   View files View files (15)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-02-06 (Yesterday) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
freezemyscalar 1.0The PHP License5PHP 5, Data types
Description Author

This package implements scalar type values that work in PHP 5.

It provides base classes and interfaces that allow assigning scalar values to an object.

The package can validate if the value being assigned is of the type that is expected to accept.

Currently it provides validation for assigning scalar values of types that can be integer or string.

  Performance   Level  
Innovation award
Innovation award
Nominee: 2x

Details

<p align="center"> <img src="https://nsa40.casimages.com/img/2019/02/05//190205101808386466.png" width="300"> </p> <p align="center"> <a href="https://www.codacy.com/app/DeGraciaMathieu/FreezeMyScalar?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=DeGraciaMathieu/FreezeMyScalar&amp;utm_campaign=Badge_Grade"><img src="https://api.codacy.com/project/badge/Grade/6b3de0e48bf143ae8690b53fdf2a8865"/></a> <a href="https://scrutinizer-ci.com/g/degraciamathieu/freezemyscalar/?branch=master"><img src="https://scrutinizer-ci.com/g/DeGraciaMathieu/FreezeMyScalar/badges/quality-score.png?b=master" alt="Scrutinizer Code Quality"></a> <a href="https://travis-ci.org/DeGraciaMathieu/FreezeMyScalar"><img src="https://travis-ci.org/DeGraciaMathieu/FreezeMyScalar.svg?branch=master" alt="Build Status"></a> <a href="https://scrutinizer-ci.com/g/DeGraciaMathieu/FreezeMyScalar/?branch=master"><img src="https://scrutinizer-ci.com/g/DeGraciaMathieu/FreezeMyScalar/badges/coverage.png?b=master" alt="Code Coverage"></a> <a href="https://packagist.org/packages/degraciamathieu/freezemyscalar"><img src="https://img.shields.io/packagist/v/degraciamathieu/freezemyscalar.svg?style=flat-square" alt="Latest Version on Packagist"></a> <a href='https://packagist.org/packages/degraciamathieu/freezemyscalar'><img src='https://img.shields.io/packagist/dt/degraciamathieu/freezemyscalar.svg?style=flat-square' /></a> </p>

DeGraciaMathieu/FreezeMyScalar

If you can not use php7... you can still use this.

class Object {
    public function foo(FreezeString $string) {}
}

(new Object)->foo(new FreezeString('string'));

Instead of this

class Object {
    public function foo($string) {}
}

(new Object)->foo('string');

It's better than nothing ¯\\_(?)_/¯

Installation

Run in console below command to download package to your project:

composer require degraciamathieu/freezemyscalar

Usage

require 'vendor\autoload.php';

use DeGraciaMathieu\FreezeMyScalar\FreezeString;

$scalar = new FreezeString('qsdqsdq');
$scalar->content(); // 'qsdqsdq'

require 'vendor\autoload.php';

use DeGraciaMathieu\FreezeMyScalar\FreezeInteger;

$scalar = new FreezeInteger(10);
$scalar->content(); // 10

require 'vendor\autoload.php';

use DeGraciaMathieu\FreezeMyScalar\FreezeString;

new FreezeString(10); 
// throws \DeGraciaMathieu\FreezeMyScalar\Exceptions\UnexpectedValueException
  Files folder image Files  
File Role Description
Files folder imagesrc (4 files, 3 directories)
Files folder imagetests (1 file)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file _config.yml Data Auxiliary data

 Version Control Unique User Downloads  
 100%
Total:0
This week:0