Validator::verify()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Ptondereau\PackMe\Validators;
4
5
use Ptondereau\PackMe\Package;
6
use Ptondereau\PackMe\Validators\Checks\ApplicationExist;
7
use Ptondereau\PackMe\Validators\Checks\GoodAuthor;
8
use Ptondereau\PackMe\Validators\Checks\GoodName;
9
10
class Validator
11
{
12
    /**
13
     * List of checks.
14
     *
15
     * @var string[]
16
     */
17
    protected $checks = [
18
        ApplicationExist::class,
19
        GoodName::class,
20
        GoodAuthor::class,
21
    ];
22
23
    /**
24
     * Ensure all Package's parameters are good.
25
     *
26
     * @param Package $package
27
     *
28
     * @return bool
29
     */
30 15
    public function verify(Package $package)
31
    {
32 15
        foreach ($this->checks as $class) {
33 15
            (new $class())->verify($package);
34 4
        }
35
36 6
        return true;
37
    }
38
}
39