Completed
Push — master ( 9ab068...67c411 )
by Pierre
04:25
created

Validator::verify()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

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