得到指定目录里的信息
@param $path 目录
@return array|null
507601
public static function getFolder($path)
    {
        if (!is_dir($path)) return null;

        $path = rtrim($path, '/') . '/';

        $array = array('file' => array(), 'folder' => array());
        $dir_obj = opendir($path);

        while ($dir = readdir($dir_obj)) {
            if ($dir != '.' && $dir != '..') {
                $file = $path . $dir;
                if (is_dir($file)) {
                    $array['folder'][] = $dir;
                } elseif (is_file($file)) {
                    $array['file'][] = $dir;
                }

            }
        }
        closedir($dir_obj);
        return $array;

    }
408279
public static function parsePath($path)
    {
        $components = pathinfo($path);

        return [
            'directory' => isset($components['dirname']) ? self::fixPath($components['dirname']) : null,
            'filename' => isset($components['filename']) ? $components['filename'] : null,
            'extension' => isset($components['extension']) ? $components['extension'] : null,
        ];
    }
725172
public static function pathinfo($path)
    {
        $pathinfo = compact('path');

        if ('' !== $dirname = dirname($path)) {
            $pathinfo['dirname'] = static::normalizeDirname($dirname);
        }

        $pathinfo['basename'] = static::basename($path);

        $pathinfo += pathinfo($pathinfo['basename']);

        return $pathinfo + ['dirname' => ''];
    }
342525
public static function lookupByPath($path)
    {
        if (empty($path)) {
            throw new \InvalidArgumentException('Argument "path" cannot be empty');
        }

        foreach (self::$methods_config as $key => $val) {
            if ($val['path'] === $path) {
                return $val;
            }
        }

        return null;
    }
1229565
protected function parsePath(string $path = null): string
    {
        if ('' === $path || null === $path) {
            return '';
        }

        $path = ltrim($path, '/');

        $path = '*' === $path ? $path : '/' . $path;

        return decode($path);
    }
1263065
protected function resolvePath($path)
    {
        $parts = explode('.', $path);
        $settings = $this->settings;
        foreach ($parts as $part) {
            if (!isset($settings[$part])) {
                return null;
            }
        
            $settings = $settings[$part];
        }
        
        return $settings;
    }
40818
private function loadFile($path)
    {
        if (file_exists($path)) {
            return $this->loadJsonFile($path);
        }

        $dirs = $this->paths();
        if (empty($dirs)) {
            return null;
        }

        $data = [];
        $dirs = array_reverse($dirs);
        foreach ($dirs as $dir) {
            $file = $dir.DIRECTORY_SEPARATOR.$path;
            if (file_exists($file)) {
                $data = array_replace_recursive($data, $this->loadJsonFile($file));
            }
        }

        if (empty($data)) {
            return null;
        }

        return $data;
    }
1231601
public function getSetting($path)
    {
        if (!$this->hasSetting($path)) {
            return null;
        }
        
        $value = $this->resolvePath($path);
        
        return $value;
    }
1221649
public function getPath($path)
    {
        if (! is_array($path)) {
            $path = [$path];
        }

        $search_for = [
            '%BASE',
            '%STORAGE',
        ];

        $replace_by = [
            base_path(),
            storage_path(),
        ];

        if (function_exists('app_path')) {
            $search_for[] = '%APP';
            $replace_by[] = app_path();
        }

        if (function_exists('public_path')) {
            $search_for[] = '%PUBLIC';
            $replace_by[] = public_path();
        }

        $folders = str_replace($search_for, $replace_by, $path);

        foreach ($folders as $k => $v) {
            $folders[$k] = realpath($v);
        }

        return $folders;
    }
657369
public function loadFromDirectory($path)
    {
        return $this->file->listFiles($path)->mapWithKeys(function ($file, $key) {
            return [$key => $this->loadFile($file)];
        });
    }
1100684
public static function getRealPath($path)
    {
        $real = realpath(self::unify($path));

        return $real ? self::unify($real) : null;
    }
1130830
public function findByPath($path)
    {
        $qb = $this->createQueryBuilder('r');

        $query = $qb
            ->andWhere($qb->expr()->eq('r.fromPath', ':path'))
            ->andWhere($qb->expr()->eq('r.enabled', ':enabled'))
            ->getQuery()
            ->setMaxResults(1)
            // TODO cache
        ;

        return $query
            ->setParameters([
                'path' => $path,
                'enabled' => true,
            ])
            ->getOneOrNullResult()
        ;
    }
1045678
private function isDatePath(string $path): ?array
    {
        if (preg_match(
            '/(\d{4})[\/\-]*(\d{2})[\/\-]*(\d{2})[\/\-]*(.+?)(\.[^\.]+|\.[^\.]+\.[^\.]+)$/',
            $path,
            $matches
        )) {
            return [$matches[1], $matches[2], $matches[3], $matches[4]];
        }

        return null;
    }
124207
public function getUrl($path) {
        if (strpos($path, '://') !== false) {
            return $path;
        }
        $url = 'https://api.mch.weixin.qq.com/';
        if ($this->get('debug_mode') === true) {
            $url .= 'sandboxnew/';
        }
        return $url. trim($path, '/');
    }
310429
public static function shift(&$path)
    {
        $parts = explode('/', trim($path, '/'), 2);
        $result = array_shift($parts);
        $path = array_shift($parts);

        return $result ?: null;
    }
206615
public static function get($path)
    {
        $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
        if (!isset(self::$fileTypes[$ext])) {
            return false;
        }
        return self::$fileTypes[$ext];
    }
342688
public function setFileInfoFromPath($path)
    {
        $info = pathinfo($path);
        $this->dirname = array_key_exists('dirname', $info) ? $info['dirname'] : null;
        $this->basename = array_key_exists('basename', $info) ? $info['basename'] : null;
        $this->extension = array_key_exists('extension', $info) ? $info['extension'] : null;
        $this->filename = array_key_exists('filename', $info) ? $info['filename'] : null;

        if (file_exists($path) && is_file($path)) {
            $this->mime = MimeType::getMimeTypeByFile($path);
        }

        return $this;
    }