From f88add942c73cafa84e493787479d796e8fb122b Mon Sep 17 00:00:00 2001 From: therselman Date: Tue, 22 Aug 2017 14:41:38 +0200 Subject: [PATCH] --- src/Collection.php | 66 +++++++++++----------------------------------- 1 file changed, 15 insertions(+), 51 deletions(-) diff --git a/src/Collection.php b/src/Collection.php index dd058ca..acefae2 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -1,9 +1,11 @@ members =& $members; - $this->methods =& $methods; } /** - * Get member by id/index + * Get member by id/index * - * @param string|int $idx - * @return mixed + * Note: This is not very useful, because most members will be indexed by integer. + * + * @param string|int $idx + * @return mixed */ public function __get($idx) { @@ -32,11 +34,11 @@ class Collection implements \Iterator, \Countable, \ArrayAccess } /** - * Set member by id/index + * Set member by id/index * - * @param string|int $idx - * @param mixed $value - * @return void + * @param string|int $idx + * @param mixed $value + * @return void */ public function __set($idx, $value) { @@ -54,28 +56,6 @@ class Collection implements \Iterator, \Countable, \ArrayAccess } - public function &all() - { - return $this->members; - } - public function get($name) // alias for __get() - { - return $this->members[$name]; - } - public function set($name, $value) // alias for __set() - { - return $this->members[$name] = $value; - } - public function has($name) // alias for __isset() - { - return isset($this->members[$name]); - } - public function remove($name) // alias for __unset() - { - unset($this->members[$name]); - } - - /** * Workaround for the `array access functions` eg. array_push($obj->toArray(), $value); */ @@ -85,22 +65,6 @@ class Collection implements \Iterator, \Countable, \ArrayAccess } - public function __call($method, $args) - { - array_unshift($args, $this); - return call_user_func_array($this->methods[$method], $args); - } - public function __invoke() - { - return $this->methods['__invoke']($this); - } - public function setMethod($method, callable $callable) - { - $this->methods[$method] = $callable; - return $this; - } - - /** * Iterator interface */