PHP Classes

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    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 32 This week: 1All time: 10,987 This week: 560Up
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.

Picture of DeGraciaMathieu
  Performance   Level  
Name: DeGraciaMathieu <contact>
Classes: 16 packages by
Country: France France
Age: ???
All time rank: 297081 in France France
Week rank: 106 Up5 in France France Up
Innovation award
Innovation award
Nominee: 11x

Winner: 1x

Documentation

<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

  Files folder image Files  /  src  
File Role Description
Files folder imageContracts (2 files)
Files folder imageExceptions (1 file)
Files folder imageRules (2 files)
  Plain text file AbstractScalar.php Class Class source
  Plain text file Checker.php Class Class source
  Plain text file FreezeInteger.php Class Class source
  Plain text file FreezeString.php Class Class source

  Files folder image Files  /  src  /  Contracts  
File Role Description
  Plain text file Rule.php Class Class source
  Plain text file Scalar.php Class Class source

  Files folder image Files  /  src  /  Exceptions  
File Role Description
  Plain text file UnexpectedValueException.php Class Class source

  Files folder image Files  /  src  /  Rules  
File Role Description
  Plain text file IntegerRule.php Class Class source
  Plain text file StringRule.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file ScalarTests.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:32
This week:1
All time:10,987
This week:560Up