pop() public method

Get and remove the last item from the collection.
public pop ( ) : mixed
return mixed
Example #1
0
 /**
  * Remove the last prefix if it matches the controller.
  *
  * @param \Illuminate\Support\Collection $prefixes
  *
  * @return mixed
  */
 protected function removeControllerFromPrefixes($prefixes)
 {
     if ($prefixes->last() == $this->controller) {
         $prefixes->pop();
     }
     return $prefixes;
 }
Example #2
0
 public function testPopReturnsAndRemovesLastItemInCollection()
 {
     $c = new Collection(['foo', 'bar']);
     $this->assertEquals('bar', $c->pop());
     $this->assertEquals('foo', $c->first());
 }