public function getAll($key, $value = null)
    {
        $collection = new self();

        foreach ($this->items as $item) {
            if ($item->{$key} == $value) {
                $collection->push($item);
            }
        }

        return $collection;
    }
public function getAll($key, $value = null)
    {
        $collection = new self();

        foreach ($this->items as $item) {
            if ($item->{$key} == $value) {
                $collection->push($item);
            }
        }

        return $collection;
    }
public function getAll ( $ key , $ value = null ) { $ collection = new self ( ) ; foreach ( $ this -> items as $ item ) { if ( $ item -> { $ key } == $ value ) { $ collection -> push ( $ item ) ; } } return $ collection ; }
Gets a collection of items from the repository with a key and value.

@param mixed $key   The key to match with the value.
@param mixed $value The value to match with the key.

@return Collection A collection.
Gets a collection of items from the repository with a key and value .