Skip to content

void-sector/scalar-objects

Repository files navigation

Scalar-objects

Build Status Coverage Status Scrutinizer Quality Score

Supports method calls on primitive types in PHP. Allows you to use Type Hinting on the primitives in your OO project. Values are validated when constructed using there own validators. The project is PSR-1, PSR-2 compatable.

The project is work in progress. I'm still trying to find a nice way to delegate the Operation calls following the Open/Closed Principle. Please take a look at the Open Issues for more information.

Examples

String Example:

<?php

require('./vendor/autoload.php');

use Scalar\String;

$string = new String('We love Fruit!');

$string->replace('Fruit', 'Coding');
$string->toUpper();

echo $string->getValue() . PHP_EOL; // results in: WE LOVE CODING!

Float Example:

<?php

require('./vendor/autoload.php');

use Scalar\Float;

$float = new Float(33.3333333);

$float->ceil();

echo $float->getValue() . PHP_EOL; // results in: 34.0

Contribute

If you got suggestions, idea's or improvements , please fork the project and initialize a pull request.

Happy Coding!!

About

Supports method calls and allows Type-Hinting on primitives in PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages