Exemplo n.º 1
0
 /**
  * Helper function returns the data of an order position
  * @param NodeElement $position
  * @param string[] $selectors
  * @return array
  */
 private function getOrderPositionData(NodeElement $position, array $selectors)
 {
     $data = [];
     foreach ($selectors as $key => $selector) {
         $element = $position->find('css', $selector);
         $data[$key] = $element->getText();
         if ($key !== 'product') {
             $data[$key] = Helper::floatValue($data[$key]);
         }
     }
     return $data;
 }
 /**
  * Returns the star rating
  * @return float
  */
 public function getStarsProperty()
 {
     $elements = Helper::findElements($this, ['stars']);
     return Helper::floatValue($elements['stars']->getAttribute('class'));
 }
Exemplo n.º 3
0
 /**
  * Helper method to read a float property
  * @param string $propertyName
  * @return float
  */
 protected function getFloatProperty($propertyName)
 {
     $element = Helper::findElements($this, [$propertyName]);
     return Helper::floatValue($element[$propertyName]->getText());
 }
 /**
  * Returns the price
  * @param NodeElement $slide
  * @return float
  */
 public function getPriceProperty(NodeElement $slide)
 {
     $selector = Helper::getRequiredSelector($this, 'slidePrice');
     $price = $slide->find('css', $selector)->getText();
     return Helper::floatValue($price);
 }
Exemplo n.º 5
0
 /**
  * Returns the price
  * @return float
  */
 public function getPriceProperty()
 {
     $price = $this->getProperty('price');
     return Helper::floatValue($price);
 }
Exemplo n.º 6
0
 /**
  * @return float
  */
 public function getPriceProperty()
 {
     $elements = Helper::findElements($this, ['price']);
     return Helper::floatValue($elements['price']->getText());
 }
Exemplo n.º 7
0
 /**
  * Returns the price
  * @param NodeElement $slide
  * @return float
  */
 public function getPriceProperty(NodeElement $slide)
 {
     $selector = Helper::getRequiredSelector($this, 'slidePrice');
     preg_match('(\\d+,\\d{2})', $slide->find('css', $selector)->getHtml(), $price);
     return Helper::floatValue(current($price));
 }