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

Validator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 2
c 2
b 1
f 0
lcom 1
cbo 1
dl 0
loc 29
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A verify() 0 8 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