| Conditions | 11 |
| Paths | 64 |
| Total Lines | 50 |
| Code Lines | 26 |
| 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 |
||
| 27 | public static function convert(\PhpGedcom\Record\Fam\Slgs &$slgs, $level) |
||
| 28 | { |
||
| 29 | $output = ""; |
||
| 30 | $output.=$level." SLGS \n"; |
||
| 31 | |||
| 32 | // Level up |
||
| 33 | $level++; |
||
| 34 | |||
| 35 | // $STAT; |
||
| 36 | $stat = $slgs->getStat(); |
||
|
|
|||
| 37 | if(!empty($stat)){ |
||
| 38 | $output.=$level." STAT ".$stat."\n"; |
||
| 39 | } |
||
| 40 | |||
| 41 | // $date; |
||
| 42 | $date = $slgs->getDate(); |
||
| 43 | if(!empty($date)){ |
||
| 44 | $output.=$level." DATE ".$date."\n"; |
||
| 45 | } |
||
| 46 | |||
| 47 | // PLAC |
||
| 48 | $plac = $slgs->getPlac(); |
||
| 49 | if(!empty($plac)){ |
||
| 50 | $output.=$level." PLAC ".$plac."\n"; |
||
| 51 | } |
||
| 52 | |||
| 53 | // $TEMP; |
||
| 54 | $temp = $slgs->getTemp(); |
||
| 55 | if(!empty($temp)){ |
||
| 56 | $output.=$level." TEMP ".$temp."\n"; |
||
| 57 | } |
||
| 58 | |||
| 59 | // $sour = array(); |
||
| 60 | $sour = $slgs->getSour(); |
||
| 61 | if(!empty($sour) && count($sour) > 0){ |
||
| 62 | foreach($sour as $item){ |
||
| 63 | $_convert = \PhpGedcom\Writer\SourRef::convert($item, $level); |
||
| 64 | $output.=$_convert; |
||
| 65 | } |
||
| 66 | } |
||
| 67 | // $note = array(); |
||
| 68 | $note = $slgs->getNote(); |
||
| 69 | if(!empty($note) && count($note) > 0){ |
||
| 70 | foreach($note as $item){ |
||
| 71 | $_convert = \PhpGedcom\Writer\NoteRef::convert($item, $level); |
||
| 72 | $output.=$_convert; |
||
| 73 | } |
||
| 74 | } |
||
| 75 | |||
| 76 | return $output; |
||
| 77 | } |
||
| 79 |