| Conditions | 9 |
| Paths | 16 |
| Total Lines | 39 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public static function convert(\Gedcom\Record\Indi\Even\Plac &$plac, $level = 0) |
||
| 25 | { |
||
| 26 | $output = ''; |
||
| 27 | |||
| 28 | // $plac |
||
| 29 | $_plac = $plac->getPlac(); |
||
| 30 | if (!empty($_plac)) { |
||
| 31 | $output .= $level.' PLAC '.$_plac."\n"; |
||
| 32 | } else { |
||
| 33 | $output .= $level." PLAC\n"; |
||
| 34 | } |
||
| 35 | |||
| 36 | // level up |
||
| 37 | $level++; |
||
| 38 | |||
| 39 | // $form |
||
| 40 | $form = $plac->getForm(); |
||
| 41 | if (!empty($form)) { |
||
| 42 | $output .= $level.' FORM '.$form."\n"; |
||
| 43 | } |
||
| 44 | |||
| 45 | // $note -array |
||
| 46 | $note = $plac->getNote(); |
||
| 47 | if ($note && count($note) > 0) { |
||
|
|
|||
| 48 | foreach ($note as $item) { |
||
| 49 | $_convert = \Gedcom\Writer\NoteRef::convert($item, $level); |
||
| 50 | $output .= $_convert; |
||
| 51 | } |
||
| 52 | } |
||
| 53 | // $sour -array |
||
| 54 | $sour = $plac->getSour(); |
||
| 55 | if ($sour && count($sour) > 0) { |
||
| 56 | foreach ($sour as $item) { |
||
| 57 | $_convert = \Gedcom\Writer\SourRef::convert($item, $level); |
||
| 58 | $output .= $_convert; |
||
| 59 | } |
||
| 60 | } |
||
| 61 | |||
| 62 | return $output; |
||
| 63 | } |
||
| 65 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.