/** * Returns the name * @param NodeElement $slide * @return string */ public function getNameProperty(NodeElement $slide) { $selectors = Helper::getRequiredSelectors($this, ['slideImage', 'slideLink', 'slideName']); $nameElement = $slide->find('css', $selectors['slideName']); $names = ['imageAlt' => $slide->find('css', $selectors['slideImage'])->getAttribute('alt'), 'linkTitle' => $slide->find('css', $selectors['slideLink'])->getAttribute('title'), 'name' => $nameElement->getText(), 'nameTitle' => $nameElement->getAttribute('title')]; return Helper::getUnique($names); }
/** * Returns the order positions * @param string[] $locators * @return array[] */ public function getPositions($locators = ['product', 'currentPrice', 'quantity', 'price', 'sum']) { $selectors = Helper::getRequiredSelectors($this, $locators); $elements = Helper::findAllOfElements($this, ['positions']); $positions = []; /** @var NodeElement $position */ foreach ($elements['positions'] as $position) { $positions[] = $this->getOrderPositionData($position, $selectors); } return $positions; }
/** * Returns the link to the blog article * @param NodeElement $article * @return string */ public function getLinkProperty(NodeElement $article) { $selectors = Helper::getRequiredSelectors($this, ['articleTitle', 'articleLink']); $links = ['titleLink' => $article->find('css', $selectors['articleTitle'])->getAttribute('href'), 'link' => $article->find('css', $selectors['articleLink'])->getAttribute('href')]; return Helper::getUnique($links); }