this function will be called from the 'views' using the
'Cdn' facade {{Cdn::elixir('')}} to convert the elixir generated file path into
it's CDN url.

@param $path

@return mixed

@throws Exceptions\EmptyPathException, \InvalidArgumentException
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.");
    }
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)
        ));
    }
48939
public function Path($Path = NULL) {
      if (is_string($Path)) {
         $Result = $this->_ParsedRequestElement('Path', $Path);
      } else {
         $Result = $this->_ParsedRequestElement('Path');
         if ($Path === TRUE) {
            // Encode the path.
            $Parts = explode('/', $Result);
            $Parts = array_map('urlencode', $Parts);
            $Result = implode('/', $Parts);
         }
      }
      
      return $Result;
   }
98929
protected static function validatePath($path)
    {
        if (!$path) {
            throw new InvalidArgumentException("Path must not be empty.");
        }
        if ($path == DIRECTORY_SEPARATOR) {
            throw new InvalidArgumentException("Path must not be root path.");
        }
        if ($path == '.' || $path == '..') {
            throw new InvalidArgumentException("Path must not be dot path.");
        }
        if (!is_dir($path)) {
            throw new InvalidArgumentException("Path must be an existing path.");
        }
    }
819071
protected function getFilePath(string $path): string
    {
        if (empty($path)) {
            $path = $this->fileName;
        }

        return $path;
    }
82816
public static function to($path)
    {
        $currentLanguage = \Translation::getLanguage();
        if (\Translation::getDefaultLanguage() === $currentLanguage) {
            $currentLanguage = '';
        } else {
            $currentLanguage = '/'.$currentLanguage;
        }
        return $currentLanguage.$path;
    }
859390
public function getAsInstance($path)
    {
        if (empty($path)) {
            return static::create([], $this->separator);
        }
        $value = $this->getAsArray($path);
        if (!is_array($value)) {
            throw new \InvalidArgumentException('You cannot return a Parameter instance on a non-array value.');
        }
        return static::create($this->getAsArray($path), $this->separator);
    }
167550
public function withPath($path)
    {
        if (!is_string($path) || strpos($path, '#') !== false || strpos($path, '?') !== false) {
            throw new \InvalidArgumentException('Path must be a string and cannot contain a fragment or query string');
        }

        if (!empty($path) && '/' !== substr($path, 0, 1)) {
            $path = '/' . $path;
        }

        return $this->_clone('path', $this->filterPath($path));
    }
96885
public function file($path)
    {
        if (!isset($this->_baseDir)) {
            throw new App\Exception('Base directory not set');
        }
        return $this->_baseDir->file($path);
    }
295898
public final function withPath($path): UriInterface
   {
       try {
           $uri = parent::withPath($path);
       } catch (InvalidArgumentException $e) {
           throw $e;
       }
       if ($uri->redirect) {
           $uri->redirect = "";
       }
       return $uri;
   }
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);
    }
1179098
public function path(string $path) : PathList
    {
        if (!file_exists($path)) {
            throw new \InvalidArgumentException(
                'Arg path doesn\'t exist, path[' . $path . '].'
            );
        }
        if (!is_dir($path)) {
            throw new \InvalidArgumentException(
                'Arg path is not a directory, path[' . $path . '].'
            );
        }
        $this->path = $path;
        return $this;
    }
603177
protected function splitPath($path)
    {
        $chunks = array_map(
            [$this, 'unescape'],
            preg_split('#(?<!\\\)\/#', ltrim($path, '/'))
        );

        if (empty($chunks) || (array_filter($chunks) !== $chunks)) {
            throw new \InvalidArgumentException('Invalid path provided:' . $path);
        }

        return $chunks;
    }
1195329
protected function parsePath($path = null)
    {
        $this->dirname   = '';
        $this->basename  = '';
        $this->extension = '';
        $this->filename  = '';

        if (empty($path)) {
            return $this;
        }

        $parts = pathinfo($path);

        if (isset($parts['dirname'])) {
            $this->dirname = rtrim($parts['dirname'], '/');
        }

        if (isset($parts['basename'])) {
            $this->basename = $parts['basename'];
        }

        if (isset($parts['extension'])) {
            $this->extension = $parts['extension'];
        }

        if (isset($parts['filename'])) {
            $this->filename = $parts['filename'];
        }

        return $this;
    }
216090
public function base_path($path = null)
    {
        return empty($path) ? $this->path : $this->path . $path;
    }
262295
public function withPath($path)
    {
        if (!is_string($path)) {
            throw new \InvalidArgumentException('Invalid path provided; must be a string');
        }
        $path = $this->filterPath($path);

        $new = clone $this;
        $new->path = $path;

        return $new;
    }
1320935
public function directory($path)
    {
        $dir = $this->realPath($path);
        if (!is_dir($dir)) {
            throw new \InvalidArgumentException(sprintf('The path is not a directory: %s', $dir));
        }

        return $path;
    }