private function filterContentsByType(array $contents, string $type): array
    {
        $results = [];

        foreach ($contents as $key => $value) {
            if (isset($value['type']) && $value['type'] === $type) {
                $results[$key] = $value['path'];
            }
        }

        return $results;
    }
private function filterContentsByType(array $contents, string $type): array
    {
        $results = [];

        foreach ($contents as $key => $value) {
            if (isset($value['type']) && $value['type'] === $type) {
                $results[$key] = $value['path'];
            }
        }

        return $results;
    }
private function filterContentsByType ( array $ contents , string $ type ) : array { $ results = [ ] ; foreach ( $ contents as $ key => $ value ) { if ( isset ( $ value [ 'type' ] ) && $ value [ 'type' ] === $ type ) { $ results [ $ key ] = $ value [ 'path' ] ; } } return $ results ; }
Filter directory contents by type.

@param array  $contents
@param string $type

@return array
Filter directory contents by type .