Пример #1
0
 /**
  * @param  string $path
  * @param  string $type
  * @param  string $array When true means it expects more than one node occurence
  * @return mixed
  */
 protected function _query($path, $type, $array = false)
 {
     // find values
     $values = array();
     $nodes = $this->_xPath->query($path, $this->_dom);
     foreach ($nodes as $node) {
         $value = (string) $node->nodeValue;
         $values[] = Zend_Service_Ebay_Abstract::toPhpValue($value, $type);
         if (!$array) {
             break;
         }
     }
     // array
     if ($array) {
         return $values;
     }
     // single value
     if (count($values)) {
         return reset($values);
     }
     // no nodes fount
     return null;
 }
Пример #2
0
 public function testToPhpValueInvalidType()
 {
     $this->setExpectedException('Zend_Service_Ebay_Exception');
     Zend_Service_Ebay_Abstract::toPhpValue('value', 'invalid-type');
 }