LongNamingStrategy::getAnonymousTypeName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
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
}