yakiv-khorunzhyi / value-type
将标量类型作为对象。
dev-master
2020-08-06 14:27 UTC
Requires
- php: ^5.6
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-06 23:36:25 UTC
README
安装
使用以下命令安装最新版本:
$ composer require yakiv-khorunzhyi/scalar-type
示例
$address = new Core\ScalarType('Country,city,street', Core\Types::STRING);
$address->setFormatRule(function ($val) {
return explode(',', $val);
});
var_dump($address->getFormattedValue());
var_dump($address->getValue());
var_dump($address->getType());
/*
1) array(3) {
[0]=>
string(7) "Country"
[1]=>
string(4) "city"
[2]=>
string(6) "street"
}
2) string(19) "Country,city,street"
3) string(6) "string"
*/
许可证
MIT许可证。