Exemplo n.º 1
0
 /**
  * Get the first item from the collection.
  *
  * @param  callable|null $callback
  * @param  mixed         $default
  *
  * @return mixed
  */
 public function first(callable $callback = NULL, $default = NULL)
 {
     if (NULL === $callback) {
         return count($this->items) > 0 ? reset($this->items) : NULL;
     }
     return Lib::array_first_match($this->items, $callback, $default);
 }