@param $path

@return null|\stdClass
@throws \InvalidArgumentException
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;
    }
184698
public static function loadFromPath($path)
	{
		// on test do not load plugins
		if(self::isUnableToRunPlugins())
		{
			return;
		}

		if (!file_exists($path))
		{
			throw new InvalidArgumentException("The path [{$path}] doesn't exist to load plugins.");
		}

		$plugins = require $path;

		foreach ($plugins as $plugin)
		{
			if (array_key_exists($plugin, self::$lookup))
			{
				$plugin = __DIR__ . DS . self::$lookup[$plugin];
			}

			if (file_exists($plugin))
			{
				require_once $plugin;
			}
		}

	}
1159757
private function getClassNameByPath($path)
	{
		foreach ($this->map as $key => $value) {
			if ($value === $path) {
				return $key;
			}
		}
		
		return null;
	}
275781
public function getUrl($path): string
    {
        \assert('is_string($path)');
        if (strpos($path, ':') === 0) {
            $key = substr($path, 0, strpos($path, '/') ?: \strlen($path));
            $path = $key === $path ? '' : (string)substr($path, \strlen($key));
        } else {
            $key = ':dist';
        }
        if (!isset($this->map[$key])) {
            throw new \InvalidArgumentException(sprintf('No path "%s" for subpackage "%s".', $path, $key));
        }
        return parent::getUrl(substr($key, 1) . $path);
    }
1041455
public function resolve($path)
    {
        $path = str_replace('/', '.', preg_replace('/\/:\w+/', '', $path));

        $finder = $this->container['view.finder'];

        try {
            $finder->find($path);
        } catch (InvalidArgumentException $e) {
            $explodedPath = explode('.', $path);


            if ($explodedPath[0] === 'static') {
                return null;
            }

            if (count($explodedPath) > 1) {
                $explodedPath[0] = 'shared';
                $explodedPath = array('shared', end($explodedPath));
                try {
                    $finder->find(implode('.', $explodedPath));
                    $path = implode('.', $explodedPath);
                } catch (InvalidArgumentException $e) {
                    $this->app->error($e);
                }
            }
        }

        return $path;
    }
845004
public function setPath($path)
    {
        if (strlen($path) == 0) {
            throw new \InvalidArgumentException(sprintf('Cloud path should not be empty'));
        }

        $this->path = $path;

        return $this;
    }
1121715
public function getChild($path)
	{
		$path    = str_replace(array('/', '\\'), '\\', $path);
		$names   = explode('\\', $path);
		$command = $this;

		foreach ($names as $name)
		{
			if (isset($command[$name]))
			{
				$command = $command[$name];

				continue;
			}

			return null;
		}

		return $command;
	}
414060
public function parse(string $path, array $options = []): \stdClass
    {
        $data = $this->getEmptyResult();

        if (!empty($options)) {
            $this->setConfig($options);
        }

        try {
            $result = $this->getDataFromPath($path);
            $data = Convert::dataToJson($result, $this->getConfig('lint'));
            if ($this->getConfig('validate') === true) {
                $this->validate($data);
            }
        } catch (ParsingException $e) {
            $message = sprintf("File: %s\n%s", $path, $e->getMessage());
            $this->errors[] = $message;

            throw new InvalidArgumentException($message, 0, $e);
        } catch (InvalidArgumentException $e) {
            $this->errors[] = $e->getMessage();

            throw $e;
        } catch (JsonValidationException $e) {
            $schemaFile = explode(DIRECTORY_SEPARATOR, $path);

            throw new InvalidArgumentException(sprintf('[%s] : %s', end($schemaFile), $e->getMessage()), 0, $e);
        }

        return $data;
    }
658127
public function fromPath($path)
    {
        $mimetype = null;

        if (static::isSupported())
        {
            if (!is_file($path)) {
                throw new \RuntimeException('File not found at '.$path);
            }

            if (!is_readable($path)) {
                throw new \RuntimeException('File not readable at '.$path);
            }

            $mimetype = $this->_getMimetype(strtolower(pathinfo($path, PATHINFO_EXTENSION)));
        }

        return $mimetype;
    }
460768
public function loadFile($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException(
                'File must be a string'
            );
        }

        if (!file_exists($path)) {
            throw new InvalidArgumentException(
                sprintf('File "%s" does not exist', $path)
            );
        }

        $ext = pathinfo($path, PATHINFO_EXTENSION);
        switch ($ext) {
            case 'php':
                return $this->loadPhpFile($path);

            case 'json':
                return $this->loadJsonFile($path);

            case 'ini':
                return $this->loadIniFile($path);

            case 'yml':
            case 'yaml':
                return $this->loadYamlFile($path);
        }

        $validConfigExts = [ 'ini', 'json', 'php', 'yml' ];
        throw new InvalidArgumentException(sprintf(
            'Unsupported file format for "%s"; must be one of "%s"',
            $path,
            implode('", "', $validConfigExts)
        ));
    }
165742
protected function extractClassFromFile($path)
    {
        $fileContent = file_get_contents($path);
        $matches = [];
        $pattern = '/Cms\S+_\S+Class/';
        preg_match($pattern, $fileContent, $matches);

        if (!empty($matches[0])) {
            return $matches[0];
        }

        return null;
    }
481380
private function resolvePath($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException(
                'Path needs to be a string'
            );
        }

        $basePath = $this->basePath();
        $path = trim($path, '/\\');

        if ($basePath && strpos($path, $basePath) === false) {
            $path = $basePath.$path;
        }

        return $path;
    }
380936
protected function _getPathObject($path)
    {
        // return as-is if parameter is
        if (is_a($path, 'stdClass')) {
            return $path;
        }

        // create path object from given string
        $obj = new stdClass();
        $obj->dotted = $path;

        $parts = explode('.', $path);

        if (count($parts) === 1) {
            $obj->toKey = null;
            $obj->key = $path;

            return $obj;
        }

        $key = end($parts);
        array_pop($parts);
        $obj->toKey = implode('.', $parts);
        $obj->key = $key;

        return $obj;
    }
665661
private function getBootstrapPath($path = null)
    {
        if (!$path) {
            $path = dirname($this->getVendorPath()) . '/bootstrap/app.php';
        } elseif (!$this->isAbsolutePath($path)) {
            $path = $this->getVendorPath() . '/' . $path;
        }

        if (!is_file($path)) {
            throw new InvalidArgumentException("App bootstrap at `{$path}` not found.");
        }

        return $path;
    }
497686
public function getReference(string $path = null): Reference
    {
        try {
            return new Reference($this->uri->withPath($path ?? ''), $this->client);
        } catch (\InvalidArgumentException $e) {
            throw new InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
        }
    }
1303535
public function get(string $path)
    {
        $explode = explode('/', $path);
        $config = $this->config;
        while ($element = array_shift($explode)) {
            if (!isset($config[$element])) {
                throw new \InvalidArgumentException(
                    sprintf("Invalid configuration path '%s'", $path)
                );
            }
            $config = $config[$element];
        }

        return $config;
    }
908582
public function resolve($path)
    {
        if ($path[0] !== '@') {
            return DIRECTORY_SEPARATOR === '/' ? $path : strtr($path, '\\', '/');
        }

        if (strpos($path, '{') !== false && preg_match_all('#{([^\}]+)}#', $path, $matches)) {
            foreach ((array)$matches[1] as $k => $match) {
                if (is_numeric($match)) {
                    $replaced = substr(function_exists('random_bytes') ? bin2hex(random_bytes($match / 2 + 1)) : md5(uniqid(mt_rand(), true)), 0, $match);
                } else {
                    /** @noinspection UnSafeIsSetOverArrayInspection */
                    $ts = isset($ts) ? $ts : time();
                    $replaced = date($match, $ts);
                }

                $path = str_replace($matches[0][$k], $replaced, $path);
            }
        }

        if (DIRECTORY_SEPARATOR === '\\') {
            $path = strtr($path, '\\', '/');
        }

        if (($pos = strpos($path, '/')) === false) {
            if (!isset($this->_aliases[$path])) {
                throw new InvalidArgumentException(['`:alias` is not exists', 'alias' => $path]);
            }
            return $this->_aliases[$path];
        }

        $alias = substr($path, 0, $pos);

        if (!isset($this->_aliases[$alias])) {
            throw new InvalidArgumentException(['`:alias` is not exists for `:path`', 'alias' => $alias, 'path' => $path]);
        }

        return $this->_aliases[$alias] . substr($path, $pos);
    }