A collection of value objects that can help you to write more readable, self-validated and immutable code.
composer require voku/value_objects
use voku\ValueObjects\ValueObjectVatPercentage;
require_once __DIR__ . '/vendor/autoload.php'; // example path
$vat = ValueObjectVatPercentage::create('16.0');
$vat->getGross(10.0)); // '11.6'
- Composer is a prerequisite for running the tests.
composer install
- The tests can be executed by running this command from the root directory.
./vendor/bin/phpunit
create | createEmpty | decryptFromString | encrypt |
jsonSerialize | value | valueOrFallback | valueOrThrowException |
Parameters:
\TCreateValue|null $value
Return:
static
Parameters: nothing
Return:
static
Parameters:
string $password
string $data
Return:
static
Parameters:
string $password
Return:
string
Parameters: nothing
Return:
string
↑ Get the value that are used for the database.
Parameters: nothing
Return:
\TValue|null
Parameters:
\TValueFallback $fallback
Return:
\TValue|\TValueFallback
Parameters: nothing
Return:
\TValue
- Thanks to GitHub (Microsoft) for hosting the code and a good infrastructure including Issues-Management, etc.
- Thanks to IntelliJ as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
- Thanks to StyleCI for the simple but powerful code style check.
- Thanks to PHPStan && Psalm for really great Static analysis tools and for discover bugs in the code!