public function register($element, $container=false) {
      if (in_array($element['tag'], array("Request", "Response")))
        return new BaMLContainer($element['tag']);
      if (!(in_array($element['tag'], BaMLVerb::$valid)))
        throw new \CatapultApiException($element['tag'] . " is not a valid verb..");
      if ($container) {
        $class = "Catapult\\" . "BaMLVerb" . $element['tag']; 
      } else {
        $class =  "Catapult\\" . "BaMLVerb" . $element['tag']; 
      }
      $class = new $class;
      if (isset($element['attributes'])) {
         foreach ($element['attributes'] as $k => $attr) {
           $class->addAttribute($k, $attr);
         }
      }
      if (isset($element['value']))
        $class->setText(trim($element['value']));
      $class->level = $element['level'];
      return $class;
    }
public function register($element, $container=false) {
      if (in_array($element['tag'], array("Request", "Response")))
        return new BaMLContainer($element['tag']);
      if (!(in_array($element['tag'], BaMLVerb::$valid)))
        throw new \CatapultApiException($element['tag'] . " is not a valid verb..");
      if ($container) {
        $class = "Catapult\\" . "BaMLVerb" . $element['tag']; 
      } else {
        $class =  "Catapult\\" . "BaMLVerb" . $element['tag']; 
      }
      $class = new $class;
      if (isset($element['attributes'])) {
         foreach ($element['attributes'] as $k => $attr) {
           $class->addAttribute($k, $attr);
         }
      }
      if (isset($element['value']))
        $class->setText(trim($element['value']));
      $class->level = $element['level'];
      return $class;
    }
public function register ( $ element , $ container = false ) { if ( in_array ( $ element [ 'tag' ] , array ( "Request" , "Response" ) ) ) return new BaMLContainer ( $ element [ 'tag' ] ) ; if ( ! ( in_array ( $ element [ 'tag' ] , BaMLVerb :: $ valid ) ) ) throw new \ CatapultApiException ( $ element [ 'tag' ] . " is not a valid verb.." ) ; if ( $ container ) { $ class = "Catapult\\" . "BaMLVerb" . $ element [ 'tag' ] ; } else { $ class = "Catapult\\" . "BaMLVerb" . $ element [ 'tag' ] ; } $ class = new $ class ; if ( isset ( $ element [ 'attributes' ] ) ) { foreach ( $ element [ 'attributes' ] as $ k => $ attr ) { $ class -> addAttribute ( $ k , $ attr ) ; } } if ( isset ( $ element [ 'value' ] ) ) $ class -> setText ( trim ( $ element [ 'value' ] ) ) ; $ class -> level = $ element [ 'level' ] ; return $ class ; }
valid will check if this is valid
according to BaML

@param valid: BaML xml struct item with level, name and attributes
valid will check if this is valid according to BaML