2017 © Pedro Peláez
 

library common

Vegas CMF Common

image

vegas-cmf/common

Vegas CMF Common

  • Friday, May 26, 2017
  • by vegas
  • Repository
  • 11 Watchers
  • 1 Stars
  • 22 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Vegas CMF Common

Build Status Coverage Status Latest Stable Version Total Downloads, (*1)

Vegas\Di\InjectionAwareTrait, (*2)

Helper trait for \Phalcon\Di\InjectionAwareInterface, (*3)

class Foo implements \Phalcon\Di\InjectionAwareInterface
{
    use \Vegas\Di\InjectionAwareTrait;
}

Vegas\Http\Method, (*4)

List of Http methods, (*5)

Vegas\Hydrator, (*6)

Simple component to provide mechanisms both for hydrating objects, as well as extracting data sets from them., (*7)

  • 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., (*8)

  • UnderscoreToCamelCase, (*9)

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, (*10)

Set of components that implements general purpose utility class for different scopes:, (*11)

  • Array
  • DateTime
  • File
  • String
  • Path

The Versions

26/05 2017

v3.0.x-dev

3.0.9999999.9999999-dev

Vegas CMF Common

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amsterdam Standard Vegas Team

26/05 2017

v3.0.0

3.0.0.0

Vegas CMF Common

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amsterdam Standard Vegas Team

25/03 2016

dev-master

9999999-dev

Vegas CMF Common

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amsterdam Standard Vegas Team

25/03 2016

v2.0.0

2.0.0.0

Vegas CMF Common

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amsterdam Standard Vegas Team

25/03 2016

v2.0.0-beta

2.0.0.0-beta

Vegas CMF Common

  Sources   Download

MIT

The Requires

 

The Development Requires

by Amsterdam Standard Vegas Team