Passed
Push — master ( 854f93...e973cc )
by DeGracia
01:46
created

Password::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
3
namespace DeGraciaMathieu\Riddler;
4
5
use DeGraciaMathieu\Riddler\Contracts;
6
7
class Password {
8
9
    protected $criterias;
10
    protected $manager;
11
12 12
    public function __construct()
13
    {
14 12
        $this->criterias = [];
15 12
        $this->manager = new Manager;
16 12
    }
17
18 11
    public function addCriteria($dictionary, $occurence)
19
    {
20 11
        $buildCriteria = $this->manager->buildCriteria($dictionary, $occurence);
21
22 11
        $this->criterias[] = $buildCriteria;
23 11
    }   
24
25 5
    public function addFormat(Contracts\Format $format)
26
    {
27 5
        $criteriasBundle = $format->handle();
28
29 5
        foreach ($criteriasBundle as $bundle) {
30 5
            $this->addCriteria($bundle[0], $bundle[1]);
31
        }
32 5
    }  
33
34 12
    public function generate()
35
    {
36 12
        return $this->manager->generate($this->criterias);
37
    }	
38
}
39