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

WikiTextValidator::validate()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
c 1
b 0
f 1
dl 0
loc 7
rs 10
cc 3
nc 2
nop 0
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
}