/** * 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); }
/** * 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); }
/** * 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]; }
/** * 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); }
/** * 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); }
/** * Get class name from instance. * * @param mixed $object * * @return string */ protected function getClassName($object) { return Arr::last(explode('\\', get_class($object)), function () { return true; }); }