public static function emulateDirectories(array $listing)
    {
        $directories = [];
        $listedDirectories = [];

        foreach ($listing as $object) {
            [$directories, $listedDirectories] = static::emulateObjectDirectories($object, $directories, $listedDirectories);
        }

        $directories = \array_diff(
            \array_unique($directories),
            \array_unique($listedDirectories)
        );

        foreach ($directories as $directory) {
            $listing[] = static::pathinfo($directory) + ['type' => 'dir'];
        }

        return $listing;
    }