Completed
Pull Request — master (#1)
by De Cramer
02:40 queued 40s
created

SimpleGroupingFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

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