Passed
Push — master ( a8d522...c97e91 )
by Alexandre
02:40
created

FlowManager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A addFlow() 0 7 3
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Alexandre
5
 * Date: 18/02/2018
6
 * Time: 18:57
7
 */
8
9
namespace OAuth2\Flows;
10
11
12
use OAuth2\GrantTypes\GrantTypeManager;
13
use OAuth2\ResponseTypes\ResponseTypeManager;
14
15
class FlowManager
16
{
17
    protected $flows = [];
18
    /**
19
     * @var ResponseTypeManager
20
     */
21
    private $responseTypeManager;
22
    /**
23
     * @var GrantTypeManager
24
     */
25
    private $grantTypeManager;
26
27
    public function __construct(ResponseTypeManager $responseTypeManager, GrantTypeManager $grantTypeManager)
28
    {
29
        $this->responseTypeManager = $responseTypeManager;
30
        $this->grantTypeManager = $grantTypeManager;
31
    }
32
33
    public function addFlow(FlowInterface $flow)
34
    {
35
        foreach ($flow->getResponseTypes() as $responseType) {
36
            $this->responseTypeManager->addResponseType($responseType, $flow);
37
        }
38
        foreach ($flow->getGrantTypes() as $grantType) {
39
            $this->grantTypeManager->addGrantType($grantType, $flow);
40
        }
41
    }
42
}