src/Support/Concerns/Descendible.php
protected function resolveLastDecendant($array, array $keys): ?Fluent
    {
        $isLastDescendant = function ($array, $segment) {
            return ! \is_array($array->childs) || ! isset($array->childs[$segment]);
        };

        // To retrieve the array item using dot syntax, we'll iterate through
        // each segment in the key and look for that value. If it exists,
        // we will return it, otherwise we will set the depth of the array
        // and look for the next segment.
        foreach ($keys as $segment) {
            if ($isLastDescendant($array, $segment)) {
                return $array;
            }

            $array = $array->childs[$segment];
        }

        return $array;
    }
protected function resolveLastDecendant($array, array $keys): ?Fluent
    {
        $isLastDescendant = function ($array, $segment) {
            return ! \is_array($array->childs) || ! isset($array->childs[$segment]);
        };

        // To retrieve the array item using dot syntax, we'll iterate through
        // each segment in the key and look for that value. If it exists,
        // we will return it, otherwise we will set the depth of the array
        // and look for the next segment.
        foreach ($keys as $segment) {
            if ($isLastDescendant($array, $segment)) {
                return $array;
            }

            $array = $array->childs[$segment];
        }

        return $array;
    }
protected function resolveLastDecendant ( $ array , array $ keys ) : ? Fluent { $ isLastDescendant = function ( $ array , $ segment ) { return ! \ is_array ( $ array -> childs ) || ! isset ( $ array -> childs [ $ segment ] ) ; } ; // To retrieve the array item using dot syntax, we'll iterate through // each segment in the key and look for that value. If it exists, // we will return it, otherwise we will set the depth of the array // and look for the next segment. foreach ( $ keys as $ segment ) { if ( $ isLastDescendant ( $ array , $ segment ) ) { return $ array ; } $ array = $ array -> childs [ $ segment ] ; } return $ array ; }
Resolve last descendant node from items.

@param  mixed  $array
@param  array  $keys

@return \Orchestra\Support\Fluent|null
Resolve last descendant node from items .