@param array        $value
@param string       $route

@return mixed|string
359956
protected function calculateFullPath(array &$value, $route)
    {
        if (!empty($value['as_id'])) {
            preg_match_all('/{(.*?)}/', $route, $matches);
            $route = str_replace($matches[0], '{'.$value['as_id'].'}', $route);
        }

        return url($route);
    }
580264
public function convertRouteParam($route)
    {
        $patterns = array(
            ':any?' => ':[a-zA-Z0-9\.\-_%=]?+',
            ':num?' => ':[0-9]?+',
            ':all?' => ':.?*',
            ':num' => ':[0-9]+',
            ':any' => ':[a-zA-Z0-9\.\-_%=]+',
            ':all' => ':.*',
        );

        $route = str_replace(array_keys($patterns), array_values($patterns), $route);

        return $route;
    }
861316
protected static function getAssetContentsByRoute($route)
    {
        $result = null;
        try {
            $app = Application::getFacadeApplication();
            $router = $app->make(RouterInterface::class);
            $context = new RequestContext();
            $context->fromRequest($app->make(Request::class));
            $context->setMethod('GET');
            $matched = $router->getRouteByPath($route, $context);
            $controller = $matched->getAction();
            $callable = null;
            if (is_string($controller)) {
                $chunks = explode('::', $controller, 2);
                if (count($chunks) === 2) {
                    if (class_exists($chunks[0])) {
                        $array = [$app->make($chunks[0]), $chunks[1]];
                        if (is_callable($array)) {
                            $callable = $array;
                        }
                    }
                } else {
                    if (class_exists($controller) && method_exists($controller, '__invoke')) {
                        $callable = $app->make($controller);
                    }
                }
            } elseif (is_callable($controller)) {
                $callable = $controller;
            }
            if ($callable !== null) {
                ob_start();
                $r = call_user_func($callable, false);
                if ($r instanceof Response) {
                    $result = $r->getContent();
                } elseif ($r !== false) {
                    $result = ob_get_contents();
                }
                ob_end_clean();
            }
        } catch (Exception $x) {
        }

        return $result;
    }
520855
private function createRegexp($uri, Route $route)
    {
        $patterns = [];
        foreach ($route->getParameterPatterns() as $key => $pattern) {
            $patterns['\\{' . $key . '\\}'] = '(' . $pattern . ')';
        }
        $uri = preg_quote($uri, '#');

        return strtr($uri, $patterns);
    }
922138
public static function path(&$array, $path = array(), $value = '>-null-<')
    {
        return $value !== '>-null-<'
            ? self::pathSet($array, $path, $value)
            : self::pathGet($array, $path);
    }
418958
function toArray($route = null,array $parameters = array(),$format = null) {
        if($format === null){
            $format = $this->defaultFormat;
        }
        if(in_array($format, $this->formatArray)){
            $method = 'formatToArray'.ucfirst($format);
            return $this->$method($route,$parameters);
        }
    }
898773
public function checkRouteParam($param, $value)
    {
        if (!$this->route) {
            return false;
        }

        $paramValue = $this->route->parameter($param);

        // If the parameter value is an instance of Model class, we compare $value with the value of
        // its primary key.
        if (is_a($paramValue, Model::class)) {
            return $paramValue->{$paramValue->getKeyName()} == $value;
        }

        return $paramValue == $value;
    }
285416
protected function getUrl($route, $params = array())
    {
        $urlHelper = $this->getView()->plugin('url');

        if ('#' === $route[0]) {
            return $route;
        }

        return $urlHelper($route, $params, $this->getRouteOptions());
    }
161455
private function deserializeValue($value)
    {
        if (is_array($value) && isset($value['class']) && isset($value['payload'])) {
            return $this->deserializeObjectRecursively($value);
        } elseif (is_array($value)) {
            return $this->deserializeArrayRecursively($value);
        }

        return $value;
    }
428167
protected function prepareValue($value)
    {
        $params = $this->getOperatorParams();
        $method = $params['method'];
        switch ($method) {
            case 'where':
            case 'whereNull':
            case 'whereNotNull':
                break;
            case 'whereBetween':
            case 'whereNotBetween':
                if (! is_array($value)) {
                    $value = explode(',', $value, 2);
                }
                break;
            case 'whereIn':
            case 'whereNotIn':
                if (! is_array($value)) {
                    $value = explode(',', $value);
                }
                break;
        }

        return $value;
    }
390713
public function routeData($key = null, $value = null) {
        switch (func_num_args()) {
            case 0:
                return $this->routeData;
            case 1:
                if (is_array($key)) {
                    $this->routeData = array_merge($this->routeData, $key);
                    return $this;
                } elseif (is_null($key)) {
                    $this->routeData = array();
                    return $this;
                } elseif (isset($this->routeData[$key])) {
                    return $this->routeData[$key];
                } else {
                    return;
                }
            case 2:
                if (is_null($value)) {
                    unset($this->routeData[$key]);
                } else {
                    $this->routeData[$key] = $value;
                }
                return $this;

        }
    }
227583
protected function performBinding($key, $value, $route)
    {
        $callback = $this->binders[$key];

        return call_user_func($callback, $value, $route);
    }
165833
private function getMiddleWareFromRoute(Route $route)
    {
        if (!$route->group) {
            return $route->middleWare;
        }
        $groupMiddleWare = $this->getMiddleWareFromGroup($route->group);
        return \array_merge($groupMiddleWare, $route->middleWare);
    }
649943
private function routeRegexp(Route $route, array $data = null) : string
    {
        $regexp = $route->getMatch();

        // AbstractApp::logger()->debug($regexp);

        preg_match_all('`\{\{(.+)\}\}`U', $regexp, $matches);
        if (sizeof($matches[1]) == 0) {
            return $regexp;
        }

        foreach ($matches[1] as $var) {
            $replace = '{{' . $var . '}}';
            $explode = explode(':', $var);
            $type = array_shift($explode);
            $value = implode(':', $explode);
            unset($dest);

            switch ($type) {
                case 'T':
                    $dest = $this->routeRegexpTranslatedText($route, $value, $data);
                    break;

                case 'L':
                    $dest = $this->routeRegexpLocales($data);
                    break;

                case 'C': // mandatory capture variable with optionnal regexp
                case 'O': // optionnal capture variable with optionnal regexp
                case 'S': // uncapture text with optionnal regexp
                    $dest = $this->routeRegexpCapture($type, $route, $value, $data);
                    break;

                default:
                    throw new \InvalidArgumentException(
                        sprintf("Invalid route variable '%s' on route '%s'", $type, $route->getName())
                    );
            }

            $regexp = str_replace(
                $replace,
                isset($dest) ? $dest : '',
                $regexp
            );
        }

        return $regexp;
    }
1178904
public static function createUrl(array $data, $route)
    {
        // Query start
        $placeholder = '(:var)';
        $url = '?';

        $url .= http_build_query($data);
        $url = str_replace(rawurlencode($placeholder), $placeholder, $url);

        return $route.$url;
    }
712107
private function routeMatch(string $routeRegex, string $route)
    {
        $matches = [];
        if (preg_match($routeRegex, $route, $matches)) {
            unset($matches[0]);

            return array_values($matches);
        }

        return false;
    }
103190
private function matchRoute(string $route, string $url, &$matches, $value = null)
    {
        switch ($this->getParsingMode($route)) {
            case self::MODE_REGEX:
                // Evaluate & remove first match (full route)
                $matched    = preg_match(self::buildRegex($route, !is_null($value)), $url, $matches);
                array_shift($matches);
                break;

            case self::MODE_STRING:
                // final route
                if (is_null($value)) {
                    $matched = $route === $url;
                    $matches = [];

                    // route prefix
                } else {
                    $matched = empty($route) ? empty($url) : strpos($url, $route) === 0;
                    $matches = [str_replace($route, '', $url)];
                }
                break;
        }

        // Route matches
        if (is_null($value)) {
            return $matched;
        }

        // value is sub-routes array
        $sub_routes = !is_callable($value) && is_array($value);
        return $matched && $sub_routes;
    }