vegas-cmf / common
This package is abandoned and no longer maintained.
No replacement package was suggested.
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
Helper trait for \Phalcon\Di\InjectionAwareInterface
class Foo implements \Phalcon\Di\InjectionAwareInterface { use \Vegas\Di\InjectionAwareTrait; }
Vegas\Http\Method
List of Http methods
Vegas\Hydrator
Simple component to provide mechanisms both for hydrating objects, as well as extracting data sets from them.
Vegas\Hydrator\Method
Hydrates object with given array using setter methods. Extracts data from object using getter methods.
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
Hydrates object with given array using accessible class properties. Extracts data from object using accessible class properties.
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'];
- Naming strategy Converts underscore to camelCase notation and vice versa. Allows to fill object with methods/properties in camel case notation using array with underscore keys and vice versa.
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
Set of components that implements general purpose utility class for different scopes:
- Array
- DateTime
- File
- String
- Path