| 1 | <?php | ||
| 5 | class Company | ||
| 6 | { | ||
| 7 | |||
| 8 | /** | ||
| 9 | * @var Client | ||
| 10 | */ | ||
| 11 | private $client; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * @var int | ||
| 15 | */ | ||
| 16 | private $id; | ||
| 17 | |||
| 18 | /** | ||
| 19 | * @var string | ||
| 20 | */ | ||
| 21 | private $name = null; | ||
| 22 | |||
| 23 | /** | ||
| 24 | * @param Client $client | ||
| 25 | * @param int $id | ||
| 26 | */ | ||
| 27 | 12 | function __construct($client = null, $id = null) | |
|  | |||
| 28 |     { | ||
| 29 | 12 | $this->client = $client; | |
| 30 | 12 | $this->id = $id; | |
| 31 | 12 | } | |
| 32 | |||
| 33 | /** | ||
| 34 | * @param string $name | ||
| 35 | */ | ||
| 36 | 3 | public function setName($name) | |
| 40 | |||
| 41 | /** | ||
| 42 | * Update the name of a company | ||
| 43 | * | ||
| 44 | * @param string $newName | ||
| 45 | * @return array | ||
| 46 | */ | ||
| 47 | 3 | public function updateName($newName) | |
| 53 | |||
| 54 | /** | ||
| 55 | * @return array | ||
| 56 | */ | ||
| 57 | 9 | public function toArray() | |
| 65 | |||
| 66 | } | ||
| 67 | 
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.