Adds a mirror of a route.

@param string $uriPattern
@param string $mirror
@return IRoutePatternSetterAdapter
433348
public function mirror($uriPattern, $mirror)
    {
        return $this->any(
            $uriPattern,
            function (AppController $appController, array $args) use ($mirror) {
                return $appController->call($mirror, $args);
            }
        );
    }
1019444
public function resolve(Request $request, Response $response, UriPath $uriPath)
    {
        if ($this->target instanceof HttpUri) {
            $targetUri = $this->target;
        } else {
            $targetUri = $request->uri()->withPath($this->target);
        }

        $response->redirect($targetUri, $this->statusCode);
    }
220192
public function getRoute(): RouteInterface
    {
        // Find route by regexp and URI
        $matches = $this->getMatches();

        // Cleanup the array of matches, then reindex array
        $matches = array_values(array_filter($matches));

        // If we have some classes in result of regexp
        $result = !empty($matches)
            // Take first from matches
            ? $matches[0] // Here the Route() object
            // Create new object with error inside
            : $this->getError();

        return $result;
    }
729045
public void addServletMapping( String servletName, String urlPattern )
    {
        if ( ! urlPattern.endsWith( PageFlowConstants.PAGEFLOW_EXTENSION ) )
        {
            super.addServletMapping( servletName, urlPattern );
        }
    }
773786
public function createView(RouterInterface $router, $route, $params)
    {
        $view = new View();

        $view->count = $this->getNbPages();
        $view->currentPage = $this->getCurrentPage();
        $view->pages = $this->getPagerLinks($router, $route, $params);
        /** @noinspection PhpParamsInspection */
        $view->first = reset($view->pages);
        /** @noinspection PhpParamsInspection */
        $view->last = end($view->pages);
        $view->next = $this->hasNextPage() ? $view->pages[$view->currentPage + 1] : null;
        $view->prev = $this->hasPreviousPage() ? $view->pages[$view->currentPage - 1] : null;

        return $view;
    }
1135104
public static Route GET(String uriPattern, RouteHandler routeHandler) {
        return new Route(HttpConstants.Method.GET, uriPattern, routeHandler);
    }
832698
public function addSlimPlugins(RouterInterface $router, $uri)
    {
        $smartyPlugins = new SmartyPlugins($router, $uri);
        $this->smarty->registerPlugin('function', 'path_for', [$smartyPlugins, 'pathFor']);
        $this->smarty->registerPlugin('function', 'base_url', [$smartyPlugins, 'baseUrl']);
    }
922259
protected function mirrorReferencedProjection(EntityReferenceInterface $projection)
    {
        $projection_type = $projection->getType();
        $mirrored_attribute_map = $projection_type->getAttributes()->filter(
            function (AttributeInterface $attribute) {
                return (bool)$attribute->getOption('mirrored', false) === true;
            }
        );

        // Don't need to load a referenced entity if the mirrored attribute map is empty
        if ($mirrored_attribute_map->isEmpty()) {
            return $projection;
        }

        // Load the referenced projection to mirror values from
        $referenced_type = $this->projection_type_map->getByClassName(
            $projection_type->getReferencedTypeClass()
        );
        $referenced_identifier = $projection->getReferencedIdentifier();
        if (empty($referenced_identifier)) {
            $this->logger->error('[Zombie Alarm] RefId EMPTY: '.json_encode($projection->getRoot()->toArray()));
            return $projection;
        }

        if ($referenced_identifier === $projection->getRoot()->getIdentifier()) {
            $referenced_projection = $projection->getRoot(); // self reference, no need to load
        } else {
            $referenced_projection = $this->loadReferencedProjection($referenced_type, $referenced_identifier);
            if (!$referenced_projection) {
                $this->logger->debug('[Zombie Alarm] Unable to load referenced projection: ' . $referenced_identifier);
                return $projection;
            }
        }

        // Add default attribute values
        $mirrored_values['@type'] = $projection_type->getPrefix();
        $mirrored_values['identifier'] = $projection->getIdentifier();
        $mirrored_values['referenced_identifier'] = $projection->getReferencedIdentifier();
        $mirrored_values = array_merge(
            $projection->createMirrorFrom($referenced_projection)->toArray(),
            $mirrored_values
        );

        return $projection_type->createEntity($mirrored_values, $projection->getParent());
    }
1149973
private function hasRoute($routePattern, $routeName)
    {
        if (!$routeName) {
            throw new RoutingRuntimeException('Route name is empty!');
        }

        $route = $this->routeManager->findByRoutePattern($routePattern);

        return ((null !== $route) && ($routeName !== $route->getName()));
    }
1309412
public function resolve(UriInterface $uri, UriInterface $baseUri)
    {
        $baseUriReflector = new ReflectionObject($baseUri);
        if (!$baseUriReflector->hasMethod('resolve')) {
            $baseUri = new Uri($baseUri->toString());
            if ($uri instanceof Uri) {
                $uri = clone $uri;
            } else {
                $uri = new Uri($uri->toString());
            }
        } elseif (!$uri instanceof $baseUri) {
            $uri = $baseUriReflector->newInstance($uri->toString());
        } else {
            $uri = clone $uri;
        }

        return $uri->resolve($baseUri);
    }
1285213
public function postIntercept($postInterceptor): ConfigurableRoute
    {
        if (!is_callable($postInterceptor) && !($postInterceptor instanceof PostInterceptor) && !class_exists((string) $postInterceptor)) {
            throw new \InvalidArgumentException(
                    'Given pre interceptor must be a callable, an instance of '
                    . PostInterceptor::class
                    . ' or a class name of an existing post interceptor class'
            );
        }

        $this->postInterceptors[] = $postInterceptor;
        return $this;
    }
1355310
public static Mirror newInstanceForClassName(String className) 
	throws ClassNotFoundException, InstantiationException, IllegalAccessException
	{
		className = className.trim();
		Class<?> objClass = Class.forName(className);

		   
		return new Mirror(ClassPath.newInstance(objClass));
	}
386267
public function any($uriPattern, callable $controller)
    {
        return new IRoutePatternSetterAdapter(
            $this->getFrontController()->addController($uriPattern, $controller)->getPattern()
        );
    }
1298930
public function parse()
    {
        if ($this->isParsed || $this->uriPattern === null || $this->uriPattern === '') {
            return;
        }
        $this->routeParts = [];
        $currentRoutePartIsOptional = false;
        if (substr($this->uriPattern, -1) === '/') {
            throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" ends with a slash, which is not allowed. You can put the trailing slash in brackets to make it optional.', 1234782997);
        }
        if ($this->uriPattern[0] === '/') {
            throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" starts with a slash, which is not allowed.', 1234782983);
        }

        $matches = [];
        preg_match_all(self::PATTERN_EXTRACTROUTEPARTS, $this->uriPattern, $matches, PREG_SET_ORDER);

        /** @var $lastRoutePart RoutePartInterface */
        $lastRoutePart = null;
        foreach ($matches as $match) {
            $routePartType = empty($match['dynamic']) ? self::ROUTEPART_TYPE_STATIC : self::ROUTEPART_TYPE_DYNAMIC;
            $routePartName = $match['content'];
            if (!empty($match['optionalStart'])) {
                if ($lastRoutePart !== null && $lastRoutePart->isOptional()) {
                    throw new InvalidUriPatternException('the URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains successive optional Route sections, which is not allowed.', 1234562050);
                }
                $currentRoutePartIsOptional = true;
            }
            $routePart = null;
            switch ($routePartType) {
                case self::ROUTEPART_TYPE_DYNAMIC:
                    if ($lastRoutePart instanceof DynamicRoutePartInterface) {
                        throw new InvalidUriPatternException('the URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains successive Dynamic Route Parts, which is not allowed.', 1218446975);
                    }
                    if (isset($this->routePartsConfiguration[$routePartName]['handler'])) {
                        $routePart = $this->objectManager->get($this->routePartsConfiguration[$routePartName]['handler']);
                        if (!$routePart instanceof DynamicRoutePartInterface) {
                            throw new InvalidRoutePartHandlerException(sprintf('routePart handlers must implement "%s" in route "%s"', DynamicRoutePartInterface::class, $this->getName()), 1218480972);
                        }
                    } elseif (isset($this->routePartsConfiguration[$routePartName]['objectType'])) {
                        $routePart = new IdentityRoutePart();
                        $routePart->setObjectType($this->routePartsConfiguration[$routePartName]['objectType']);
                        if (isset($this->routePartsConfiguration[$routePartName]['uriPattern'])) {
                            $routePart->setUriPattern($this->routePartsConfiguration[$routePartName]['uriPattern']);
                        }
                    } else {
                        $routePart = new DynamicRoutePart();
                    }
                    $routePartDefaultValue = ObjectAccess::getPropertyPath($this->defaults, $routePartName);
                    if ($routePartDefaultValue !== null) {
                        $routePart->setDefaultValue($routePartDefaultValue);
                    }
                    break;
                case self::ROUTEPART_TYPE_STATIC:
                    $routePart = new StaticRoutePart();
                    if ($lastRoutePart !== null && $lastRoutePart instanceof DynamicRoutePartInterface) {
                        /** @var DynamicRoutePartInterface $lastRoutePart */
                        $lastRoutePart->setSplitString($routePartName);
                    }
            }
            $routePart->setName($routePartName);
            if ($currentRoutePartIsOptional) {
                $routePart->setOptional(true);
                if ($routePart instanceof DynamicRoutePartInterface && !$routePart->hasDefaultValue()) {
                    throw new InvalidRouteSetupException(sprintf('There is no default value specified for the optional route part "{%s}" of route "%s", but all dynamic optional route parts need a default.', $routePartName, $this->getName()), 1477140679);
                }
            }
            $routePart->setLowerCase($this->lowerCase);
            if (isset($this->routePartsConfiguration[$routePartName]['options'])) {
                $routePart->setOptions($this->routePartsConfiguration[$routePartName]['options']);
            }
            if (isset($this->routePartsConfiguration[$routePartName]['toLowerCase'])) {
                $routePart->setLowerCase($this->routePartsConfiguration[$routePartName]['toLowerCase']);
            }

            $this->routeParts[] = $routePart;
            if (!empty($match['optionalEnd'])) {
                if (!$currentRoutePartIsOptional) {
                    throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains an unopened optional section.', 1234564495);
                }
                $currentRoutePartIsOptional = false;
            }
            $lastRoutePart = $routePart;
        }
        if ($currentRoutePartIsOptional) {
            throw new InvalidUriPatternException('The URI pattern "' . $this->uriPattern . '" of route "' . $this->getName() . '" contains an unterminated optional section.', 1234563922);
        }
        $this->isParsed = true;
    }
454544
public function setRoute(RouteInterface $route): RouterInterface
    {
        $regexp = $route->getRegexp();
        $this->_routes[$regexp] = $route;
        return $this;
    }
825134
protected function _addService(Zend_Server_Reflection_Class $refclass, DOMElement $target)
    {
        foreach ($refclass->getMethods() as $method) {
            if (!$method->isPublic()
                || $method->isConstructor()
                || ('__' == substr($method->name, 0, 2))
            ) {
                continue;
            }

            foreach ($method->getPrototypes() as $proto) {
                $op = $this->_xml->createElement('operation');
                $op->setAttribute('name', $method->getName());

                $rettype = $this->_registerType($proto->getReturnType());
                $op->setAttribute('returnType', $rettype);

                foreach ($proto->getParameters() as $param) {
                    $arg = $this->_xml->createElement('argument');
                    $arg->setAttribute('name', $param->getName());

                    $type = $param->getType();
                    if ($type == 'mixed' && ($pclass = $param->getClass())) {
                        $type = $pclass->getName();
                    }

                    $ptype = $this->_registerType($type);
                    $arg->setAttribute('type', $ptype);

                    if($param->isDefaultValueAvailable()) {
                        $arg->setAttribute('defaultvalue', $param->getDefaultValue());
                    }

                    $op->appendChild($arg);
                }

                $target->appendChild($op);
            }
        }
    }
729057
private static Mirror getMirror(FeatureProvider provider, Collision collision)
    {
        if (collision.hasMirror() && provider.hasFeature(Mirrorable.class))
        {
            return provider.getFeature(Mirrorable.class).getMirror();
        }
        return Mirror.NONE;
    }