voku / value_objects
Value Objects
0.1.0
2023-08-10 22:59 UTC
Requires
- php: 7.4.* || 8.0.* || 8.1.* || 8.2.*
- ext-bcmath: *
- ext-intl: *
- voku/email-check: ~3.1.0
- voku/stringy: ~6.5.3
Requires (Dev)
- php-cs-fixer/shim: v3.22.*
- phpstan/phpstan: 1.10.*
- phpunit/phpunit: 9.6.*
- symfony/polyfill-ctype: 1.*
- symfony/polyfill-php80: 1.*
- dev-main
- 0.1.0
- dev-renovate/php-8.x
- dev-renovate/codecov-codecov-action-5.x
- dev-renovate/major-phpstan-packages
- dev-renovate/actions-cache-4.x
- dev-renovate/phpunit-phpunit-11.x
- dev-renovate/php-cs-fixer-shim-3.x
- dev-renovate/phpstan-packages
- dev-renovate/shivammathur-setup-php-2.x
- dev-renovate/major-github-artifact-actions
- dev-renovate/actions-cache-3.x
- dev-whitesource/configure
This package is auto-updated.
Last update: 2024-11-23 03:44:11 UTC
README
Value Objects
A collection of value objects that can help you to write more readable, self-validated and immutable code.
Install with Composer
composer require voku/value_objects
Usage
use voku\ValueObjects\ValueObjectVatPercentage; require_once __DIR__ . '/vendor/autoload.php'; // example path $vat = ValueObjectVatPercentage::create('16.0'); $vat->getGross(10.0)); // '11.6'
Unit Tests
- 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
AbstractHttpProvider methods
create(\TCreateValue|null $value): static
Parameters:
\TCreateValue|null $value
Return:
static
createEmpty(): static
Parameters: nothing
Return:
static
decryptFromString(string $password, string $data): static
Parameters:
string $password
string $data
Return:
static
encrypt(string $password):
Parameters:
string $password
Return:
string
jsonSerialize(): string
Parameters: nothing
Return:
string
value(): TValue|null
↑ Get the value that are used for the database.
Parameters: nothing
Return:
\TValue|null
valueOrFallback(\TValueFallback $fallback): TValue|\TValueFallback
Parameters:
\TValueFallback $fallback
Return:
\TValue|\TValueFallback
valueOrThrowException(): TValue
Parameters: nothing
Return:
\TValue
Thanks
- 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!