本文整理汇总了PHP中Illuminate\Support\Arr::last方法的典型用法代码示例。如果您正苦于以下问题:PHP Arr::last方法的具体用法?PHP Arr::last怎么用?PHP Arr::last使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Arr
的用法示例。
在下文中一共展示了Arr::last方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: last
/**
* 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);
}
示例2:
/**
* 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);
}
示例3: getExceptionHandlerInfo
/**
* 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];
}
示例4: last
/**
* 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);
}
示例5: getFirstLoop
/**
* Get an instance of the first loop in the stack.
*
* @return array
*/
public function getFirstLoop()
{
return ($last = Arr::last($this->loopsStack)) ? (object) $last : null;
}
示例6: buildMirrors
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);
}
示例7: getClassName
/**
* Get class name from instance.
*
* @param mixed $object
*
* @return string
*/
protected function getClassName($object)
{
return Arr::last(explode('\\', get_class($object)), function () {
return true;
});
}