Factory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 28
ccs 8
cts 10
cp 0.8
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDeclarations() 0 3 1
A buildDistributionAlgorithmFromKey() 0 4 1
A initialize() 0 5 1
1
<?php
2
namespace Aoe\Asdis\Domain\Model\DistributionAlgorithm;
3
4
use Aoe\Asdis\Domain\Model\DistributionAlgorithm\DistributionAlgorithmInterface;
5
use Aoe\Asdis\System\Factory\AbstractDeclarationBasedFactory;
6
7
/**
8
 * Factory for distribution algorithms.
9
 */
10
class Factory extends AbstractDeclarationBasedFactory
11
{
12
    /**
13
     * @param string $key
14
     * @return \Aoe\Asdis\Domain\Model\DistributionAlgorithm\DistributionAlgorithmInterface
15
     */
16 1
    public function buildDistributionAlgorithmFromKey($key)
17
    {
18 1
        $this->initialize();
19 1
        return $this->buildObjectFromKey($key);
20
    }
21
22
    /**
23
     * @return void
24
     */
25 1
    private function initialize()
26
    {
27 1
        $this->setDeclarations($this->getDeclarations());
28 1
        $this->setFallbackKey('hashBasedGroups');
29 1
        $this->setClassImplements(['Aoe\Asdis\Domain\Model\DistributionAlgorithm\DistributionAlgorithmInterface']);
30 1
    }
31
32
    /**
33
     * @return array
34
     */
35
    protected function getDeclarations()
36
    {
37
        return $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['asdis']['distributionAlgorithms'];
38
    }
39
}