1 | <?php |
||
4 | class Point |
||
5 | { |
||
6 | protected $id, |
||
|
|||
7 | $x, |
||
8 | $y, |
||
9 | $label = null; |
||
10 | |||
11 | public function __construct($id, $label = null) |
||
20 | |||
21 | public static function create($id, $label = null) |
||
25 | |||
26 | public static function check($point) |
||
30 | |||
31 | public static function checkOrFail($point) |
||
39 | |||
40 | public function __get($name) |
||
44 | |||
45 | public function __set($name, $value) |
||
59 | |||
60 | public function toArray() |
||
74 | |||
75 | public function addConnection(Point $point, $distance) |
||
83 | } |
||
84 |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.