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

AbstractOuvrageHandler::addSummaryLog()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 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
11
namespace App\Domain\WikiOptimizer\Handlers;
12
13
14
use App\Domain\Models\Wiki\AbstractWikiTemplate;
15
use App\Domain\Models\Wiki\OuvrageTemplate;
16
use App\Domain\WikiOptimizer\OptiStatus;
17
18
abstract class AbstractOuvrageHandler implements OptimizeHandlerInterface
19
{
20
    /**
21
     * @var OuvrageTemplate
22
     */
23
    protected $ouvrage;
24
    /**
25
     * @var OptiStatus
26
     */
27
    protected $optiStatus;
28
29
    public function __construct(OuvrageTemplate $ouvrage, OptiStatus $summary)
30
    {
31
        $this->ouvrage = $ouvrage;
32
        $this->optiStatus = $summary;
33
//        echo get_class($this) . "\n";
34
    }
35
36
    abstract public function handle();
37
38
    // methods alias
39
    protected function hasParamValue(string $string): bool
40
    {
41
        return $this->ouvrage->hasParamValue($string);
42
    }
43
44
    protected function getParam(string $string): ?string
45
    {
46
        return $this->ouvrage->getParam($string);
47
    }
48
49
    protected function addSummaryLog(string $string): OptiStatus
50
    {
51
        $this->optiStatus->addSummaryLog($string);
52
        return $this->optiStatus;
53
    }
54
55
    protected function unsetParam(string $string): AbstractWikiTemplate
56
    {
57
        $this->ouvrage->unsetParam($string);
58
        return $this->ouvrage;
59
    }
60
61
    protected function setParam(string $string, string $value): AbstractWikiTemplate
62
    {
63
        $this->ouvrage->setParam($string, $value);
64
        return $this->ouvrage;
65
    }
66
}