1 | <?php |
||
9 | class StringBased implements Contents |
||
10 | { |
||
11 | /** |
||
12 | * Contents of the file |
||
13 | * |
||
14 | * @var string |
||
15 | **/ |
||
16 | private $contents; |
||
17 | |||
18 | /** |
||
19 | * Constructor |
||
20 | * |
||
21 | * @param string $contents |
||
22 | * @return void |
||
|
|||
23 | **/ |
||
24 | public function __construct($contents) |
||
28 | |||
29 | /** |
||
30 | * Get the contents of the file |
||
31 | * |
||
32 | * @return string |
||
33 | */ |
||
34 | public function getContents() |
||
38 | |||
39 | /** |
||
40 | * Set the contents of the file |
||
41 | * |
||
42 | * @param ContentGenerator|string $contents |
||
43 | * @return self |
||
44 | */ |
||
45 | public function setContents($contents) |
||
51 | } |
||
52 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.