LongNamingStrategy   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 28
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getTypeName() 0 4 1
A getAnonymousTypeName() 0 4 1
A getItemName() 0 4 1
A getPropertyName() 0 4 1
A classify() 0 4 1
1
<?php
2
namespace Goetas\Xsd\XsdToPhp\Naming;
3
4
use Doctrine\Common\Inflector\Inflector;
5
use GoetasWebservices\XML\XSDReader\Schema\Item;
6
use GoetasWebservices\XML\XSDReader\Schema\Type\Type;
7
8
class LongNamingStrategy implements NamingStrategy
9
{
10
11
    public function getTypeName(Type $type)
12
    {
13
        return $this->classify($type->getName()) . "Type";
14
    }
15
16
    public function getAnonymousTypeName(Type $type, $parentName)
17
    {
18
        return $this->classify($parentName) . "AnonymousType";
19
    }
20
21
    public function getItemName(Item $item)
22
    {
23
        return $this->classify($item->getName());
24
    }
25
26
    public function getPropertyName($item)
27
    {
28
        return Inflector::camelize(str_replace(".", " ", $item->getName()));
29
    }
30
31
    private function classify($name)
32
    {
33
        return Inflector::classify(str_replace(".", " ", $name));
34
    }
35
}