Passed
Push — dev ( 043eb4...bf3609 )
by Dispositif
06:23
created

LiberationMapper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 18 2
1
<?php
2
/**
3
 * This file is part of dispositif/wikibot application
4
 * 2019 © Philippe M. <[email protected]>
5
 * For the full copyright and MIT license information, please view the LICENSE file.
6
 */
7
8
declare(strict_types=1);
9
10
11
namespace App\Domain\Publisher;
12
13
14
use DateTime;
15
16
/**
17
 * Class LiberationMapper
18
 *
19
 * @package App\Domain\Publisher
20
 */
21
class LiberationMapper extends WebMapper
22
{
23
    public function process($data): array
24
    {
25
        if(!isset($data['JSON-LD'])) {
26
            return [];
27
        }
28
        $data = $data['JSON-LD'];
29
30
        return [
31
            //            'langue' => 'fr',
32
            'périodique' => '[[Libération (journal)|Libération]]',
33
            //           'acces' =>  $data['isAccessibleForFree'],
34
            'titre' => html_entity_decode($data['headline'] ?? null),
35
            'lire en ligne' => $data['mainEntityOfPage']['@id'],
36
            'date' => $this->convertDate($data['dateCreated']), //  "2017-11-17T20:06:13"
37
            'auteur1' => $this->convertAuteur($data, 0),
38
            'auteur2' => $this->convertAuteur($data, 1),
39
            'auteur3' => $this->convertAuteur($data, 2),
40
            'auteur institutionnel' => $this->convertInstitutionnel($data),
41
        ];
42
    }
43
44
}
45