| Conditions | 4 |
| Paths | 3 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 32 | public function create() |
||
| 33 | { |
||
| 34 | $userService = $this->getUserService(); |
||
|
1 ignored issue
–
show
|
|||
| 35 | if (!$this->httpRequest->isPost()) { |
||
| 36 | throw new InvalidHttpMethodException( |
||
| 37 | 'Http method used mismatch with expected', |
||
| 38 | ['used' => $_SERVER['REQUEST_METHOD'], 'expected' => HttpRequest::POST] |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | if (!$userService->isUserLoggedIn() || |
||
| 43 | $userService->getSessionUserRole() < $userService::MODERATOR_ROLE_PRIORITY |
||
| 44 | ) { |
||
| 45 | throw new Exception(Locale::getLocale('User must be logged in and have the correct rights')); |
||
| 46 | } |
||
| 47 | |||
| 48 | $newUserStatusCommand = new CreateUserStatusCommand( |
||
| 49 | $this->httpRequest->getParameter('name'), |
||
| 50 | $this->diContainer->get("entityManager") |
||
| 51 | ); |
||
| 52 | $newUserStatusCommand->execute(); |
||
| 53 | } |
||
| 55 |