@param       $name
@param array $args

@return false|string
@throws RouteNotFound
487043
public function routeNameToUrlString($name, array $args = [])
    {
        foreach ($args as $offset => $arg) {
            if ( !$arg ) {
                unset($args[ $offset ]);
            }
        }

        try {
            $url = $this->generate($name, $args);
        } catch (RouteNotFound $exception) {
            try {
                $newName = 'default.' . $name;
                $url     = $this->generate($newName, $args);
            } catch (RouteNotFound $e) {
                throw new RouteNotFound(sprintf('Route with name "%s" or "%s" not found', $newName, $name));
            }
        }

        if ( FALSE !== strstr($url, '{') ) {
            throw new RouteNotFound(
                sprintf('Route with name "%s" needs parameters. Temporary resulted into: %s', $name, $url)
            );
        }

        return $this->request->getBaseUrl() . $url;
    }
1124428
public function callMacro(string $name, array $args)
    {
        if (isset($this->macros[$name])) {
            return call_user_func_array($this->macros[$name], $args);
        }
        throw new RuntimeException('There is no macro with the given name "'.$name.'" to call');
    }
1368238
public function route($name, $parameters = [], $absolute = true)
    {
        if (! is_null($route = $this->routes->getByName($name))) {
            return $this->toRoute($route, $parameters, $absolute);
        }

        throw new InvalidArgumentException("Route [{$name}] not defined.");
    }
1226867
public function render($name, array $args = array())
    {
        if ($this->has($name)) {
            $callback = $this->widgets[$name];

            return $this->executeCallback($callback, $args);
        }

        return '';
    }
171898
public function getRoute($name, array $args = [])
    {
        if (!isset($this->names[$name])) {
            return null;
        }

        $route = $this->callbacks[$this->names[$name]];

        if (strpos($route->pattern, '(') === false) {
            // If we don't have any route parameters, just return the pattern
            // straight off. No need for any regex stuff.
            return $route->pattern;
        }

        // Convert all placeholders to %o = optional and %r = required
        $from    = ['/(\([^\/]+[\)]+[\?])/', '/(\([^\/]+\))/'];
        $to      = ['%o', '%r'];
        $pattern = preg_replace($from, $to, $route->pattern);

        $frags = explode('/', trim($pattern, '/'));
        $url   = [];

        // Loop thru the pattern fragments and insert the arguments
        foreach ($frags as $frag) {
            if ($frag == '%r') {
                if (!$args) {
                    // A required parameter, but no more arguments.
                    throw new Exception('Missing route parameters');
                }
                $url[] = array_shift($args);
                continue;
            }

            if ($frag == "%o") {
                if (!$args) {
                    // No argument for the optional parameter,
                    // just continue the iteration.
                    continue;
                }
                $url[] = array_shift($args);
                continue;
            }

            $url[] = $frag;
        }

        return '/' . implode('/', $url);
    }
95803
public function referenceObject(string $name, array $args): JavaProxy
    {
        $this->protocol->referenceBegin($name);
        $this->writeArgs($args);
        $this->protocol->referenceEnd();
        $val = $this->getInternalResult();

        return $val;
    }
279598
public function getRoute(string $name = null, ...$args)
    {
        if (is_null($name)) {
            return $this->get('route');
        }

        return $this->get('route', $name, ...$args);
    }
384335
public function invokeMethod($name, array $args = array(), $object = null)
    {
        return $this->getMethod($name)->invokeArgs($this->getObject($object), $args);
    }
1244829
public function attr($name, $args = [])
    {
        $attr = $this->hasMapping($name) ? $this->getMapping($name) : $name;
        
        if (func_num_args() > 1) {
            return $this->prefix(vsprintf($attr, (array) $args));
        }
        
        return $this->prefix($attr);
    }
226693
public static function getRouteByName($name, $parameters = [], $absolute = true) {
		foreach ( self::$routes as $routePath => $routeDetails ) {
			if (self::checkRouteName ( $routeDetails, $name )) {
				if (\sizeof ( $parameters ) > 0)
					$routePath = self::_getURL ( $routePath, $parameters );
				if (! $absolute)
					return \ltrim ( $routePath, '/' );
				else
					return $routePath;
			}
		}
		return false;
	}
533327
private function findRouteByName($name)
    {
        if (null === $route = $this->routes->get($name)) {
            throw new \RuntimeException(sprintf('Route "%s" not found.', $name));
        }

        return $route;
    }
513162
public function url($name, $params = array()) {
		if (!isset($this->namedRoutes[$name])) {
			throw new RouterException("No route matches this name : $name");
		}

		return $this->namedRoutes[$name]->getUrl($params);
	}
938780
private function applySetOperator($name, array $args)
    {
        $reflection = new \ReflectionClass('\\Ruler\\Operator\\' . $name);
        array_unshift($args, $this);

        return $this->wrap($reflection->newInstanceArgs($args));
    }
1014363
public static function page($name = "", $args = []) {
		if (Router::$context == "")
			$path = "/".$name;
		else
			$path = Router::$context."/".$name;

		$path = str_replace("root/", "", $path);

		//Add to routes
		Router::$routes[$path] = array_merge(Router::$stackedOptions, $args);
	}
1077799
public static function path($name, $parameters = [], $absolute = false) {
		return self::getRouteByName ( $name, $parameters, $absolute );
	}
1022731
public static function renderBlocks($name, $args = array())
    {
        global $PPHP, $_SESSION;

        array_merge_assoc(
            self::$_stash,
            $args,
            array(
                'config' => $PPHP['config'],
                'session' => $_SESSION,
                'req' => grab('request')
            )
        );
        try {
            $template = self::$_twig->loadTemplate($name);
            $blockNames = $template->getBlockNames(self::$_stash);
            $results = array();
            foreach ($blockNames as $blockName) {
                $results[$blockName] = $template->renderBlock($blockName, self::$_stash);
            };
        } catch (\Exception $e) {
            echo $e->getMessage();
        };
        return $results;
    }
1204690
public function routeExists($name)
    {
        return (null === $this->router->getRouteCollection()->get($name)) ? false : true;
    }