Passed
Branch dev3 (493baa)
by Dispositif
02:30
created

WikiTextValidator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
eloc 6
c 1
b 0
f 1
dl 0
loc 17
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A validate() 0 7 3
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\Application\OuvrageEdit\Validators;
12
13
14
class WikiTextValidator implements ValidatorInterface
15
{
16
    /** @var string|null */
17
    protected $wikiText;
18
19
    public function __construct(?string $wikiText)
20
    {
21
        $this->wikiText = $wikiText;
22
    }
23
24
    public function validate(): bool
25
    {
26
        if ($this->wikiText === '' || $this->wikiText === '0') {
27
            return false;
28
        }
29
30
        return true;
31
    }
32
}