Ejemplo n.º 1
0
 /**
  * Get the last item from the collection.
  *
  * @param  callable|null  $callback
  * @param  mixed  $default
  * @return mixed
  */
 public function last(callable $callback = null, $default = null)
 {
     if (is_null($callback)) {
         return count($this->items) > 0 ? end($this->items) : value($default);
     }
     return Arr::last($this->items, $callback, $default);
 }
Ejemplo n.º 2
0
 /**
  * Return the last element in an array passing a given truth test.
  *
  * @param  array $array
  * @param  callable $callback
  * @param  mixed $default
  * @return mixed
  */
 function array_last($array, $callback, $default = null)
 {
     return Arr::last($array, $callback, $default);
 }
Ejemplo n.º 3
0
 /**
  * Get exception handler information.
  *
  * @param \Exception $e
  *
  * @return array
  */
 protected function getExceptionHandlerInfo(Exception $e)
 {
     $exceptionClassName = Arr::last(explode('\\', get_class($e)));
     $handlerClassName = "Hero\\Exceptions\\Handlers\\{$exceptionClassName}Handler";
     return [$exceptionClassName, $handlerClassName];
 }
Ejemplo n.º 4
0
 /**
  * Get the last item from the collection.
  *
  * @param  callable|null  $callback
  * @param  mixed  $default
  * @return mixed
  */
 public function last(callable $callback = null, $default = null)
 {
     return Arr::last($this->items, $callback, $default);
 }
Ejemplo n.º 5
0
 /**
  * Get an instance of the first loop in the stack.
  *
  * @return array
  */
 public function getFirstLoop()
 {
     return ($last = Arr::last($this->loopsStack)) ? (object) $last : null;
 }
 protected function buildMirrors($disks)
 {
     $main = $this->disk(Arr::first($disks))->getAdapter();
     if (count($disks) > 2) {
         $second = $this->buildMirrors(array_slice($disks, 1));
     } else {
         $second = $this->disk(Arr::last($disks))->getAdapter();
     }
     return new \League\Flysystem\Replicate\ReplicateAdapter(new \Litipk\Flysystem\Fallback\FallbackAdapter($main, $second, true), $second);
 }
Ejemplo n.º 7
0
 /**
  * Get class name from instance.
  *
  * @param mixed $object
  *
  * @return string
  */
 protected function getClassName($object)
 {
     return Arr::last(explode('\\', get_class($object)), function () {
         return true;
     });
 }