| Conditions | 12 |
| Paths | 65 |
| Total Lines | 42 |
| Code Lines | 25 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 62 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 63 | { |
||
| 64 | // Taken from SensioGeneratorBundle: class Command\Validators (see LICENSE) |
||
| 65 | if (!preg_match('{^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*:[a-zA-Z0-9_\x7f-\xff\\\/]+$}', $entity = $input->getArgument('entity_or_document'))) { |
||
| 66 | throw new \InvalidArgumentException(sprintf('The entity name isn\'t valid ("%s" given, expecting something like AcmeBlogBundle:Blog/Post)', $entity)); |
||
| 67 | } |
||
| 68 | |||
| 69 | list($bundle, $entity) = $this->parseShortcutNotation($entity); |
||
| 70 | |||
| 71 | if ($this->registry) { |
||
| 72 | $entityClass = $this->registry->getAliasNamespace($bundle).'\\'.$entity; |
||
| 73 | } |
||
| 74 | if ($this->mongodbRegistry) { |
||
| 75 | $documentClass = $this->mongodbRegistry->getAliasNamespace($bundle).'\\'.$entity; |
||
| 76 | } |
||
| 77 | |||
| 78 | if (isset($entityClass) && $this->entityManager) { |
||
| 79 | try { |
||
| 80 | $metadata = $this->entityManager->getClassMetadata($entityClass); |
||
| 81 | } catch (\Exception $exception) { |
||
| 82 | if (!preg_match('/does not exist/', $exception->getMessage())) { |
||
| 83 | throw $exception; |
||
| 84 | } |
||
| 85 | } |
||
| 86 | } |
||
| 87 | if (!isset($metadata) && $this->documentManager) { |
||
| 88 | if (!isset($documentClass)) { |
||
| 89 | throw new \Exception("Could not get metadata for $entity"); |
||
| 90 | } |
||
| 91 | $metadata = $this->documentManager->getClassMetadata($documentClass); |
||
| 92 | } |
||
| 93 | |||
| 94 | $application = $this->getApplication(); |
||
| 95 | if ($application instanceof Application) { |
||
| 96 | $bundle = $application->getKernel()->getBundle($bundle); |
||
| 97 | } else { |
||
| 98 | throw new \Exception("Can't lookup bundle for $bundle"); |
||
| 99 | } |
||
| 100 | $skeletonDir = __DIR__.'/../Resources/skeleton'; |
||
| 101 | $columnGenerator = new GridSourceGenerator($skeletonDir); |
||
| 102 | |||
| 103 | $columnGenerator->generate($bundle, $entity, $metadata, $input->getOption('columns')); |
||
| 104 | } |
||
| 117 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths