Passed
Push — master ( fd6b1a...a766ea )
by Dispositif
02:28
created

PageWorkStatus::addErrorWarning()   A

Complexity

Conditions 3
Paths 2

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 3
nc 2
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
namespace App\Application\OuvrageEdit;
11
12
/**
13
 * todo choisir/clarifier redondance avec WikiPageAction !!
14
 * See also Application/OuvrageComplete/CitationStatus and Domain/OptiStatus
15
 */
16
class PageWorkStatus
17
{
18
    /**
19
     * @var string
20
     */
21
    protected $title;
22
    public $wikiText = null;
23
    public $errorWarning = [];
24
    public $featured_article = false;
25
    public $citationSummary = [];
26
    public $importantSummary = [];
27
    public $nbRows = 0;
28
    public $notCosmetic = false;
29
30
    // Minor flag on edit
31
    public $minorFlag = true;
32
    // WikiBotConfig flag on edit
33
    public $botFlag = true;
34
    public $citationVersion = '';
35
    public $luckyState = false;
36
37
    public function __construct(string $title)
38
    {
39
        $this->title = $title;
40
    }
41
42
    public function getTitle(): ?string
43
    {
44
        return $this->title;
45
    }
46
47
    public function addErrorWarning(string $text): void
48
    {
49
        if (empty($this->errorWarning) || !in_array($text, $this->errorWarning)) {
50
            $this->errorWarning[] = $text;
51
        }
52
    }
53
54
    public function addSummaryTag(string $tag)
55
    {
56
        if (!in_array($tag, $this->importantSummary)) {
57
            $this->importantSummary[] = $tag;
58
        }
59
    }
60
}