Pop\Dom\Child::getAttribute PHP Method

getAttribute() public method

Get the attribute of the child object.
public getAttribute ( string $name ) : string
$name string
return string
    public function getAttribute($name)
    {
        return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
    }

Usage Example

Example #1
0
 public function testChild()
 {
     $c = new Child('p', 'This is a paragraph', new Child('p', 'This is another paragraph'));
     $c->setAttributes('class', 'some-class');
     $this->assertEquals('p', $c->getNodeName());
     $this->assertEquals('This is a paragraph', $c->getNodeValue());
     $this->assertEquals('some-class', $c->getAttribute('class'));
 }
All Usage Examples Of Pop\Dom\Child::getAttribute