AbstractProfileBuilder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 52
c 0
b 0
f 0
wmc 3
lcom 0
cbo 5
ccs 12
cts 12
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A buildAction() 0 4 1
A buildContext() 0 12 1
getProfileId() 0 1 ?
getProfileRole() 0 1 ?
getActionBuilder() 0 1 ?
1
<?php
2
3
/*
4
 * This file is part of the LightSAML-Core package.
5
 *
6
 * (c) Milos Tomic <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace LightSaml\Builder\Profile;
13
14
use LightSaml\Build\Container\BuildContainerInterface;
15
use LightSaml\Builder\Context\ProfileContextBuilder;
16
17
abstract class AbstractProfileBuilder implements ProfileBuilderInterface
18
{
19
    /** @var BuildContainerInterface */
20
    protected $container;
21
22
    /**
23
     * @param BuildContainerInterface $buildContainer
24
     */
25 3
    public function __construct(BuildContainerInterface $buildContainer)
26
    {
27 3
        $this->container = $buildContainer;
28 3
    }
29
30
    /**
31
     * @return \LightSaml\Action\CompositeAction
32
     */
33 3
    public function buildAction()
34
    {
35 3
        return $this->getActionBuilder()->build();
36
    }
37
38
    /**
39
     * @return \LightSaml\Context\Profile\ProfileContext
40
     */
41 3
    public function buildContext()
42
    {
43 3
        $builder = new ProfileContextBuilder();
44
        $builder
45 3
            ->setProfileId($this->getProfileId())
46 3
            ->setRequest($this->container->getSystemContainer()->getRequest())
47 3
            ->setProfileRole($this->getProfileRole())
48 3
            ->setOwnEntityDescriptorProvider($this->container->getOwnContainer()->getOwnEntityDescriptorProvider())
49
        ;
50
51 3
        return $builder->build();
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    abstract protected function getProfileId();
58
59
    /**
60
     * @return string
61
     */
62
    abstract protected function getProfileRole();
63
64
    /**
65
     * @return \LightSaml\Builder\Action\ActionBuilderInterface
66
     */
67
    abstract protected function getActionBuilder();
68
}
69