| Conditions | 13 | 
| Paths | 17 | 
| Total Lines | 57 | 
| Code Lines | 33 | 
| 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  | 
            ||
| 14 | public static function read($conn, \Gedcom\Record\Obje $obje, $group = '', $group_id = 0)  | 
            ||
| 15 |     { | 
            ||
| 16 |         if ($obje == null) { | 
            ||
| 17 | return 0;  | 
            ||
| 18 | }  | 
            ||
| 19 | |||
| 20 | $id = $obje->getId();  | 
            ||
| 21 | $rin = $obje->getRin(); // string  | 
            ||
| 22 | |||
| 23 | // store Object  | 
            ||
| 24 | $key = [  | 
            ||
| 25 | 'group' => $group,  | 
            ||
| 26 | 'gid' => $group_id,  | 
            ||
| 27 | 'rin' => $rin,  | 
            ||
| 28 | 'obje_id' => $id,  | 
            ||
| 29 | ];  | 
            ||
| 30 | $data = [  | 
            ||
| 31 | 'group' => $group,  | 
            ||
| 32 | 'gid' => $group_id,  | 
            ||
| 33 | 'rin' => $rin,  | 
            ||
| 34 | 'obje_id' => $id,  | 
            ||
| 35 | ];  | 
            ||
| 36 | |||
| 37 | $record = MediaObject::on($conn)->updateOrCreate($key, $data);  | 
            ||
| 38 | |||
| 39 | $_group = 'obje';  | 
            ||
| 40 | $_gid = $record->id;  | 
            ||
| 41 | |||
| 42 | $refn = $obje->getRefn(); // Record/Refn array  | 
            ||
| 43 |         if ($refn && count($refn) > 0) { | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 44 |             foreach ($refn as $item) { | 
            ||
| 45 | Refn::read($conn, $item, $_group, $_gid);  | 
            ||
| 46 | }  | 
            ||
| 47 | }  | 
            ||
| 48 | |||
| 49 | // store Note  | 
            ||
| 50 | $note = $obje->getNote(); // Record/NoteRef array  | 
            ||
| 51 |         if ($note && count($note) > 0) { | 
            ||
| 52 |             foreach ($note as $item) { | 
            ||
| 53 | NoteRef::read($conn, $item, $_group, $_gid);  | 
            ||
| 54 | }  | 
            ||
| 55 | }  | 
            ||
| 56 | |||
| 57 | // store Note  | 
            ||
| 58 | $files = $obje->getFile(); // Record/NoteRef array  | 
            ||
| 59 |         if (($files && count((is_countable($files) ? $files : [])))) { | 
            ||
| 60 |             foreach ($files as $item) { | 
            ||
| 61 | \FamilyTree365\LaravelGedcom\Utils\Importer\ObjeRef\File::read($conn, $item, $_group, $_gid);  | 
            ||
| 62 | }  | 
            ||
| 63 | }  | 
            ||
| 64 | |||
| 65 | $chan = $obje->getChan(); // Recore/Chan  | 
            ||
| 66 |         if ($chan !== null) { | 
            ||
| 67 | \FamilyTree365\LaravelGedcom\Utils\Importer\Chan::read($conn, $chan, $_group, $_gid);  | 
            ||
| 68 | }  | 
            ||
| 69 | |||
| 70 | return $_gid;  | 
            ||
| 71 | }  | 
            ||
| 73 |