Check if requested resource exists and return the path to it if yes.
@param string $name
@param string $type
@return string
@throws Exception
325979
protected function loadFont($name, $type)
    {
        if (file_exists($name)) {
            return $name;
        }

        $path = sprintf('%s/%s/%s', $this->resourcePath, $type, $name);
        if (file_exists($path)) {
            return $path;
        }

        throw new Exception(
            sprintf('The requested resource %s (%s) has not been found!', $name, $type)
        );
    }
887466
public function getPath($name)
    {
        if (!isset($this->config[$name]['prototype_path'])) {
            throw new \Exception(sprintf('Path for "%s" not found', $name));
        }

        return $this->config[$name]['prototype_path'];
    }
763022
public function findReversed($name, $reload = false, $type = 'all')
	{
		return $this->find($name, $reload, true, $type);
	}
787946
public function requestField(string $type, string $name): void
    {
        $this->fields[$type][] = $name;
        $this->updateUriQuery();
    }
1074282
private function getInternalID($type = null, $name = null)
    {
        $type = $type ? : "";
        $name = $name ? : "";
        return $type . "-" . $name;
    }
1197247
public static function current($name = 'default', $type = 'app')
	{
		// get the current version from the config
		$current = \Config::get('migrations.version.'.$type.'.'.$name);

		// any migrations defined?
		if ( ! empty($current))
		{
			// get the timestamp of the last installed migration
			if (preg_match('/^(.*?)_(.*)$/', end($current), $match))
			{
				// run migrations from start to current version
				return static::run(static::find_migrations($name, $type, null, $match[1]), $name, $type, 'up');
			}
		}

		// nothing to migrate
		return array();
	}
114084
public function getPathReducer($name): PathReducerInterface
    {
        if (isset($this->pathReducers[$name])) {
            return $this->pathReducers[$name];
        }

        throw new Exception(sprintf('Path reducer %s does not exist.', $name));
    }
108719
public function fetchData($filename, $type) {
        $absPath = $this->_getAbsPath($filename, $type);

        if ($absPath === false) {
            throw new Exception($absPath . ' does not exist');
        }

        $content = file_get_contents($absPath);

        if ($content !== false) {
            return $content;
        } else throw new Exception("Could not read {$absPath} on " . $this->getEnvironment());
    }
1012016
public function searchByNameAndType($name = null, $type = null)
    {
        $searchResult = $this->getRequest()->request(
            'POST',
            $this->getRequestUrl('models/searches'),
            [
                'model_query' => [
                    'name' => $name,
                    'type' => $type,
                ],

            ]
        );

        return $this->getModelsFromResult($searchResult);
    }
147253
protected function get($name)
    {
        if (isset($this->site[$name])) {
            return $this->site[$name];
        }

        throw new Exception("The property $name could not be found on the website ID " . (int)$this->id);
    }
848540
private function instanciateField(string $name, string $type): FieldInterface
    {
        $fieldClass = $this->getFieldClass($type);
        $field = new $fieldClass($name);

        if (!$field instanceof FieldInterface) {
            throw new Exception("Field class \"{$fieldClass}\" must implements ".FieldInterface::class);
        }

        if ($field instanceof TranslatorAwareFieldInterface) {
            $field->setTranslator($this->translator);
        }
        if ($field instanceof TwigAwareFieldInterface) {
            $field->setTwig($this->twig);
        }

        return $field;
    }
1227075
public function getTemplateName (string $type, string $name) : string
    {
        $component = $this->finder->findComponent($type, $name);

        if (null === $component)
        {
            throw new UnknownComponentException($name, $type);
        }

        return $component->getImportPath();
    }
845428
protected function getValidClass($type, $name)
    {
        $logging = \Plop\Plop::getInstance();;
        $w = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_1234567890\\';
        if (!is_string($name) || strspn($name, $w) !== strlen($name)) {
            $logging->debug(
                'Skipping %(type)s algorithm "%(name)s" (invalid class name)',
                array('type' => $type, 'name' => $name)
            );
            return null;
        }

        // Non-existing classes.
        $class = "\\fpoirotte\\Pssht\\$type$name";
        if (!class_exists($class)) {
            if (!interface_exists($class)) {
                $logging->debug(
                    'Skipping %(type)s algorithm "%(name)s" (class does not exist)',
                    array('type' => $type, 'name' => $name)
                );
            }
            return null;
        }

        // Abstract classes.
        $reflector = new \ReflectionClass($class);
        if ($reflector->isAbstract()) {
            return null;
        }

        // Classes that implement AvailabilityInterface
        // where the algorithm is not currently available.
        $iface = '\\fpoirotte\\Pssht\\AvailabilityInterface';
        if ($reflector->implementsInterface($iface) && !$class::isAvailable()) {
            $logging->debug(
                'Skipping %(type)s algorithm "%(name)s" (not available)',
                array('type' => $type, 'name' => $name)
            );
            return null;
        }

        // Classes that do not implement the proper interface.
        $iface = $this->interfaces[$type];
        if ($iface !== null && !$reflector->implementsInterface($iface)) {
            $logging->debug(
                'Skipping %(type)s algorithm "%(name)s" (invalid interface)',
                array('type' => $type, 'name' => $name)
            );
            return null;
        }

        return $class;
    }
150626
public static function getInstallPath($type, $name)
    {
        $locator = Grav::instance()['locator'];

        if ($type === 'theme') {
            $install_path = $locator->findResource('themes://', false) . DS . $name;
        } else {
            $install_path = $locator->findResource('plugins://', false) . DS . $name;
        }
        return $install_path;
    }
543438
public function get($name = null, $default = null, $type = null)
    {
        $get = $this->request['get'];
        gplcart_array_trim($get, true);

        if (isset($name)) {
            $result = gplcart_array_get($get, $name);
            $return = isset($result) ? $result : $default;
        } else {
            $return = $get;
        }

        gplcart_settype($return, $type, $default);
        return $return;
    }
939495
public function is_null(string $name, int $type = null): bool
    {
        if (isset(self::$globalOptions[$name]) && (is_null($type) || $type == self::TYPE_GLOBAL)) {
            return is_null(self::$globalOptions[$name]);
        } else {
            if (isset($this->options[$name]) && (is_null($type) || $type == self::TYPE_LOCAL)) {
                return is_null($this->options[$name]);
            } else {
                return true;
            }
        }
    }
329997
public function get($type, $name)
    {
        return isset($this->clients[$type][$name]) ? $this->clients[$type][$name] : null;
    }