vegas-cmf / common
此包已被 弃用 并不再维护。未建议替代包。
Vegas CMF Common
v3.0.0
2017-05-26 12:41 UTC
Requires
- php: >=7.0
- ext-phalcon: >=3.0
- phalcon/incubator: >=3.0
Requires (Dev)
- phpunit/phpunit: 4.*
- satooshi/php-coveralls: dev-master
This package is not auto-updated.
Last update: 2022-08-12 09:13:52 UTC
README
Vegas\Di\InjectionAwareTrait
为 \Phalcon\Di\InjectionAwareInterface 提供帮助特质的特质
class Foo implements \Phalcon\Di\InjectionAwareInterface { use \Vegas\Di\InjectionAwareTrait; }
Vegas\Http\Method
Http 方法列表
Vegas\Hydrator
一个简单的组件,提供从对象中提取数据集以及为对象提供加湿机制。
Vegas\Hydrator\Method
使用设置方法从给定数组中加湿对象。使用获取方法从对象中提取数据。
class Foo { protected $bar; public function setBar($bar) { $this->bar = $bar; } public function getBar() { return $this->bar; } } $array = ['bar' => 'test']; $foo = new Foo(); (new \Vegas\Hydrator\Method())->hydrate($array, $foo); echo $foo->getBar(); // 'test' print_r((new \Vegas\Hydrator\Method())->extract($foo)); // ['bar' => 'test'];
Vegas\Hydrator\Property
使用可访问的类属性从给定数组中加湿对象。使用可访问的类属性从对象中提取数据。
class Foo { public $bar; } $array = ['bar' => 'test']; $foo = new Foo(); (new \Vegas\Hydrator\Property())->hydrate($array, $foo); echo $foo->bar; // 'test' print_r((new \Vegas\Hydrator\Property())->extract($foo)); // ['bar' => 'test'];
- 命名策略将下划线转换为驼峰表示法,反之亦然。允许使用带下划线键的数组以驼峰表示法填充对象/属性,反之亦然。
UnderscoreToCamelCase
class Foo { protected $camelCase; public function setCamelCase($val) { $this->camelCase = $val; } public function getCamelCase() { return $this->camelCase; } } $array = ['camel_case' => 'test']; $foo = new Foo(); (new \Vegas\Hydrator\Method(new \Vegas\Hydrator\NamingStrategy\UnderscoreToCamelCase()))->hydrate($array, $foo); echo $foo->getCamelCase(); // 'test'
CamelCaseToUnderscore
class Foo { protected $camel_case; public function set_camel_case($val) { $this->camel_case = $val; } public function get_camel_case() { return $this->camel_case; } } $array = ['camelCase' => 'test']; $foo = new Foo(); (new \Vegas\Hydrator\Method(new \Vegas\Hydrator\NamingStrategy\CamelCaseToUnderscore()))->hydrate($array, $foo); echo $foo->get_camel_case(); // 'test'
Vegas\Stdlib
实现不同范围通用工具类的组件集
- 数组
- 日期时间
- 文件
- 字符串
- 路径