| Conditions | 3 | 
| Paths | 4 | 
| Total Lines | 25 | 
| Code Lines | 14 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 18 | public function perform( | ||
| 19 | TokenizerListenerRegistryInterface $registry, | ||
| 20 | DirectoriesInterface $dirs, | ||
| 21 | ReaderInterface $reader | ||
| 22 |     ): int { | ||
| 23 | $listeners = \method_exists($registry, 'getListenerClasses') ? $registry->getListenerClasses() : []; | ||
| 24 | |||
| 25 | $grid = $this->table(['Listener', 'Suggestion']); | ||
| 26 |         foreach ($listeners as $class) { | ||
| 27 | $ref = new \ReflectionClass($class); | ||
| 28 | $attribute = $reader->firstClassMetadata($ref, AbstractTarget::class); | ||
| 29 |             $suggestion = match (true) { | ||
| 30 | $attribute === null => 'Add <comment>#[TargetClass]</comment> or ' . | ||
| 31 | '<comment>#[TargetAttribute]</comment> attribute to the listener', | ||
| 32 | default => '<fg=green> ✓ </>', | ||
| 33 | }; | ||
| 34 | $grid->addRow([ | ||
| 35 |                 $class . "\n" . \sprintf('<fg=gray>%s</>', \str_replace($dirs->get('root'), '', $ref->getFileName())), | ||
| 36 | $suggestion, | ||
| 37 | ]); | ||
| 38 | } | ||
| 39 | |||
| 40 | $grid->render(); | ||
| 41 | |||
| 42 | return self::SUCCESS; | ||
| 43 | } | ||
| 45 |