Passed
Branch master (f55b85)
by Dispositif
03:58 queued 01:26
created

SummaryExternTrait::tagAndLog()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 8
c 1
b 0
f 0
nc 4
nop 1
dl 0
loc 13
rs 10
1
<?php
2
/*
3
 * This file is part of dispositif/wikibot application (@github)
4
 * 2019-2023 © Philippe M./Irønie  <[email protected]>
5
 * For the full copyright and MIT license information, view the license file.
6
 */
7
8
declare(strict_types=1);
9
10
namespace App\Domain\ExternLink;
11
12
use App\Domain\Models\Summary;
13
use Exception;
14
15
trait SummaryExternTrait
16
{
17
    /**
18
     * todo move
19
     *
20
     * @param array $mapData
21
     *
22
     * @throws Exception
23
     */
24
    protected function tagAndLog(array $mapData)
25
    {
26
        $this->log->debug('mapData', $mapData);
27
        $this->summary->citationNumber = $this->summary->citationNumber ?? 0;
28
        $this->summary->citationNumber++;
29
30
        if (!isset($this->summary->memo['sites'])
31
            || !in_array($this->externalPage->getPrettyDomainName(), $this->summary->memo['sites'])
32
        ) {
33
            $this->summary->memo['sites'][] = $this->externalPage->getPrettyDomainName(); // ???
34
        }
35
        if (isset($mapData['accès url'])) {
36
            $this->log->debug('accès 🔒 ' . $mapData['accès url']);
37
        }
38
    }
39
40
    protected function addSummaryLog(array $mapData, Summary $summary)
41
    {
42
        $this->summary = $summary;
1 ignored issue
show
Bug Best Practice introduced by
The property summary does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
43
        $this->summaryLog[] = $mapData['site'] ?? $mapData['périodique'] ?? '?';
1 ignored issue
show
Bug Best Practice introduced by
The property summaryLog does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
44
    }
45
}