Conditions | 3 |
Paths | 2 |
Total Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
17 | public function links($controller = null, $parameters = null): LinkResource |
||
18 | { |
||
19 | $resource = LinkResource::create($this->resource, LinkResourceType::ITEM)->link($controller, $parameters); |
||
|
|||
20 | |||
21 | if (property_exists($this, 'withCollectionLinks') && $this->withCollectionLinks) { |
||
22 | $resource->withCollectionLinks(); |
||
23 | } |
||
24 | |||
25 | return $resource; |
||
26 | } |
||
27 | |||
46 |
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: