Puli\Repository\JsonRepository::flatten PHP Method

flatten() private method

For each entry on the first level, only the first entry of the second level is included in the result. Each reference returned by this method can be: * null * a link starting with @ * an absolute filesystem path The keys of the returned array are Puli paths. Their order is undefined.
private flatten ( array $references ) : string[] | null[]
$references array A two-level reference array as returned by {@link searchReferences()}.
return string[] | null[] A one-level array of references with Puli paths as keys.
    private function flatten(array $references)
    {
        $result = array();
        foreach ($references as $currentPath => $currentReferences) {
            if (!isset($result[$currentPath])) {
                $result[$currentPath] = reset($currentReferences);
            }
        }
        return $result;
    }