Conditions | 8 |
Paths | 128 |
Total Lines | 13 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
44 | public function __construct(array $label, MusicBrainz $brainz) |
||
45 | { |
||
46 | $this->data = $label; |
||
47 | $this->brainz = $brainz; |
||
|
|||
48 | |||
49 | $this->id = isset($label['id']) ? (string)$label['id'] : ''; |
||
50 | $this->type = isset($label['type']) ? (string)$label['type'] : ''; |
||
51 | $this->score = isset($label['score']) ? (int)$label['score'] : 0; |
||
52 | $this->sortName = isset($label['sort-name']) ? (string)$label['sort-name'] : ''; |
||
53 | $this->name = isset($label['name']) ? (string)$label['name'] : ''; |
||
54 | $this->country = isset($label['country']) ? (string)$label['country'] : ''; |
||
55 | $this->aliases = isset($label['aliases']) ? $label['aliases'] : array(); |
||
56 | } |
||
57 | } |
||
58 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: