Return the configured named path segment.

@param string $name Name of path segment

@return string The path segment

@throws \InvalidArgumentException
501699
private function getPath($name)
    {
        if (!isset($this->paths[$name])) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Unknown path segment name "%s", known paths are "%s"',
                    $name,
                    implode('", "', array_keys($this->paths))
                )
            );
        }

        $name = $this->paths[$name];

        return $name;
    }
1199644
protected function getPath($name)
    {
        $name = Str::replaceFirst($this->rootNamespace(), '', $name);

        return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php';
    }
570182
public function getArgument($name)
    {
        if (!$this->hasArgument($name)) {
            throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
        }

        $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;

        return $arguments[$name];
    }
1295429
public function get($name)
    {
        if (!isset($this->adapters[$name])) {
            throw new \InvalidArgumentException(sprintf('No Adapter with name "%s" is registered.', $name));
        }

        return $this->adapters[$name];
    }
612091
public function getPath(string $name = null)
    {
        if (is_null($name)) {
            return $this->get('path');
        }

        return $this->get('path', $name);
    }
854399
protected function getCacheConfig(string $name)
    {
        $cache = $this->config->get($this->getConfigName().'.cache');

        if (!is_array($config = array_get($cache, $name)) && !$config) {
            throw new InvalidArgumentException("Cache [$name] not configured.");
        }

        $config['name'] = $name;

        return $config;
    }
462304
protected function getPath($name): string
    {
        $name = str_replace_first($this->rootNamespace(), $this->moduleName().DIRECTORY_SEPARATOR.'config', $name);

        if (! $this->files->exists($path = $this->laravel['path'].DIRECTORY_SEPARATOR.$this->moduleName())) {
            throw new \Exception("Invalid path: {$path}");
        }

        return $this->laravel['path'].DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $name).'.php';
    }
429360
public function find(string $name)
    {
        if (! \array_key_exists($name, $this->keyMap)) {
            throw new InvalidArgumentException("Name [{$name}] is not available.");
        }

        return $this->controls[$this->keyMap[$name]];
    }
500602
public function findTemplate(string $name): string
    {
        if (isset($this->cache[$name])) {
            return $this->cache[$name];
        }
        if (isset($this->errorCache[$name])) {
            throw new \InvalidArgumentException($this->errorCache[$name]);
        }

        list($namespace, $shortname) = $this->parseName($name);

        if (! isset($this->paths[$namespace])) {
            $this->errorCache[$name] = sprintf('There are no registered paths for namespace "%s".', $namespace);

            throw new \InvalidArgumentException($this->errorCache[$name]);
        }

        foreach ($this->paths[$namespace] as $path) {
            foreach ($this->getPossibleViewFiles($shortname) as $file) {
                if (is_file($viewPath = $path . '/' . $file)) {
                    if (false !== $realpath = realpath($viewPath)) {
                        return $this->cache[$name] = $realpath;
                    }

                    return $this->cache[$name] = $viewPath;
                }
            }
        }

        $this->errorCache[$name] = sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace]));

        throw new \InvalidArgumentException($this->errorCache[$name]);
    }
295274
public function getRoute($name)
    {
        if (empty($name)) {
            throw new \InvalidArgumentException("Route name not provided.");
        }

        // TODO: This is not very efficient, maybe find a better way
        foreach ($this->routes as $route) {
            if ($route->getName() === $name) {
                return $route;
            }
        }

        throw new \Exception("Route \"$name\" not found.");
    }
1086432
public static function getByName($name)
    {
        $name = (string)$name;
        $class = get_called_class();
        if (isset(self::$instances[$class][$name])) {
            return self::$instances[$class][$name];
        }
        $const = $class . '::' . $name;
        if (!defined($const)) {
            throw new \InvalidArgumentException($const . ' not defined');
        }
        return self::$instances[$class][$name] = new $class(constant($const));
    }
541229
public function get($name)
    {
        if (! isset($this->routes[$name])) {
            throw new InvalidArgumentException(
                sprintf('The route with given name "%s" not exists.', $name)
            );
        }

        return $this->routes[$name];
    }
297085
protected function getPath($name)
    {
        $name = str_replace_first($this->getPackageNamespace(), '', $name);
        $this->checkDestination();
        return base_path() . $this->getDestination() . '/'.str_replace('\\', '/', $name).'.php';
    }
1008722
protected function getPath($name)
    {
        $name = str_replace_first($this->laravel->getNamespace(), '', $name);

        return $this->laravel['path'].'/'.str_replace('\\', '/', $name).'.php';
    }
1280042
public function getConfigurationPath($name = null)
    {
        if (! $name) {
            $appConfigDir = $this->basePath('configs').'/';

            if (file_exists($appConfigDir)) {
                return $appConfigDir;
            } elseif (file_exists($path = __DIR__.'/configs/')) {
                return $path;
            }
        } else {
            $appConfigPath = $this->basePath('configs').'/'.$name.'.php';
            if (file_exists($appConfigPath)) {
                return $appConfigPath;
            } elseif (file_exists($path = __DIR__.'/configs/'.$name.'.php')) {
                return $path;
            }
        }
    }
1252110
public function get($name)
    {
        $lowerName = strtolower($name);
        if (isset($this->properties[$lowerName])) {
            return $this->properties[$lowerName];
        }
        throw new \InvalidArgumentException(
            "Undefined property: $name (Node ID: ".$this->properties['id'].')'
        );
    }
695527
protected function getParam($name)
    {
        if (!isset($this->params[$name])) {
            throw new \InvalidArgumentException("Param is not valid: ".$name);
        }

        return $this->params[$name];
    }