DiDom\Element::create PHP Метод

create() публичный статический Метод

Create new element.
public static create ( DOMNode | string $name, string $value = null, array $attributes = [] ) : Element
$name DOMNode | string The tag name of the element
$value string The value of the element
$attributes array The attributes of the element
Результат Element
    public static function create($name, $value = null, $attributes = [])
    {
        return new Element($name, $value, $attributes);
    }

Usage Example

Пример #1
0
 public function testCreate()
 {
     $element = Element::create('span', 'Foo', ['class' => 'bar']);
     $this->assertEquals('span', $element->tag);
     $this->assertEquals('Foo', $element->text());
     $this->assertEquals(['class' => 'bar'], $element->attributes());
 }