1 | <?php |
||
14 | class SearchResultAdCrawler extends CrawlerAbstract |
||
15 | { |
||
16 | /** |
||
17 | * @var AdUrlParser |
||
18 | */ |
||
19 | protected $url; |
||
20 | |||
21 | /** |
||
22 | * @param $url |
||
23 | * @return SearchResultUrlParser |
||
24 | */ |
||
25 | 14 | protected function setUrlParser($url) |
|
29 | |||
30 | /** |
||
31 | * Return the Ad's ID |
||
32 | * |
||
33 | * @return string |
||
34 | */ |
||
35 | 10 | public function getId() |
|
36 | { |
||
37 | 10 | return $this->url->getId(); |
|
38 | } |
||
39 | |||
40 | |||
41 | /** |
||
42 | * Return the title |
||
43 | * |
||
44 | * @return string |
||
45 | */ |
||
46 | 10 | public function getTitle() |
|
50 | |||
51 | /** |
||
52 | * Return the price |
||
53 | * |
||
54 | * @return int |
||
55 | */ |
||
56 | 10 | public function getPrice() |
|
57 | { |
||
58 | 10 | return $this->getFieldValue( |
|
59 | 10 | $this->node->filter('*[itemprop=price]'), |
|
60 | 10 | 0, |
|
61 | function ($value) { |
||
62 | 10 | return (new PrixSanitizer)->clean($value); |
|
63 | 10 | } |
|
64 | ); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Return the Ad's URL |
||
69 | * |
||
70 | * @return string |
||
71 | */ |
||
72 | 10 | public function getUrl() |
|
76 | |||
77 | /** |
||
78 | * Return the data and time the ad was created |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | 10 | public function getCreatedAt() |
|
89 | |||
90 | /** |
||
91 | * Return the thumb picture url |
||
92 | * |
||
93 | * @return null|string |
||
94 | */ |
||
95 | 12 | public function getThumb() |
|
110 | |||
111 | /** |
||
112 | * Return the number of picture of the ad |
||
113 | * |
||
114 | * @return int |
||
115 | */ |
||
116 | 12 | public function getNbImage() |
|
122 | |||
123 | /** |
||
124 | * @return mixed |
||
125 | */ |
||
126 | 10 | public function getPlacement() |
|
134 | |||
135 | /** |
||
136 | * @return mixed |
||
137 | */ |
||
138 | 10 | public function getIsPro() |
|
148 | |||
149 | /** |
||
150 | * @return array |
||
151 | */ |
||
152 | 10 | public function getAll() |
|
166 | } |
||
167 |