RuleBuilder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getFileTemplate() 0 3 1
A build() 0 3 1
A getPathTemplate() 0 3 1
A __construct() 0 5 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 7
 */
10
namespace FlexPHP\Generator\Domain\Builders\Constraint;
11 7
12 7
use FlexPHP\Generator\Domain\Builders\AbstractBuilder;
13
use FlexPHP\Schema\SchemaAttributeInterface;
14 7
15
final class RuleBuilder extends AbstractBuilder
16 7
{
17 7
    public function __construct(SchemaAttributeInterface $property)
18
    {
19 7
        $name = $this->getInflector()->camelProperty($property->name());
20
21 7
        parent::__construct(\compact('name', 'property'));
22
    }
23
24 7
    public function build(): string
25
    {
26 7
        return \rtrim(parent::build());
27
    }
28
29 7
    protected function getFileTemplate(): string
30
    {
31 7
        return 'Rule.php.twig';
32
    }
33
34
    protected function getPathTemplate(): string
35
    {
36
        return \sprintf('%1$s/FlexPHP/Constraint', parent::getPathTemplate());
37
    }
38
}
39