Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
39 | public function getData($siteToCrawl) |
||
40 | { |
||
41 | $crawler = $this->client->request('GET', $siteToCrawl); |
||
42 | |||
43 | $arr = $crawler->filter('.title a[href^="http"], a[href^="https"]')->each(function($element) { |
||
44 | $links = []; |
||
45 | |||
46 | array_push($links, $element->text()); |
||
47 | |||
48 | return $links; |
||
49 | }); |
||
50 | |||
51 | return $arr; |
||
52 | } |
||
53 | } |
||
54 |
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: