@param string $path
@param string $name

@return array
558610
protected static function loadAddonConfig($path, $name)
    {
        if (file_exists($path.'/addon.php')) {
            $config = require $path.'/addon.php';
        } else {
            throw new RuntimeException("No such config file for addon '$name', need 'addon.php'.");
        }

        $version = array_get($config, 'version', 5);
        if ($version != 5) {
            throw new RuntimeException($version.': Illigal addon version.');
        }

        return $config;
    }
567176
private static function getPathFiles(array $path): array
    {
        // load external files
        $result = [];
        $pathFinder = Finder::findFiles('*')->in($path);
        foreach ($pathFinder as $file) {
            $result[$file->getRealPath()] = $file->getBaseName();
        }
        return $result;
    }
815360
public function fetchParams(string $name): array
    {
        $bag = $this->request->request;

        return $bag->has($name) ? $bag->get($name, []) : $bag->all();
    }
1132142
protected function loadFile($path) {
        $path = realpath($path);

        if ($this->matchEnvironment($path)) {
            foreach ($this->getDrivers() as $driver) {
                if ($driver->supports($path)) {
                    return $driver->loadFile($path);
                }
            }
        }

        return [];
    }
211999
public function getByName($name)
    {
        Types::assert(['string' => [$name]]);

        $name = strtolower($name);

        if ( ! array_key_exists($name, $this->headers))
        {
            return [];
        }

        return $this->headers[$name];
    }
1254701
public function getFieldsByName($name)
    {
        $result = [];

        foreach ($this->fields as $field) {
            if ($field->getName() == $name) {
                $result[] = $field;
            }
        }

        return $result;
    }
717892
protected function loadModulePath($path, $locale, $name,$author)
    {
        if ($this->files->exists($full = "{$path}/{$author}/{$name}/translate/{$locale}.php")) {
            return $this->files->getRequire($full);
        }
        return [];
    }
123527
protected function mimetype($path, $name = '') {
		$type = '';
		
		if ($this->mimeDetect == 'finfo') {
			if ($type = @finfo_file($this->finfo, $path)) {
				if ($name === '') {
					$name = $path;
				}
				$ext = (false === $pos = strrpos($name, '.')) ? '' : substr($name, $pos + 1);
				if ($ext && preg_match('~^application/(?:octet-stream|(?:x-)?zip)~', $type)) {
					if (isset(elFinderVolumeDriver::$mimetypes[$ext])) $type = elFinderVolumeDriver::$mimetypes[$ext];
				}
			}
		} elseif ($type == 'mime_content_type') {
			$type = mime_content_type($path);
		} else {
			$type = elFinderVolumeDriver::mimetypeInternalDetect($path);
		}
		
		$type = explode(';', $type);
		$type = trim($type[0]);

		if (in_array($type, array('application/x-empty', 'inode/x-empty'))) {
			// finfo return this mime for empty files
			$type = 'text/plain';
		} elseif ($type == 'application/x-zip') {
			// http://elrte.org/redmine/issues/163
			$type = 'application/zip';
		}
		
		return $type == 'unknown' && $this->mimeDetect != 'internal'
			? elFinderVolumeDriver::mimetypeInternalDetect($path)
			: $type;
		
	}
185826
protected function getPathFromExtensionName(string $name): array
    {
        $extension = $this->app->make('orchestra.extension');
        $finder = $this->app->make('orchestra.extension.finder');

        if ($name === 'app') {
            $basePath = $sourcePath = $this->app->basePath();
        } else {
            $basePath = $finder->resolveExtensionPath(rtrim($extension->option($name, 'path'), '/'));
            $sourcePath = $finder->resolveExtensionPath(rtrim($extension->option($name, 'source-path'), '/'));
        }

        return [$basePath, $sourcePath];
    }
490892
private function _list(string $path): array {
        $result = [];
        $scan = glob($path . '/*');
        foreach ($scan as $item) {
            if (is_dir($item)) {
                $result[basename($item)] = $this->_list($item);
            } else {
                $result[] = basename($item);
            }
        }
        return $result;
    }
657369
public function loadFromDirectory($path)
    {
        return $this->file->listFiles($path)->mapWithKeys(function ($file, $key) {
            return [$key => $this->loadFile($file)];
        });
    }
1350094
public function subtree($path, &$name, $create = false)
  {
    $parts = $this->split($path);

    $_name = array_shift($parts);
    if (!sizeof($parts)) {
      $name = $_name;
      $subtree = $this;
    } else {

      $exists = isset($this->_subTrees[$_name]);
      if (!$exists && !$create) {
        $subtree = null;
        $name = null;
      } else {
        if (!$exists && $create) {
          $this->_subTrees[$_name] = new self();
        }
        $subtree = $this->_subTrees[$_name]->subtree($parts, $name, $create);
      }

    }
    return $subtree;
  }
735332
protected function _mkfile($path, $name) {
		$path = $path.DIRECTORY_SEPARATOR.$name;
		
		if (($fp = @fopen($path, 'w'))) {
			@fclose($fp);
			@chmod($path, $this->options['fileMode']);
			return $path;
		}
		return false;
	}
678392
public static function splitNameFromPath($path)
    {
        $name = static::nameFromPath($path);
        $path = static::trimFileName($path);

        return [$path, $name];
    }
640523
public function getHeader($name)
    {
        $headerSet = $this->getSwiftMessage()->getHeaders();
        if (!$headerSet->has($name)) {
            return [];
        }

        $headers = [];
        foreach ($headerSet->getAll($name) as $header) {
            $headers[] = $header->getValue();
        }
        return $headers;
    }
1217137
public function getFiles(string $name = null) : array
    {
        if ($name === null) {
            return $this->files;
        }

        $files = $this->resolvePath($this->files, $name);

        if ($files instanceof UploadedFile) {
            return [$files];
        }

        if (is_array($files)) {
            return array_filter($files, static function ($file) {
                return $file instanceof UploadedFile;
            });
        }

        return [];
    }
1368882
public function getItemData($name): array
    {
        if (func_num_args() > 1)
            $name = func_get_args();

        if (!$this->hasItemData($name))
            return $this->getItemDataNotFound($name);

        return $this->getData()[$this->getItemKey($name)];
    }