示例#1
0
 /**
  * Sets attributes from response xml.
  *
  * @param ResponseInterface $response
  * @param array $attributes
  */
 public function __construct(ResponseInterface $response, array $attributes = null)
 {
     $this->response = $response;
     if (is_null($attributes)) {
         $attributes = Xml::elementsToArray($response->xml()->xpath('/RESPONSE/FIELDS/*'));
     }
     parent::__construct($attributes);
 }
示例#2
0
 /** @test */
 public function key_attribute_should_override_element_name()
 {
     $elements = [new SimpleXMLElement('<field KEY="bar"></field>')];
     $this->assertArrayHasKey('bar', Xml::elementsToArray($elements));
 }