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

FlowManager::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
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
}