| Conditions | 4 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 34 | { |
||
| 35 | $jsonDb = $this->databaseService->getProjects(); |
||
| 36 | if (is_null($jsonDb) || count($jsonDb) == 0) { |
||
| 37 | $output->writeln(''); |
||
| 38 | $output->writeln('<info>'.ShowProjectsCommandText::OK_0_PROJECTS.'</info>'); |
||
| 39 | } else { |
||
| 40 | $tableData = []; |
||
| 41 | foreach ($jsonDb as $k =>$v) { |
||
|
|
|||
| 42 | $tableData[] = [$k,$v]; |
||
| 43 | } |
||
| 44 | |||
| 45 | $table = new Table($output); |
||
| 46 | $table |
||
| 47 | ->setHeaders(array('Name', 'Path')) |
||
| 48 | ->setRows($tableData) |
||
| 49 | ; |
||
| 50 | $table->render(); |
||
| 51 | } |
||
| 52 | } |
||
| 53 | } |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.