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

Factory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 77.78%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 24
ccs 7
cts 9
cp 0.7778
rs 10
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
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