Completed
Push — develop ( b5dddc...8dd5aa )
by Freddie
04:50
created

JavascriptBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getPathTemplate() 0 3 1
A getFileTemplate() 0 3 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
 */
10
namespace FlexPHP\Generator\Domain\Builders\Javascript;
11
12
use FlexPHP\Generator\Domain\Builders\AbstractBuilder;
13
use FlexPHP\Schema\SchemaInterface;
14
15
final class JavascriptBuilder extends AbstractBuilder
16
{
17
    public function __construct(SchemaInterface $schema)
18
    {
19
        $route = $this->getPluralize($this->getDashCase($schema->name()));
20
        $item = $this->getCamelCase($this->getSingularize($schema->name()));
21
        $fkRels = $this->getFkRelations($schema->fkRelations());
22
23
        parent::__construct(\compact('route', 'item', 'fkRels'));
24
    }
25
26
    protected function getFileTemplate(): string
27
    {
28
        return 'Javascript.js.twig';
29
    }
30
31
    protected function getPathTemplate(): string
32
    {
33
        return \sprintf('%1$s/FlexPHP/Javascript', parent::getPathTemplate());
34
    }
35
}
36