Completed
Push — master ( bfe5d7...c95e3e )
by Paweł
15s
created

CreateUserCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 16
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 2
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher Core Bundle.
5
 *
6
 * Copyright 2018 Sourcefabric z.ú. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2018 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Bundle\CoreBundle\Command;
16
17
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
18
use FOS\UserBundle\Command\CreateUserCommand as BaseCreateUserCommand;
19
use Symfony\Component\Console\Input\InputInterface;
20
use Symfony\Component\Console\Output\OutputInterface;
21
22
class CreateUserCommand extends BaseCreateUserCommand
23
{
24
    protected static $defaultName = 'fos:user:create';
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    protected function execute(InputInterface $input, OutputInterface $output)
30
    {
31
        try {
32
            parent::execute($input, $output);
33
        } catch (UniqueConstraintViolationException $e) {
34
            $output->writeln(sprintf('<error>User with username %s already exists!</error>', $input->getArgument('username')));
35
        }
36
    }
37
}
38