SimpleGroupingFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 18
rs 10
c 2
b 0
f 0
ccs 0
cts 11
cp 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 3 1
A configureValidator() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Oliverde8\Component\PhpEtl\Builder\Factories\Grouping;
6
7
use Oliverde8\Component\PhpEtl\Builder\Factories\AbstractFactory;
8
use Oliverde8\Component\PhpEtl\ChainOperation\ChainOperationInterface;
9
use Symfony\Component\Validator\Constraint;
10
use Symfony\Component\Validator\Constraints as Assert;
11
12
/**
13
 * Class SimpleGroupingFactory
14
 *
15
 * @author    de Cramer Oliver<[email protected]>
16
 * @copyright 2018 Oliverde8
17
 * @package Oliverde8\Component\PhpEtl\Builder\Factories\Grouping
18
 */
19
class SimpleGroupingFactory extends AbstractFactory
20
{
21
    /**
22
     * @inheritdoc
23
     */
24
    public function build(string $operation, array $options): ChainOperationInterface
25
    {
26
        return $this->create($options['grouping-key'], $options['group-identifier']);
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    protected function configureValidator(): Constraint
33
    {
34
        return new Assert\Collection([
35
             'grouping-key' => new Assert\NotBlank(),
36
             'group-identifier' => new Assert\Optional()
37
         ]);
38
    }
39
}
40