예제 #1
0
 /**
  * Checks that a component tag as an attribute and that the attribute has the required value
  * Throws an IllegalStateException if it is not
  * @param ComponentTag $tag The tag to check
  * @param String $attribute The attribute to find
  * @param String $value The value the attribute will have
  */
 protected function checkComponentTagAttribute(ComponentTag $tag, $attribute, $value)
 {
     $attributes = $tag->getAttributes();
     if (!array_key_exists($attribute, $attributes) || $attributes[$attribute] != $value) {
         throw new \IllegalStateException(sprintf("An %s component can only be added to a tag with a %s of %s", get_called_class(), $attribute, $value));
     }
 }