dzikismigol /
barenote-cli
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | namespace BarenoteCli\Command; |
||
| 3 | |||
| 4 | use BarenoteCli\BarenoteApplication; |
||
| 5 | use Symfony\Component\Console\Command\Command; |
||
| 6 | use Symfony\Component\Console\Helper\QuestionHelper; |
||
| 7 | use Symfony\Component\Console\Input\ArrayInput; |
||
| 8 | use Symfony\Component\Console\Input\InputInterface; |
||
| 9 | use Symfony\Component\Console\Output\OutputInterface; |
||
| 10 | use Symfony\Component\Console\Question\Question; |
||
| 11 | |||
| 12 | /** |
||
| 13 | * Class LoginCommand |
||
| 14 | * @package BarenoteCli\Command |
||
| 15 | * @method BarenoteApplication getApplication() |
||
| 16 | */ |
||
| 17 | class Login extends Command |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * @throws \Symfony\Component\Console\Exception\InvalidArgumentException |
||
| 21 | */ |
||
| 22 | protected function configure() |
||
| 23 | { |
||
| 24 | $this |
||
| 25 | ->setName('barenote:login') |
||
| 26 | ->setDescription('Fetches token from the API.') |
||
| 27 | ->setHelp('This command allows you to authenticate against API...') |
||
| 28 | ->setHidden(true); |
||
| 29 | } |
||
| 30 | |||
| 31 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 32 | { |
||
| 33 | $client = $this->getApplication()->getClient(); |
||
| 34 | /** @var QuestionHelper $helper */ |
||
| 35 | $helper = $this->getHelper('question'); |
||
| 36 | |||
| 37 | $question = new Question('Please enter your username' . PHP_EOL, 'dummy'); |
||
| 38 | $question->setAutocompleterValues(['dummy']); |
||
| 39 | $username = $helper->ask($input, $output, $question); |
||
| 40 | |||
| 41 | $question = new Question('Please enter your password, I promise I won\'t do enything malicious' . PHP_EOL, 'account'); |
||
| 42 | $question->setAutocompleterValues(['account']); |
||
| 43 | $password = $helper->ask($input, $output, $question); |
||
| 44 | |||
| 45 | $client->authenticate($username, $password); |
||
| 46 | |||
| 47 | $menu = $this->getApplication()->find('barenote:postauth:menu')->run(new ArrayInput([]), $output); |
||
|
0 ignored issues
–
show
|
|||
| 48 | } |
||
| 49 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.