src/FractalTransformFactory.php
protected function resolveChildIncludes($key, string $include): array
    {
        if (count($segments = explode('.', $include)) <= 1) {
            return [];
        }

        $relation = $key === array_shift($segments) ? [$segments[0]] : [];

        return array_merge($relation, $this->resolveChildIncludes($key, implode('.', $segments)));
    }
protected function resolveChildIncludes($key, string $include): array
    {
        if (count($segments = explode('.', $include)) <= 1) {
            return [];
        }

        $relation = $key === array_shift($segments) ? [$segments[0]] : [];

        return array_merge($relation, $this->resolveChildIncludes($key, implode('.', $segments)));
    }
Resolve included segments that are a direct child to the given resource key.

@param  string $key
@param  string $include
@return array