reflector = $reflector; $this->session = $session; } /** * @param Controller $controller * @param string $methodName */ public function beforeController($controller, $methodName) { if ($this->reflector->hasAnnotationOrAttribute('UseSession', UseSession::class)) { $this->session->reopen(); } } /** * @param Controller $controller * @param string $methodName * @param Response $response * @return Response */ public function afterController($controller, $methodName, Response $response) { if ($this->reflector->hasAnnotationOrAttribute('UseSession', UseSession::class)) { $this->session->close(); } return $response; } }