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

Password   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A addCriteria() 0 6 1
A addFormat() 0 8 2
A generate() 0 4 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