public static function formatListing(string $directory, bool $recursive, array $listing)
    {
        self::$directory = $directory;
        self::$recursive = $recursive;

        $listing = \array_values(
            \array_map(
                ['self', 'addPathInfo'],
                \array_filter($listing, ['self', 'isEntryOutOfScope'])
            )
        );

        return self::sortListing($listing);
    }