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

PageWorkStatus   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 7
eloc 19
c 2
b 0
f 1
dl 0
loc 42
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A addErrorWarning() 0 4 3
A getTitle() 0 3 1
A __construct() 0 3 1
A addSummaryTag() 0 4 2
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
}