| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | 7 | function __construct($data = NULL) |
|
|
|
|||
| 13 | { |
||
| 14 | 7 | $this->fields = array |
|
| 15 | ( |
||
| 16 | 7 | 'id' => '', |
|
| 17 | 7 | 'signal' => NULL, |
|
| 18 | 7 | 'battery' => NULL, |
|
| 19 | 7 | 'channels' => new Collection(), |
|
| 20 | ); |
||
| 21 | |||
| 22 | 7 | if(!empty($data)) |
|
| 23 | 7 | { |
|
| 24 | 6 | parent::__construct(array('id' => $data['id'])); |
|
| 25 | |||
| 26 | 6 | if(is_array($data)) |
|
| 27 | 6 | { |
|
| 28 | 6 | $this->loadFromArray($data); |
|
| 29 | 6 | } |
|
| 30 | 6 | } |
|
| 31 | 7 | } |
|
| 32 | |||
| 71 | } |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.