public function setOption($value, RequestParams $allParams) { $this->groupName = $this->groupName . basename($allParams->getRequest()->getUri()->getPath()); $arParams = ['value' => $value, 'codeName' => $this->variableName, 'groupName' => $this->groupName]; $event = new BaseContainerEvent($this->c, $arParams); $event = $this->c->dispatcher->dispatch('middleware.lastpagepaginator.before', $event); $value = $event->getParams()['value'] ? $event->getParams()['value'] : $allParams->all($this->variableName); $result = $this->storeParams($value); $arParams = ['result' => $result, 'allParams' => $allParams]; $event = new BaseContainerEvent($this->c, $arParams); $this->c->dispatcher->dispatch('middleware.lastpagepaginator.after', $event); }
public function __invoke(Request $request, Response $response, $next) { $this->req = $request; $this->res = $response; $allParams = new RequestParams($this->req); if (Session::has('auth') && Session::get('auth') && ($allParams->all($this->variableName[0]) || $allParams->all($this->variableName[1]))) { $this->groupName = $this->groupName . basename($allParams->getRequest()->getUri()->getPath()); $varName = $this->variableName[0]; if ($allParams->all($varName)) { $this->setOption($varName, $allParams); } $varName = $this->variableName[1]; if ($allParams->all($varName)) { $this->setOption($varName, $allParams); } } return $next($request, $response); }