Library

@param    string $route
162412
public function library($route, $config = array()) {
		// Sanitize the call
		$route = preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route);

		$file = DIR_SYSTEM . 'library/' . $route . '.php';
		$class = str_replace('/', '\\', $route);

		if (is_file($file)) {
			include_once($file);

			$this->registry->set(basename($route), new $class($this->registry));
		} else {
			throw new \Exception('Error: Could not load library ' . $route . '!');
		}
	}
1333386
public function findByRoute(string $route): ?PageInterface
    {
        if (!in_array($route, $this->getCmsRoutes(), true)) {
            return null;
        }

        return $this->repository->findOneByRoute($route);
    }
579907
public function release($route)
    {
        //argument 1 must be a string
        Argument::i()->test(1, 'string');

        if ($this->valid($route)) {
            unset($this->route[strtolower($route)]);
        }

        return $this;
    }
979626
public function gatherRouteMiddlewares( Route $route )
	{
		return Collection::make( $route->middleware() )->map( function ( $name )
		{
			return Collection::make( $this->resolveMiddlewareClassName( $name ) );
		} )->flatten()->all();
	}
773422
private function extractFunctionFromRoute(Route $route)
    {
        $controller = explode('::', $this->extractControllerDefaultFromRoute($route));

        return isset($controller[1]) ? $controller[1] : null;
    }
617208
public static function add($route, $parameters)
    {
        self::$route = $route;
        array_shift($parameters);
        self::$parameters = $parameters;
    }
525681
protected function addWhereClausesToRoute($route)
    {
        $patterns = \app(\Illuminate\Routing\Router::class)->getPatterns();

        $route->where(\array_merge(
            $patterns, $route->getAction()['where'] ?? []
        ));

        return $route;
    }
556024
public function updateInstances($route, $request)
    {
        $this->request = $request;
        if ($request) {
            $this->uri = urldecode($request->path());
        }

        $this->route = $route;
        if ($route) {
            $this->action = $route->getActionName();

            $actionSegments   = Str::parseCallback($this->action, null);
            $this->controller = head($actionSegments);
            $this->method     = last($actionSegments);
        }
    }
459989
protected function _parse($route) {
		if (is_string($route)) {
			$this->_ensureHere();

			$url = parse_url($route);
			$_path = rtrim($url['path'], '/');
			if ($_path . '?' . Hash::get($url, 'query') === $this->_hereQuery) {
				return true;
			}

			if ($_path === $this->_here) {
				return true;
			}

			return false;
		}

		$count = count($route);
		if ($count == 0) {
			return false;
		}

		foreach ($route as $key => $value) {
			if (array_key_exists($key, $this->request->params)) {
				$values = (array)$value;
				$check = (array)$this->request->params[$key];

				$hasNullValues = (count($values) != count(array_filter($values)) || count($values) == 0);
				$currentValueIsNullish = (in_array(null, $check) || in_array('', $check) || count($check) == 0);
				if ($hasNullValues && $currentValueIsNullish) {
					$count--;
					continue;
				}

				if (in_array($key, array('controller', 'plugin'))) {
					foreach ($check as $k => $_check) {
						$check[$k] = Inflector::underscore(strtolower($_check));
					}
				} else {
					foreach ($check as $k => $_check) {
						$check[$k] = strtolower($_check);
					}
				}

				if (count($values) > 0) {
					foreach ($values as $k => $v) {
						if (in_array(strtolower($v), $check)) {
							$count--;
							break;
						}
					}
				} elseif (count($check) === 0) {
					$count--;
				}
			} elseif (is_numeric($key) && isset($this->request->params['pass'])) {
				if (is_array($this->request->params['pass'])) {
					if (Hash::contains($this->request->params['pass'], $value)) {
						$count--;
					}
				}
			}
		}

		return ($count == 0);
	}
1188241
private function mapRoute2Content($route)
    {
        // Look it up in the index
        list($keyIndex, $content) = $this->mapRoute2Index($route);
        $filtered = $this->loadFileContentPhaseOne($keyIndex);

        return [$keyIndex, $content, $filtered];
    }
309334
public function createController($route)
    {
        preg_match('/(default)/', $route, $match);
        if (isset($match[0]))
            return parent::createController($route);

        return parent::createController("{$this->defaultRoute}/{$route}");
    }
709553
protected function callPatternFilters($route, $request)
	{
		foreach ($this->findPatternFilters($request) as $filter => $parameters)
		{
			$response = $this->callRouteFilter($filter, $parameters, $route, $request);

			if ( ! is_null($response)) return $response;
		}
	}
1342711
public function add(Route $route): self
    {
        if ($route->uri === ""
            || $route->method === 0b0
            || $route->action === null) {
            $this->logger->error("Route incomplete. Unable to add");
            $this->logger->debug("Incomplete Route", [$route]);
            throw new Exception\RouteIncompleteException(
                "Retrieved Route is not complete and can not be stored"
            );
        }

        // store default route
        if ($route->isDefault) {
            if ($this->defaultRoute === null) {
                $this->defaultRoute = $route;
            } else {
                $this->logger->debug(
                    "Default route already added to container, skipping add.",
                    ["route" => $route, "storedDefault" => $this->defaultRoute]
                );
            }
        }

        // store 404 route
        if ($route->is404) {
            if ($this->e404Route === null) {
                $this->e404Route = $route;
                $this->logger->info("404 route added to Route Container");
            } else {
                $this->logger->debug(
                    "404 route already added to container, skipping add.",
                    ["route" => $route, "stored404" => $this->e404Route]
                );
            }

            return $this;
        }

        // store route to regular container
        $this->routes[] = $route;

        $this->logger->info(
            "Route successfully added to Container",
            ["uri" => $route->uri]
        );

        return $this;
    }
1297815
private function loadAndParseRoute($route)
    {
         // Get meta into view structure
         $meta = $this->getMetaForRoute($route);
         unset($meta["__toc__"]);
         unset($meta["views"]);

        // Get filtered content from route
        list($routeIndex, , $filtered) =
            $this->mapRoute2Content($route);

        // Merge frontmatter with meta
        // then merge frontmatter base into views main
        $filtered->frontmatter = array_merge_recursive_distinct(
            $meta,
            $filtered->frontmatter
        );

        // Do phase 2 processing to get new filtered content
        // (and updated frontmatter)
        $this->processContentPhaseTwo($filtered);

        // Create complete frontmatter, inluding content
        $filtered->frontmatter["data"]["content"] = isset($filtered->text)
            ? $filtered->text
            : null;

        // Load additional content for view, based on data-meta
        $view = ["main" => $filtered->frontmatter];
        $this->loadAdditionalContent($view, $route, $routeIndex);

        return $view["main"];
    }
676963
public function setRoute($route)
        {
            if (null !== $route && (!is_string($route) || strlen($route) < 1)) {
                throw new Exception(
                    'Invalid argument: $route must be a non-empty string or null'
                );
            }

            $this->_route     = $route;
            $this->_hrefCache = null;

            return $this;
        }
1221427
public function setMethod($route)
		{
			// variables
			$methodUri      = trim(substr($route, strlen($this->route)), '/');
			$segments       = explode(',', $methodUri);

			// properties
			$this->method    = array_shift($segments);

			// return
			return $this;
		}
799988
protected function appendGroupInfo(Route $route): void
    {
        $path = $bak = $route->getPath();

        // Always add '/' prefix.
        $path = \strpos($path, '/') === 0 ? $path : '/' . $path;
        $path = $this->currentGroupPrefix . $path;

        // Has setting 'ignoreLastSlash'
        if ($path !== '/' && $this->ignoreLastSlash) {
            $path = \rtrim($path, '/');
        }

        // Not in group and path not change.
        if ($bak === $path) {
            return;
        }

        $route->setPath($path);

        // Not in group
        if (!$this->currentGroupPrefix) {
            return;
        }

        if ($this->currentGroupOption) {
            $route->setOptions(\array_merge($this->currentGroupOption, $route->getOptions()));
        }

        // Prepend group middleware at before.
        if ($this->currentGroupChains) {
            $route->setChains(\array_merge($this->currentGroupChains, $route->getChains()));
        }
    }