1 | <?php |
||
4 | final class FakeTag |
||
5 | { |
||
6 | private $id; |
||
7 | private $name; |
||
8 | private $user; |
||
9 | |||
10 | function __construct($id, $name) |
||
15 | |||
16 | public function setId($id) { $this->id = $id; return $this; } |
||
18 | |||
19 | public function setName($name) { $this->name = $name; return $this; } |
||
21 | |||
22 | public function setUser(FakeUser $user) { $this->user = $user; return $this; } |
||
24 | } |
||
25 |
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.