2017 © Pedro Peláez
 

library php-binders

A repository to simplifiy combining arrays.

image

pangolinkeys/php-binders

A repository to simplifiy combining arrays.

  • Sunday, November 26, 2017
  • by pangolinkeys
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 67 % Grown

The README.md

php-binders

A php repository to simplify combining arrays., (*1)


Usage

Add Bindable as a trait on the target classes., (*2)

use Bindable;

Implement the getKeys() method so the bind method knows how the array is keyed., (*3)

public function getKeys()
{        
    return array_keys($this->data);
} 

Create a get method suffixed by the name of the target attribute which is passed a singular key from the getKeys() method and returns a reference to the desired position in the array., (*4)

public function &getAge($person)
{
    return $this->data[ $person ]['Age'];
}

Finally, call bind and pass through the second object and the key which the bind should occur on., (*5)

$people->bind($preference, 'Age');

These methods should be implemented appropriately in both classes., (*6)

Example

A working example of this can be found in the /example directory., (*7)

The Versions

26/11 2017

dev-master

9999999-dev

A repository to simplifiy combining arrays.

  Sources   Download

MIT

The Development Requires

by James Cook

26/11 2017

dev-develop

dev-develop

A repository to simplifiy combining arrays.

  Sources   Download

MIT

The Development Requires

by James Cook

26/11 2017

v1.01

1.01.0.0

A repository to simplifiy combining arrays.

  Sources   Download

MIT

The Development Requires

by James Cook

26/11 2017

v1.0

1.0.0.0

A repository to simplifiy combining arrays.

  Sources   Download

MIT

The Development Requires

by James Cook