<?php



    namespace Ceetrox\Managers\DirectoryManager;



    class DirectoryManager
    {

        static function getFilesWithFiletypeForDirectory($directory, $type)
        {

    $files = glob($directory . '/*');

    $data = array();
    foreach ($files as $file) {
        if (is_dir($file)) {
            $data = array_merge($data, self::getFilesWithFiletypeForDirectory($file, $type));


        } elseif (substr($file,-4) == '.'.$type) {
            $data[] = $file;
        }
    }

    return $data;
        }

    }



