Test Setup Failed
Push — develop ( 17b215...d74e9d )
by Freddie
13:13
created

UseCaseBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 21
ccs 1
cts 1
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFileTemplate() 0 3 1
A getPathTemplate() 0 3 1
A __construct() 0 9 1
1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of FlexPHP.
4
 *
5
 * (c) Freddie Gar <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9 1
 */
10
namespace FlexPHP\Generator\Domain\Builders\UseCase;
11 1
12
use FlexPHP\Generator\Domain\Builders\AbstractBuilder;
13
use FlexPHP\Schema\Constants\Keyword;
14 1
15
final class UseCaseBuilder extends AbstractBuilder
16 1
{
17
    public function __construct(string $entity, string $action, array $properties)
18
    {
19
        $properties = \array_reduce($properties, function ($result, $property) {
20
            $result[$property[Keyword::NAME]] = $property;
21
22
            return $result;
23
        }, []);
24
25
        parent::__construct(\compact('entity', 'action', 'properties'));
26
    }
27
28
    protected function getFileTemplate(): string
29
    {
30
        return 'UseCase.php.twig';
31
    }
32
33
    protected function getPathTemplate(): string
34
    {
35
        return \sprintf('%1$s/FlexPHP/UseCase', parent::getPathTemplate());
36
    }
37
}
38