Passed
Pull Request — master (#16)
by
unknown
13:19 queued 10:34
created

Factory::getDeclarations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Aoe\Asdis\Domain\Model\DistributionAlgorithm;
4
5
use Aoe\Asdis\System\Factory\AbstractDeclarationBasedFactory;
6
7
/**
8
 * Factory for distribution algorithms.
9
 */
10
class Factory extends AbstractDeclarationBasedFactory
11
{
12
    /**
13
     * @return DistributionAlgorithmInterface
14
     */
15 1
    public function buildDistributionAlgorithmFromKey(string $key)
16
    {
17 1
        $this->initialize();
18 1
        return $this->buildObjectFromKey($key);
19
    }
20
21
    /**
22
     * @return array
23
     */
24
    protected function getDeclarations()
25
    {
26
        return $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['asdis']['distributionAlgorithms'];
27
    }
28
29 1
    private function initialize(): void
30
    {
31 1
        $this->setDeclarations($this->getDeclarations());
32 1
        $this->setFallbackKey('hashBasedGroups');
33 1
        $this->setClassImplements([DistributionAlgorithmInterface::class]);
34 1
    }
35
}
36