| 1 | <?php |
||
| 7 | class ResolveDataArgs |
||
| 8 | { |
||
| 9 | public $data; |
||
| 10 | private $template; |
||
| 11 | |||
| 12 | public function __construct(array $data, Template $template) { |
||
| 16 | |||
| 17 | public function withData(array $data) { |
||
| 20 | |||
| 21 | public function withAddedData(array $data) { |
||
| 24 | |||
| 25 | public static function fromTemplate(Template $template) { |
||
| 28 | |||
| 29 | public function getTemplate() { |
||
| 32 | |||
| 33 | public function getContext() { |
||
| 36 | } |
||
| 37 |
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: