PicoFeed\Filter\Attribute::hasRequiredAttributes PHP Méthode

hasRequiredAttributes() public méthode

Return true if all required attributes are present.
public hasRequiredAttributes ( string $tag, array $attributes ) : boolean
$tag string Tag name
$attributes array Attributes list
Résultat boolean
    public function hasRequiredAttributes($tag, array $attributes)
    {
        if (isset($this->required_attributes[$tag])) {
            foreach ($this->required_attributes[$tag] as $attribute) {
                if (!isset($attributes[$attribute])) {
                    return false;
                }
            }
        }
        return true;
    }

Usage Example

Exemple #1
0
 /**
  * Parse opening tag.
  *
  * @param resource $parser     XML parser
  * @param string   $tag        Tag name
  * @param array    $attributes Tag attributes
  */
 public function startTag($parser, $tag, array $attributes)
 {
     $this->empty = true;
     if ($this->tag->isAllowed($tag, $attributes)) {
         $attributes = $this->attribute->filter($tag, $attributes);
         if ($this->attribute->hasRequiredAttributes($tag, $attributes)) {
             $attributes = $this->attribute->addAttributes($tag, $attributes);
             $this->output .= $this->tag->openHtmlTag($tag, $this->attribute->toHtml($attributes));
             $this->empty = false;
         }
     }
     $this->empty_tags[] = $this->empty;
 }
All Usage Examples Of PicoFeed\Filter\Attribute::hasRequiredAttributes