コード例 #1
0
 /**
  * Test loading an existing IVR
  *
  * @dataProvider provideIvrFixtures
  * 
  * @param string filename
  */
 public function testLoad($filename)
 {
     $this->markTestIncomplete('IVR loading not implemented properly');
     $ivr = new Ivr();
     $ivr->load($filename);
     $result = $ivr->saveXML();
     $this->assertXmlStringEqualsXmlFile($filename, $result);
     $tagList = $ivr->getTagList();
     $xpath = new DOMXPath($ivr);
     foreach ($xpath->query('//*') as $tag) {
         if ($tagName = array_search($tag->nodeName, $tagList)) {
             $this->assertInstanceOf(Ivr\Dialplan::ns() . '\\' . $tagName, $tag);
         }
     }
 }
コード例 #2
0
ファイル: Ivr.php プロジェクト: vmalinovskiy/CallFire-PHP-SDK
 protected function transmuteTags(DOMNode $contextNode = null)
 {
     $xpath = new DOMXPath($this);
     $tagList = $this->getTagList();
     if (!$contextNode) {
         $contextNode = $this->documentElement;
     }
     if ($contextNode->hasChildNodes()) {
         foreach ($contextNode->childNodes as $tag) {
             if ($tagName = array_search($tag->nodeName, $tagList)) {
                 $tagClass = Dialplan::ns() . '\\' . $tagName;
                 $newTag = new $tagClass();
                 $contextNode->replaceChild($newTag, $tag);
                 static::transmuteTag($tag, $newTag);
                 $this->transmuteTags($newTag);
             } else {
                 $this->transmuteTags($tag);
             }
         }
     }
 }