| Conditions | 10 |
| Paths | 24 |
| Total Lines | 62 |
| Code Lines | 34 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 142 | public function convertDoctrine1Schema(array $fromPaths, $destPath, $toType, $numSpaces, $extend, OutputInterface $output) |
||
| 143 | { |
||
| 144 | foreach ($fromPaths as &$dirName) { |
||
| 145 | $dirName = realpath($dirName); |
||
| 146 | |||
| 147 | if ( ! file_exists($dirName)) { |
||
| 148 | throw new \InvalidArgumentException( |
||
| 149 | sprintf("Doctrine 1.X schema directory '<info>%s</info>' does not exist.", $dirName) |
||
| 150 | ); |
||
| 151 | } |
||
| 152 | |||
| 153 | if ( ! is_readable($dirName)) { |
||
| 154 | throw new \InvalidArgumentException( |
||
| 155 | sprintf("Doctrine 1.X schema directory '<info>%s</info>' does not have read permissions.", $dirName) |
||
| 156 | ); |
||
| 157 | } |
||
| 158 | } |
||
| 159 | |||
| 160 | if ( ! file_exists($destPath)) { |
||
| 161 | throw new \InvalidArgumentException( |
||
| 162 | sprintf("Doctrine 2.X mapping destination directory '<info>%s</info>' does not exist.", $destPath) |
||
| 163 | ); |
||
| 164 | } |
||
| 165 | |||
| 166 | if ( ! is_writable($destPath)) { |
||
| 167 | throw new \InvalidArgumentException( |
||
| 168 | sprintf("Doctrine 2.X mapping destination directory '<info>%s</info>' does not have write permissions.", $destPath) |
||
| 169 | ); |
||
| 170 | } |
||
| 171 | |||
| 172 | $cme = $this->getMetadataExporter(); |
||
| 173 | $exporter = $cme->getExporter($toType, $destPath); |
||
| 174 | |||
| 175 | if (strtolower($toType) === 'annotation') { |
||
| 176 | $entityGenerator = $this->getEntityGenerator(); |
||
| 177 | $exporter->setEntityGenerator($entityGenerator); |
||
| 178 | |||
| 179 | $entityGenerator->setNumSpaces($numSpaces); |
||
| 180 | |||
| 181 | if ($extend !== null) { |
||
| 182 | $entityGenerator->setClassToExtend($extend); |
||
| 183 | } |
||
| 184 | } |
||
| 185 | |||
| 186 | $converter = new ConvertDoctrine1Schema($fromPaths); |
||
| 187 | $metadata = $converter->getMetadata(); |
||
| 188 | |||
| 189 | if ($metadata) { |
||
| 190 | $output->writeln(''); |
||
| 191 | |||
| 192 | foreach ($metadata as $class) { |
||
| 193 | $output->writeln(sprintf('Processing entity "<info>%s</info>"', $class->name)); |
||
| 194 | } |
||
| 195 | |||
| 196 | $exporter->setMetadata($metadata); |
||
| 197 | $exporter->export(); |
||
| 198 | |||
| 199 | $output->writeln(PHP_EOL . sprintf( |
||
| 200 | 'Converting Doctrine 1.X schema to "<info>%s</info>" mapping type in "<info>%s</info>"', $toType, $destPath |
||
| 201 | )); |
||
| 202 | } else { |
||
| 203 | $output->writeln('No Metadata Classes to process.'); |
||
| 204 | } |
||
| 207 |
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