forked from php-embed/Embed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTitle.php
More file actions
27 lines (24 loc) · 690 Bytes
/
Copy pathTitle.php
File metadata and controls
27 lines (24 loc) · 690 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
declare(strict_types = 1);
namespace Embed\Detectors;
class Title extends Detector
{
public function detect(): ?string
{
$oembed = $this->extractor->getOEmbed();
$document = $this->extractor->getDocument();
$metas = $this->extractor->getMetas();
return $oembed->str('title')
?: $metas->str(
'og:title',
'twitter:title',
'lp:title',
'dcterms.title',
'article:title',
'headline',
'article.headline',
'parsely-title'
)
?: $document->select('.//head/title')->str();
}
}