Skip to content

Commit

Permalink
Update PhpCollection.php
Browse files Browse the repository at this point in the history
push/add/append
prepend
  • Loading branch information
izica authored Jun 3, 2019
1 parent 21ebe96 commit 9e64c48
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion PhpCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,26 @@ public function push($element)
*/
public function add($element)
{
return new PhpCollection(array_merge($this->arCollection, [$element]));
return $this->push($element);
}


/**
* @param $element
* @return PhpCollection
*/
public function append($element)
{
return $this->push($element);
}

/**
* @param $element
* @return PhpCollection
*/
public function prepend($element)
{
return new PhpCollection(array_merge([$element], $this->arCollection));
}

/**
Expand Down

0 comments on commit 9e64c48

Please sign in to comment.