| Conditions | 5 |
| Paths | 4 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public static function read($conn, \Gedcom\Record\Chan $chan, $group = '', $group_id = 0) |
||
| 15 | { |
||
| 16 | $date = $chan->getDate(); |
||
| 17 | $time = $chan->getTime(); |
||
| 18 | |||
| 19 | // store chan |
||
| 20 | $key = ['group'=>$group, 'gid'=>$group_id, 'date'=>$date, 'time'=>$time]; |
||
| 21 | $data = ['group'=>$group, 'gid'=>$group_id, 'date'=>$date, 'time'=>$time]; |
||
| 22 | $record = MChan::on($conn)->updateOrCreate($key, $data); |
||
| 23 | |||
| 24 | // store Sources of Note |
||
| 25 | $_group = 'chan'; |
||
| 26 | $_gid = $record->id; |
||
| 27 | // SourRef array |
||
| 28 | $note = $chan->getNote(); |
||
| 29 | if ($note && count($note) > 0) { |
||
|
|
|||
| 30 | foreach ($note as $item) { |
||
| 31 | if ($item) { |
||
| 32 | NoteRef::read($conn, $item, $_group, $_gid); |
||
| 33 | } |
||
| 38 |
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.