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