getAccessChecker()->canManageUsers()) { throw new Forbidden(); } $user = $this->getUserRepository()->get($id); $user->delete(); $this->response->redirect('/users'); } private function getUserRepository(): UserRepository { return new UserRepository(); } private function getAccessChecker(): AccessChecker { return new AccessChecker(); } }