// og:title
$list = $this->domXPath->query("//meta[@property='og:title']");
foreach ($list as $node) {
- foreach ($node->attributes as $attribute) {
- if ($attribute->nodeName === 'content') {
- return $attribute->nodeValue;
- }
- }
+ /** @var \DOMElement $node */
+ return $node->getAttribute("content");
}
// title tag
// og:description
$list = $this->domXPath->query("//meta[@property='og:description']");
foreach ($list as $node) {
- foreach ($node->attributes as $attribute) {
- if ($attribute->nodeName === 'content') {
- return $attribute->nodeValue;
- }
- }
+ /** @var \DOMElement $node */
+ return $node->getAttribute("content");
}
}
// og:image
$list = $this->domXPath->query("//meta[@property='og:image']");
foreach ($list as $node) {
- foreach ($node->attributes as $attribute) {
- if ($attribute->nodeName === 'content') {
- return $attribute->nodeValue;
- }
- }
+ /** @var \DOMElement $node */
+ return $node->getAttribute("content");
}
}