getFieldNameFromRelationshipDescriptor()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
4
namespace TheCodingMachine\Tdbm\GraphQL;
5
6
use TheCodingMachine\TDBM\Utils\AbstractBeanPropertyDescriptor;
7
use TheCodingMachine\TDBM\Utils\DirectForeignKeyMethodDescriptor;
8
use TheCodingMachine\TDBM\Utils\MethodDescriptorInterface;
9
10
class DefaultNamingStrategy implements NamingStrategyInterface
11
{
12
    public function getGraphQLType(string $beanClassName): string
13
    {
14
        return $beanClassName;
15
    }
16
17
    public function getClassName(string $beanClassName) : string
18
    {
19
        return $this->getGraphQLType($beanClassName).'Type';
20
    }
21
22
    public function getGeneratedClassName(string $beanClassName) : string
23
    {
24
        return 'Abstract'.$this->getClassName($beanClassName);
25
    }
26
27
    public function getFieldName(AbstractBeanPropertyDescriptor $descriptor): string
28
    {
29
        return substr($descriptor->getVariableName(), 1);
30
    }
31
32
    public function getFieldNameFromRelationshipDescriptor(MethodDescriptorInterface $descriptor): string
33
    {
34
        return lcfirst(substr($descriptor->getName(), 3));
35
    }
36
}
37