Looks up a path in the specified context

@param array $context
@param array $path
@param bool $require
@return string

@throws \RuntimeException
@throws \InvalidArgumentException
437395
public function lookup($context, $path, $require = false)
    {
        if (empty($path)) {
            throw new \InvalidArgumentException("Passed lookup path is empty.");
        }
        if (empty($context)) {
            throw new \InvalidArgumentException("Specified context is empty while resolving path " . json_encode($path));
        }
        return PropertyAccessor::getByPath($context, $this->path($path), $require);
    }
467728
public static function requireFiles($path)
	{
		$dir = new \DirectoryIterator($path);

		foreach ($dir as $file)
		{

			if (!$file->isDot() || !$file->isDir())
			{

				$file_extension = pathinfo($file->getFilename(), PATHINFO_EXTENSION);

				if ($file_extension === 'php')
				{

					static::$names[] = $file->getBasename('.php');

					include_once $file->getPath() . DS . $file->getBasename();

				}

			}

		}
	}
517326
function $path(params) {
    if (params == null) {
        return params;
    }
    if (typeof params === 'string') {
        const path = require('path');
        if (path.isAbsolute(params)) {
            return params;
        }

        return path.resolve(process.cwd(), params);
    }
    throw new Error('$path expects a string');
}
283095
public function getAndWrap($path = null)
    {
        // There are some cases where the $path is a ProtectedContext, especially when doing s.th. like
        // foo()[myOffset]. In this case we need to unwrap it.
        if ($path instanceof ProtectedContext) {
            $path = $path->unwrap();
        }

        $context = parent::getAndWrap($path);
        if ($context instanceof ProtectedContext && isset($this->whitelist[$path]) && is_array($this->whitelist[$path])) {
            $context->whitelist = $this->whitelist[$path];
        }
        return $context;
    }
588043
public function loadFile($path) {
        $config = null;

        try {
            $config = require $path;
        } catch (Exception $ex) {}

        if ( ! is_array($config)) {
            throw new InvalidConfigFormatException(
                s('ArrayConfigDriver expects config at path %s to be of format array[key => value].', $path)
            );
        }

        return $config;
    }
182805
public function elixir($path)
    {
        static $manifest = null;
        if (is_null($manifest)) {
            $manifest = json_decode(file_get_contents(public_path('build/rev-manifest.json')), true);
        }
        if (isset($manifest[$path])) {
            return $this->generateUrl('build/' . $manifest[$path], 'public/');
        }
        throw new \InvalidArgumentException("File {$path} not defined in asset manifest.");
    }
715480
public static function createFromDataPath(string $path, $context = null): self
    {
        $file_args = [$path, false];
        $mime_args = [$path, FILEINFO_MIME];
        if (null !== $context) {
            $file_args[] = $context;
            $mime_args[] = $context;
        }

        $raw = @file_get_contents(...$file_args);
        if (false === $raw) {
            throw new SyntaxError(sprintf('The file `%s` does not exist or is not readable', $path));
        }

        return Uri::createFromComponents([
            'scheme' => 'data',
            'path' => str_replace(' ', '', (new finfo(FILEINFO_MIME))->file(...$mime_args)).';base64,'.base64_encode($raw),
        ]);
    }
864233
protected static function &getPath(&$m, $path)
    {
        foreach ($path as $p) {
            $m =& $m[$p];
        }
        return $m;
    }
215401
protected static function filterPath($path)
    {
        if (! is_string($path)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid path provided; must be a string argument; received %s',
                (is_object($path) ? get_class($path) : gettype($path))
            ));
        }

        if ($path && $path[0] === '/') {
            $path = '/' . ltrim($path, '/');
        }

        return preg_replace_callback(
            '/(?:[^' . self::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/u',
            function (array $matches) {
                rawurlencode($matches[0]);
            },
            $path
        );
    }
646825
public static final function ppath ($path){
		while (!is_dir($path) && strlen($path) > 0){
			$path = preg_replace('/[^\/]+\/?$/', null, $path);
		}

		return !empty($path) ? $path : false;
	}
884013
public function filePath($path)
    {
        $file = $this->realPath($path);
        if (!is_file($file)) {
            throw new \InvalidArgumentException(sprintf('The path is not a file: %s', $file));
        }

        return $path;
    }
558578
public function withPath($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException('Uri path must be a string');
        }

        $clone = clone $this;
        $clone->path = Validator::checkPath($path);

        // if the path is absolute, then clear basePath
        if (substr($path, 0, 1) == '/') {
            $clone->basePath = '';
        }

        return $clone;
    }
145826
private function detectFromPath(string $path)
    {
        if (!$this->usePath) {
            return null;
        }

        $dirs = explode('/', ltrim($path, '/'), 2);
        $first = strtolower((string) array_shift($dirs));

        if (!empty($first) && in_array($first, $this->languages, true)) {
            return $first;
        }
    }
1340956
public function requireFile($path)
    {
        if (false == empty($this->basePath)) {
            return require "{$this->basePath}/{$this->localPath}/{$path}";
        }

        $code = $this->filesystem->read($this->localPath."/{$path}");

        return eval(str_replace('<?php ', '', $code));
    }
833660
def get_requires(path=REQUIRE_PATH):
    
    for line in read(path).splitlines():
        line = line.strip()
        if line and not line.startswith('#'):
            yield line
412462
public function read($path)
    {
        $url = self::BASE_URL.$path;
        return file_get_contents($url, false, $this->context);
    }
305794
protected function getFullPath($path, $verify = false) {
        $full_path = $this->cleanPath($this->path_to_files . '/' . $path);

        if ($verify === true) {
            if (!file_exists($full_path) || !$this->is_valid_path($full_path)) {
                $langKey = is_dir($full_path) ? 'DIRECTORY_NOT_EXIST' : 'FILE_DOES_NOT_EXIST';
                $this->error($langKey, [$path]);
            }
        }
        return $full_path;
    }