... | ... |
@@ -3,31 +3,26 @@ class Lochness extends Restaurant { |
3 | 3 |
|
4 | 4 |
function __construct() { |
5 | 5 |
$day = date('N'); |
6 |
- $row = 3*$day - 2; |
|
6 |
+ $row = 3*$day - 1; |
|
7 | 7 |
|
8 | 8 |
parent::__construct( |
9 | 9 |
"Lochness", |
10 | 10 |
"http://www.lochnesspub.sk/category/obedove-menu/", |
11 |
- ["Polievka aj zradlo" => "/html/body/div[3]/div/div/div[1]/table/tbody/tr[$row]"] |
|
11 |
+ ['Polievka aj zradlo' => "/html/body/div[3]/div/div/div[1]/table/tbody/tr[$row]/td[2]/text()"] |
|
12 | 12 |
); |
13 | 13 |
} |
14 | 14 |
|
15 |
+ /** |
|
16 |
+ * @param DOMNodeList $parentNode |
|
17 |
+ * @param iOutput $logger |
|
18 |
+ * @return bool |
|
19 |
+ */ |
|
15 | 20 |
public function runCallbackParser($parentNode, iOutput $logger) { |
16 |
- $nodes = $parentNode->item(0)->childNodes; |
|
17 |
- if ($nodes->item(2) === NULL) |
|
18 |
- { |
|
19 |
- return ''; |
|
20 |
- } |
|
21 | 21 |
|
22 |
- /** @var $meals DOMNode */ |
|
23 |
- $meals = $nodes->item(2); |
|
24 |
- $i = 1; |
|
25 |
- foreach ($meals->childNodes as $elem) |
|
22 |
+ foreach ($parentNode as $node) |
|
26 | 23 |
{ |
27 |
- $i++; |
|
28 |
- if ($i % 2) continue; |
|
29 |
- |
|
30 |
- $logger->addMeal(trim($elem->nodeValue)); |
|
24 |
+ /** @var $node DOMNode */ |
|
25 |
+ $logger->addMeal(trim($node->nodeValue)); |
|
31 | 26 |
} |
32 | 27 |
|
33 | 28 |
return TRUE; |