AbstractProfileActionBuilder   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 11
c 1
b 0
f 0
dl 0
loc 42
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A init() 0 9 2
A build() 0 7 2
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\Action\Profile;
13
14
use LightSaml\Build\Container\BuildContainerInterface;
15
use LightSaml\Builder\Action\CompositeActionBuilder;
16
use LightSaml\Error\LightSamlBuildException;
17
18
abstract class AbstractProfileActionBuilder extends CompositeActionBuilder
19
{
20
    /** @var BuildContainerInterface */
21
    protected $buildContainer;
22
23
    /** @var bool */
24
    private $initialized = false;
25
26
    public function __construct(BuildContainerInterface $buildContainer)
27
    {
28
        $this->buildContainer = $buildContainer;
29
    }
30
31
    /**
32
     * @return void
33
     */
34
    public function init()
35
    {
36
        if ($this->initialized) {
37
            throw new LightSamlBuildException('Already initialized');
38
        }
39
40
        $this->doInitialize();
41
42
        $this->initialized = true;
43
    }
44
45
    /**
46
     * @return void
47
     */
48
    abstract protected function doInitialize();
49
50
    /**
51
     * @return \LightSaml\Action\ActionInterface
52
     */
53
    public function build()
54
    {
55
        if (false === $this->initialized) {
56
            $this->init();
57
        }
58
59
        return parent::build();
60
    }
61
}
62