Some refactoring

This commit is contained in:
Yusuf Kandemir 2018-11-11 23:18:13 +03:00
parent 87dd20f753
commit ee7eaf1317
1 changed files with 7 additions and 7 deletions

View File

@ -7,12 +7,8 @@ class MicrodataDOMElement extends \DOMElement
public function getProperties()
{
$results = [];
$memory = [];
$pending = [];
$memory[] = $this;
$pending = array_merge($pending, $this->getChildElementNodes());
$memory = [$this];
$pending = $this->getChildElementNodes();
if ($this->hasAttribute('itemref')) {
$tokens = $this->tokenizeAttribute('itemref');
@ -37,7 +33,7 @@ class MicrodataDOMElement extends \DOMElement
$pending = array_merge($pending, $current->getChildElementNodes());
}
if ($current->hasAttribute('itemprop') && /* hasPropertyNames */ $current->getPropertyNames()) {
if ($current->hasAttribute('itemprop') && $current->hasPropertyNames()) {
$results[] = $current;
}
}
@ -45,6 +41,10 @@ class MicrodataDOMElement extends \DOMElement
return array_reverse($results);
}
public function hasPropertyNames() {
return !empty($this->tokenizeAttribute('itemprop'));
}
public function getPropertyNames()
{
$tokens = $this->tokenizeAttribute('itemprop');