| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 21 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 22 | { |
||
| 23 | parent::execute($input, $output); |
||
| 24 | $this->io->title('Promote a new OBBLM Administrator'); |
||
| 25 | $this->io->caution('Be carefull, this new user will have the highest right on the application'); |
||
| 26 | if($this->confirmContinue()) { |
||
| 27 | $coach = $this->getCoachByLoginOrEmail(); |
||
| 28 | $continue = $this->io->confirm("Are you sure you want to promote {$coach->getUsername()} ?", true); |
||
| 29 | if($continue) { |
||
| 30 | $coach |
||
| 31 | ->setRoles([Roles::ADMIN]); |
||
| 32 | $this->saveCoach($coach); |
||
| 33 | $this->io->success("The coach {$coach->getUsername()} has been promoted !"); |
||
| 34 | return 1; |
||
| 35 | } |
||
| 36 | } |
||
| 37 | $this->io->text('Aborted.'); |
||
| 38 | return 0; |
||
| 39 | } |
||
| 41 |