| Conditions | 6 | 
| Paths | 24 | 
| Total Lines | 62 | 
| Code Lines | 31 | 
| 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  | 
            ||
| 78 | public function load(ObjectManager $manager)  | 
            ||
| 79 |     { | 
            ||
| 80 | /**  | 
            ||
| 81 | * Load FamilyLog  | 
            ||
| 82 | */  | 
            ||
| 83 | $familyLogs = [];  | 
            ||
| 84 |         foreach ($this->familyArray as $key => $family) { | 
            ||
| 85 | $familyLog = new FamilyLog();  | 
            ||
| 86 | $familyLog->setName($family['name']);  | 
            ||
| 87 |             if (isset($family['parent'])) { | 
            ||
| 88 | $parent = $familyLogs[$family['parent'] - 1];  | 
            ||
| 89 | $familyLog->setParent($parent);  | 
            ||
| 90 | }  | 
            ||
| 91 | $familyLogs[$key] = $familyLog;  | 
            ||
| 92 | |||
| 93 | $manager->persist($familyLog);  | 
            ||
| 94 | |||
| 95 | $order = $key + 1;  | 
            ||
| 96 |             $this->addReference('family-log'.$order, $familyLog); | 
            ||
| 97 | }  | 
            ||
| 98 | |||
| 99 | /**  | 
            ||
| 100 | * Load ZoneStorage  | 
            ||
| 101 | */  | 
            ||
| 102 |         foreach ($this->zoneArray as $key => $zone) { | 
            ||
| 103 | $zoneStorage = new ZoneStorage();  | 
            ||
| 104 | $zoneStorage->setName($zone['name']);  | 
            ||
| 105 | |||
| 106 | $manager->persist($zoneStorage);  | 
            ||
| 107 | |||
| 108 | $order = $key + 1;  | 
            ||
| 109 |             $this->addReference('zoneStorage'.$order, $zoneStorage); | 
            ||
| 110 | }  | 
            ||
| 111 | |||
| 112 | /**  | 
            ||
| 113 | * Load Unit  | 
            ||
| 114 | */  | 
            ||
| 115 |         foreach ($this->unitArray as $key => $unit) { | 
            ||
| 116 | $unitStorage = new Unit();  | 
            ||
| 117 | $unitStorage->setName($unit['name'])  | 
            ||
| 118 | ->setAbbr($unit['abbr']);  | 
            ||
| 119 | |||
| 120 | $manager->persist($unitStorage);  | 
            ||
| 121 | |||
| 122 | $order = $key + 1;  | 
            ||
| 123 |             $this->addReference('unit'.$order, $unitStorage); | 
            ||
| 124 | }  | 
            ||
| 125 | |||
| 126 | /**  | 
            ||
| 127 | * Load Tva  | 
            ||
| 128 | */  | 
            ||
| 129 |         foreach ($this->tvaArray as $key => $tvaRate) { | 
            ||
| 130 | $tva = new Tva();  | 
            ||
| 131 | $tva->setRate((double)$tvaRate['rate']);  | 
            ||
| 132 | |||
| 133 | $manager->persist($tva);  | 
            ||
| 134 | |||
| 135 | $order = $key + 1;  | 
            ||
| 136 |             $this->addReference('tva'.$order, $tva); | 
            ||
| 137 | }  | 
            ||
| 138 | |||
| 139 | $manager->flush();  | 
            ||
| 140 | }  | 
            ||
| 142 |