Пример #1
0
 /**
  * @return ParserState
  */
 public static function queryState(IObject $aObject)
 {
     if ($aObject instanceof Tag) {
         return ParserStateTag::singleton();
     } else {
         if ($aObject instanceof AttributeValue) {
             return ParserStateAttribute::singleton();
         } else {
             if ($aObject instanceof Node) {
                 return ParserStateNode::singleton();
             } else {
                 if ($aObject instanceof Macro) {
                     return ParserStateMacro::singleton();
                 } else {
                     if ($aObject instanceof Text) {
                         return ParserStateText::singleton();
                     } else {
                         if ($aObject instanceof ObjectBase) {
                             return ParserStateDefault::singleton();
                         } else {
                             throw new Exception("!?");
                         }
                     }
                 }
             }
         }
     }
 }
Пример #2
0
 public function __construct()
 {
     parent::__construct();
     self::setSingleton($this);
     $this->arrChangeToStates[__NAMESPACE__ . '\\ParserStateMacro'] = ParserStateMacro::singleton();
     $this->arrChangeToStates[__NAMESPACE__ . '\\ParserStateAttribute'] = ParserStateAttribute::singleton();
 }