protected static function _scan($path, $options, $dirFlags, $iteratorFlags)
    {
        if (!file_exists($path)) {
            throw new Exception("Unexisting path `{$path}`.");
        }
        if (!is_dir($path)) {
            return [$path];
        }
        $worker = new RecursiveDirectoryIterator($path, $dirFlags);
        if ($options['recursive']) {
            $worker = new RecursiveIteratorIterator($worker, $iteratorFlags);
        }
        $filter = new static($worker);
        $filter->filter($options);

        $result = [];
        foreach ($filter as $key => $value) {
            $result[] = $key;
        }
        return $result;
    }