Passed
Branch master (ee24dc)
by Dispositif
03:19 queued 39s
created

OuvrageOptimize   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isNotCosmetic() 0 3 1
A doTasks() 0 38 1
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\WikiOptimizer;
11
12
use App\Domain\AbstractTemplateOptimizer;
13
use App\Domain\WikiOptimizer\Handlers\AuthorLinkHandler;
14
use App\Domain\WikiOptimizer\Handlers\BnfHandler;
15
use App\Domain\WikiOptimizer\Handlers\DateHandler;
16
use App\Domain\WikiOptimizer\Handlers\DistinguishAuthorsHandler;
17
use App\Domain\WikiOptimizer\Handlers\EditeurHandler;
18
use App\Domain\WikiOptimizer\Handlers\EditionCitebookHandler;
19
use App\Domain\WikiOptimizer\Handlers\ExternalTemplateHandler;
20
use App\Domain\WikiOptimizer\Handlers\GoogleBooksUrlHandler;
21
use App\Domain\WikiOptimizer\Handlers\LangParamHandler;
22
use App\Domain\WikiOptimizer\Handlers\LocationHandler;
23
use App\Domain\WikiOptimizer\Handlers\OuvrageFormatHandler;
24
use App\Domain\WikiOptimizer\Handlers\OuvrageIsbnHandler;
25
use App\Domain\WikiOptimizer\Handlers\PredictErrorParameterHandler;
26
use App\Domain\WikiOptimizer\Handlers\TitleHandler;
27
28
/**
29
 * Legacy.
30
 * TODO move methods to OuvrageClean setters
31
 * TODO AbstractProcess
32
 * TODO observer/event (log, MajorEdition)
33
 */
34
class OuvrageOptimize extends AbstractTemplateOptimizer
35
{
36
    public const CONVERT_GOOGLEBOOK_TEMPLATE = false; // change OuvrageOptimizeTest !!
37
38
    public const WIKI_LANGUAGE = 'fr';
39
40
    public const PUBLISHER_FRWIKI_FILENAME = __DIR__.'/../resources/data_editors_wiki.json';
41
42
    protected $notCosmetic = false;
43
44
    protected $major = false;
45
46
    /**
47
     * @noinspection PhpParamsInspection
48
     */
49
    public function doTasks(): self
50
    {
51
        $optiStatus = new OptiStatus();
52
53
        (new PredictErrorParameterHandler($this->optiTemplate, $optiStatus))->handle();
54
55
        (new DistinguishAuthorsHandler($this->optiTemplate, $optiStatus))->handle();
56
57
        $langParamHandler = new LangParamHandler($this->optiTemplate, $optiStatus);
58
        $langParamHandler->handle();
59
        $langParamHandler->setLangParam('langue originale');
60
        $langParamHandler->handle();
61
62
        (new TitleHandler($this->optiTemplate, $optiStatus))->handle();
63
64
        (new AuthorLinkHandler($this->optiTemplate, $optiStatus))->handle();
65
66
        (new EditionCitebookHandler($this->optiTemplate, $optiStatus))->handle();
67
68
        (new EditeurHandler($this->optiTemplate, $optiStatus, $this->wikiPageTitle, $this->log))->handle();
69
70
        (new DateHandler($this->optiTemplate, $optiStatus))->handle();
71
72
        (new ExternalTemplateHandler($this->optiTemplate, $optiStatus))->handle();
73
74
        (new OuvrageFormatHandler($this->optiTemplate, $optiStatus))->handle();
75
76
        (new OuvrageIsbnHandler($this->optiTemplate, $optiStatus))->handle();
77
78
        (new BnfHandler($this->optiTemplate, $optiStatus))->handle();
79
80
        (new LocationHandler($this->optiTemplate, $optiStatus, $this->pageListManager))->handle();
0 ignored issues
show
Bug introduced by
It seems like $this->pageListManager can also be of type null; however, parameter $pageListManager of App\Domain\WikiOptimizer...nHandler::__construct() does only seem to accept App\Domain\InfrastructurePorts\PageListInterface, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

80
        (new LocationHandler($this->optiTemplate, $optiStatus, /** @scrutinizer ignore-type */ $this->pageListManager))->handle();
Loading history...
81
82
        $googleUrlHandler = new GoogleBooksUrlHandler($this->optiTemplate, $optiStatus);
83
        $googleUrlHandler->handle();
84
        $googleUrlHandler->sethandlerParam('présentation en ligne')->handle();
85
86
        return $this;
87
    }
88
89
    /**
90
     * @return bool
91
     */
92
    public function isNotCosmetic(): bool
93
    {
94
        return $this->notCosmetic;
95
    }
96
}
97