acid-solutions / value-objects
Installs: 1 657
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.0
- illuminate/support: ~4.0
- patchwork/utf8: v1.1.23
Requires (Dev)
- behat/behat: 2.4.*@stable
- phpunit/php-code-coverage: dev-master
- way/laravel-test-helpers: dev-master
This package is not auto-updated.
Last update: 2024-11-23 18:43:18 UTC
README
It's an easy to use bulk of classes.
Install
Classes
- Decimal
- String
Decimal
Provide an easy way to use Decimal numbers
$decimal = new Decimal("1"); echo $decimal; // 1.00 $decimal === 1.00; // false $decimal->value === 1.00; // true $decimal() === 1.00; //true $decimal->add('3')->multiple(4)->reduce(new Decimal(1)); echo $decimal; // 15.00 // Use it in function parameter class SomeAwesomeClass { public function plusOneMaybeAndDisplay( Decimal $prettyDecimal ) { if ( rand(0,1) ) { $prettyDecimal->add(1); } echo $prettyDecimal; } } // Methods: $decimal->isEqualTo(x) // Boolean $decimal->isPositive() // Boolean $decimal->isLowerThan(x) // Boolean $decimal->isLowerOrEqualTo(x) // Boolean $decimal->isHigherThan(x) // Boolean $decimal->isHigherOrEqualTo(x) // Boolean
String
$myString = new String('a string'); $myString->upper()->contains('STRING'); // Use it in function parameter class SomeAwesomeClass { public function crazyFunction( String $sexyString ) { // Do something with this fucking sexyString ! } }