| Conditions | 12 | 
| Paths | 27 | 
| Total Lines | 56 | 
| Code Lines | 33 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 3 | ||
| 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  | 
            ||
| 41 | public function getConfig(array $allMetadata)  | 
            ||
| 42 |     { | 
            ||
| 43 | $config = [];  | 
            ||
| 44 | |||
| 45 |         foreach ($allMetadata as $metadata) { | 
            ||
| 46 | $reflClass = new \ReflectionClass($metadata->name);  | 
            ||
| 47 | $classAnnotation = $this->annotationReader->getClassAnnotation($reflClass, AnonymizerTable::class);  | 
            ||
| 48 |             if (!$classAnnotation instanceof AnonymizerTable) { | 
            ||
| 49 | continue;  | 
            ||
| 50 | }  | 
            ||
| 51 | |||
| 52 | $tableName = $metadata->table['name'];  | 
            ||
| 53 | |||
| 54 | $config[$tableName] = [  | 
            ||
| 55 | 'primary_key' => $metadata->identifier,  | 
            ||
| 56 | 'fields' => [],  | 
            ||
| 57 | ];  | 
            ||
| 58 | |||
| 59 | 	    if ($classAnnotation->truncate) { | 
            ||
| 60 | $config[$tableName]['truncate'] = true;  | 
            ||
| 61 | continue;  | 
            ||
| 62 | }  | 
            ||
| 63 | |||
| 64 |             foreach ($metadata->fieldMappings as $fieldName => $fieldMapping) { | 
            ||
| 65 |                 if (in_array($fieldName, $metadata->identifier)) { | 
            ||
| 66 | continue;  | 
            ||
| 67 | }  | 
            ||
| 68 | |||
| 69 | $reflProperty = $reflClass->getProperty($fieldName);  | 
            ||
| 70 | |||
| 71 | $fieldAnnotation = $this->annotationReader->getPropertyAnnotation($reflProperty, AnonymizerField::class);  | 
            ||
| 72 | $fieldConfig = null;  | 
            ||
| 73 |                 if ($fieldAnnotation instanceof AnonymizerField) { | 
            ||
| 74 | $fieldConfig = $fieldAnnotation->getConfig();  | 
            ||
| 75 |                 } elseif ($classAnnotation->guess) { | 
            ||
| 76 |                     try { | 
            ||
| 77 | $fieldConfig = $this->configGuesser::guessColumn($fieldName)->getConfigArray();  | 
            ||
| 78 |                     } catch (GuesserMissingHintException $e) { | 
            ||
| 79 |                         try { | 
            ||
| 80 | $fieldConfig = $this->configGuesser::guessColumn($fieldMapping['columnName'])->getConfigArray();  | 
            ||
| 81 |                         } catch (GuesserMissingHintException $e) { | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 82 | }  | 
            ||
| 83 | }  | 
            ||
| 84 | }  | 
            ||
| 85 | |||
| 86 |                 if ($fieldConfig) { | 
            ||
| 87 | $config[$tableName]['fields'][$fieldMapping['columnName']] = $fieldConfig;  | 
            ||
| 88 | }  | 
            ||
| 89 | }  | 
            ||
| 90 | |||
| 91 |             if (empty($config[$tableName]['fields'])) { | 
            ||
| 92 | unset($config[$tableName]);  | 
            ||
| 93 | }  | 
            ||
| 94 | }  | 
            ||
| 95 | |||
| 96 | return ['tables' => $config];  | 
            ||
| 97 | }  | 
            ||
| 99 |