Beispiel #1
0
 /**
  * Convert the raw XML into an object
  *
  * @param \SimpleXMLElement $xml
  * @return Phone
  */
 public static function createFromXML(\SimpleXMLElement $xml)
 {
     $phone = new Phone();
     $attributes = $xml->attributes();
     if (isset($attributes['type'])) {
         $phone->setType((string) $attributes['type']);
     }
     $phone->setValue((string) $xml);
     return $phone;
 }
Beispiel #2
0
 /**
  * Tests Phone->setType()
  */
 public function testSetType()
 {
     $this->Phone->setType('TYPE');
     $this->assertEquals('TYPE', $this->Phone->type);
 }