public function clean($folder, $removeDirectory = false)
    {
        if ( ! is_dir($folder)) {
            throw new \Exception(('Not a folder.'));
        }

        array_map('unlink', glob($folder . DIRECTORY_SEPARATOR . '*'));
        if ($removeDirectory && file_exists($folder)) {
            rmdir($folder);
        }
    }