/** * @return $this */ public function fetchData() { if (!empty($this->dataConfig)) { foreach ($this->dataConfig as $key => $value) { switch (1) { case is_array($value) && strtolower(key($value)) == 'css': // css $value = CssSelector::toXpath(current($value)); case is_string($value): // xpath $xpath = $this->getPage()->getXpath(); $this->data[$key] = $this->xpathResult($xpath, $value); break; case is_callable($value): // calback funtion $this->data[$key] = call_user_func($value, $this->getPage()); break; } } } return $this; }