private function normalizeDirectoryListing($listing)
    {
        $normalizedListing = [];

        foreach ($listing as $child) {
            $chunks = preg_split("/\s+/", $child);

            list(
                $item['rights'],
                $item['number'],
                $item['user'],
                $item['group'],
                $item['size'],
                $item['month'],
                $item['day'],
                $item['time'],
                $item['name']
            ) = $chunks;

            $item['type'] = $chunks[0]{0} === 'd' ? 'directory' : 'file';

            array_splice($chunks, 0, 8);

            $normalizedListing[implode(" ", $chunks)] = $item;
        }

        return $normalizedListing;
    }
private function normalizeDirectoryListing($listing)
    {
        $normalizedListing = [];

        foreach ($listing as $child) {
            $chunks = preg_split("/\s+/", $child);

            list(
                $item['rights'],
                $item['number'],
                $item['user'],
                $item['group'],
                $item['size'],
                $item['month'],
                $item['day'],
                $item['time'],
                $item['name']
            ) = $chunks;

            $item['type'] = $chunks[0]{0} === 'd' ? 'directory' : 'file';

            array_splice($chunks, 0, 8);

            $normalizedListing[implode(" ", $chunks)] = $item;
        }

        return $normalizedListing;
    }
private function normalizeDirectoryListing ( $ listing ) { $ normalizedListing = [ ] ; foreach ( $ listing as $ child ) { $ chunks = preg_split ( "/\s+/" , $ child ) ; list ( $ item [ 'rights' ] , $ item [ 'number' ] , $ item [ 'user' ] , $ item [ 'group' ] , $ item [ 'size' ] , $ item [ 'month' ] , $ item [ 'day' ] , $ item [ 'time' ] , $ item [ 'name' ] ) = $ chunks ; $ item [ 'type' ] = $ chunks [ 0 ] { 0 } === 'd' ? 'directory' : 'file' ; array_splice ( $ chunks , 0 , 8 ) ; $ normalizedListing [ implode ( " " , $ chunks ) ] = $ item ; } return $ normalizedListing ; }
Normalize directory content listing

@param array $listing
@return array
Normalize directory content listing