ResponseBuilder::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 8
ccs 0
cts 0
cp 0
crap 2
rs 10
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\Message;
11 1
12
use FlexPHP\Generator\Domain\Builders\AbstractBuilder;
13
use FlexPHP\Schema\SchemaInterface;
14 1
15
final class ResponseBuilder extends AbstractBuilder
16 1
{
17
    public function __construct(SchemaInterface $schema, string $action)
18
    {
19
        $entity = $this->getInflector()->entity($schema->name());
20
        $item = $this->getInflector()->item($schema->name());
21
        $items = $this->getInflector()->items($schema->name());
22
        $action = $this->getInflector()->pascalAction($action);
23
24
        parent::__construct(\compact('entity', 'item', 'items', 'action'));
25
    }
26
27
    protected function getFileTemplate(): string
28
    {
29
        return 'Response.php.twig';
30
    }
31
32
    protected function getPathTemplate(): string
33
    {
34
        return \sprintf('%1$s/FlexPHP/Message', parent::getPathTemplate());
35
    }
36
}
37