1 | <?php |
||
13 | class AlertSerializer |
||
14 | { |
||
15 | /** |
||
16 | * @var AlertDetailSerializer |
||
17 | */ |
||
18 | private $detail; |
||
19 | |||
20 | /** |
||
21 | * @param AlertDetailSerializer $detail |
||
22 | */ |
||
23 | 96 | public function __construct(AlertDetailSerializer $detail) |
|
28 | |||
29 | /** |
||
30 | * @param Parser $parser |
||
31 | 3 | * @return Alert |
|
32 | */ |
||
33 | 3 | public function fromParser(Parser $parser) |
|
48 | 3 | ||
49 | 3 | /** |
|
50 | * @param $data |
||
51 | 3 | * @return Alert |
|
52 | 2 | */ |
|
53 | public function parse($data) |
||
57 | |||
58 | /** |
||
59 | * @param Alert $alert |
||
60 | * @return \BitWasp\Buffertools\Buffer |
||
61 | 3 | */ |
|
62 | public function serialize(Alert $alert) |
||
66 | } |
||
67 |
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: