Conditions | 5 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | public function process($data): array |
||
23 | { |
||
24 | if(!isset($data['JSON-LD'])) { |
||
25 | return []; |
||
26 | } |
||
27 | $ld = $data['JSON-LD']; |
||
28 | |||
29 | if ($ld && isset($ld['@type']) && 'NewsArticle' !== $ld['@type']) { |
||
30 | throw new \Exception('not NewsArticle'); |
||
31 | } |
||
32 | |||
33 | return [ |
||
34 | // 'langue' => 'fr', |
||
35 | 'périodique' => '[[Le Monde]]', |
||
36 | 'titre' => trim(html_entity_decode($ld['headline'])), |
||
37 | 'lire en ligne' => $ld['mainEntityOfPage']['@id'], |
||
38 | 'auteur1' => $data['meta']['og:article:author'] ?? null, |
||
39 | // ['meta']['og:article:content_tier'] === 'free' |
||
40 | 'date' => $this->convertDate($ld['datePublished']), // 2020-03-20T04:31:07+01:00 |
||
41 | ]; |
||
45 |