示例#1
0
 /**
  * Function processes attributes and changes them to new syntax.
  *
  * @internal
  * @param Opt_Compiler_Class $compiler Compiler class
  */
 private function _processMigration(Opt_Compiler_Class $compiler)
 {
     if (!$this->hasAttributes()) {
         return array();
     }
     foreach ($this->getAttributes() as $attr) {
         if ($compiler->isNamespace($attr->getNamespace())) {
             switch ($attr->getNamespace()) {
                 case 'parse':
                     $this->removeAttribute($attr->getXmlName());
                     $attr->setValue('parse:' . $attr->getValue());
                     $attr->setNamespace(null);
                     $this->addAttribute($attr);
                     break;
                 case 'str':
                     $this->removeAttribute($attr->getXmlName());
                     $attr->setValue('str:' . $attr->getValue());
                     $attr->setNamespace(null);
                     $this->addAttribute($attr);
                     break;
                 case 'opt':
                     if (($processor = $compiler->getAttribute($attr->getXmlName())) !== null && $processor->attributeNeedMigration($attr)) {
                         $this->removeAttribute($attr->getXmlName());
                         $attr = $processor->migrateAttribute($attr);
                         $this->addAttribute($attr);
                     }
                     break;
             }
         }
     }
 }