| @@ 123-128 (lines=6) @@ | ||
| 120 | $object->assignProperties($properties, $this->debug); |
|
| 121 | ||
| 122 | // Fallback for url |
|
| 123 | if ($this->useFallbackMode && !$object->url) { |
|
| 124 | $urlElement = $crawler->filter("link[rel='canonical']")->first(); |
|
| 125 | if ($urlElement->count()) { |
|
| 126 | $object->url = trim($urlElement->attr("href")); |
|
| 127 | } |
|
| 128 | } |
|
| 129 | ||
| 130 | // Fallback for title |
|
| 131 | if ($this->useFallbackMode && !$object->title) { |
|
| @@ 131-136 (lines=6) @@ | ||
| 128 | } |
|
| 129 | ||
| 130 | // Fallback for title |
|
| 131 | if ($this->useFallbackMode && !$object->title) { |
|
| 132 | $titleElement = $crawler->filter("title")->first(); |
|
| 133 | if ($titleElement) { |
|
| 134 | $object->title = trim($titleElement->text()); |
|
| 135 | } |
|
| 136 | } |
|
| 137 | ||
| 138 | // Fallback for description |
|
| 139 | if ($this->useFallbackMode && !$object->description) { |
|
| @@ 139-144 (lines=6) @@ | ||
| 136 | } |
|
| 137 | ||
| 138 | // Fallback for description |
|
| 139 | if ($this->useFallbackMode && !$object->description) { |
|
| 140 | $descriptionElement = $crawler->filter("meta[property='description']")->first(); |
|
| 141 | if ($descriptionElement) { |
|
| 142 | $object->description = trim($descriptionElement->attr("content")); |
|
| 143 | } |
|
| 144 | } |
|
| 145 | ||
| 146 | return $object; |
|
| 147 | } |
|