Zend\Mvc\View\Http\InjectRoutematchParamsListener::injectParams PHP Метод

injectParams() публичный Метод

Take parameters from RouteMatch and inject them into the request.
public injectParams ( MvcEvent $e ) : void
$e Zend\Mvc\MvcEvent
Результат void
    public function injectParams(MvcEvent $e)
    {
        $routeMatchParams = $e->getRouteMatch()->getParams();
        $request = $e->getRequest();
        if (!$request instanceof HttpRequest) {
            // unsupported request type
            return;
        }
        $params = $request->get();
        if ($this->overwrite) {
            // Overwrite existing parameters, or create new ones if not present.
            foreach ($routeMatchParams as $key => $val) {
                $params->{$key} = $val;
            }
            return;
        }
        // Only create new parameters.
        foreach ($routeMatchParams as $key => $val) {
            if (!$params->offsetExists($key)) {
                $params->{$key} = $val;
            }
        }
    }