Type::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Goetas\XML\XSDReader\Schema\Type;
3
4
use Goetas\XML\XSDReader\Schema\Schema;
5
use Goetas\XML\XSDReader\Schema\SchemaItem;
6
use Goetas\XML\XSDReader\Schema\Inheritance\Extension;
7
use Goetas\XML\XSDReader\Schema\Inheritance\Restriction;
8
abstract class Type implements SchemaItem
9
{
10
    protected $schema;
11
12
    protected $name;
13
14
    protected $abstract = false;
15
16
    protected $doc;
17
18
    /**
19
     *
20
     * @var Restriction
21
     */
22
    protected $restriction;
23
24
    /**
25
     *
26
     * @var Extension
27
     */
28
    protected $extension;
29
30
    public function __construct(Schema $schema, $name = null)
31
    {
32
        $this->name = $name?:null;
33
        $this->schema = $schema;
34
    }
35
36
    public function getName()
37
    {
38
        return $this->name;
39
    }
40
41
    public function setName($name)
42
    {
43
        $this->name = $name;
44
        return $this;
45
    }
46
47
    public function getDoc()
48
    {
49
        return $this->doc;
50
    }
51
52
    public function setDoc($doc)
53
    {
54
        $this->doc = $doc;
55
        return $this;
56
    }
57
    /**
58
     *
59
     * @return Schema
60
     */
61
    public function getSchema()
62
    {
63
        return $this->schema;
64
    }
65
    public function __toString()
66
    {
67
        return strval($this->name);
68
    }
69
70
    public function isAbstract()
71
    {
72
        return $this->abstract;
73
    }
74
75
    public function setAbstract($abstract)
76
    {
77
        $this->abstract = $abstract;
78
        return $this;
79
    }
80
81
    /**
82
     *
83
     * @return \Goetas\XML\XSDReader\Schema\Inheritance\Base
84
    */
85
    public function getParent()
86
    {
87
        return $this->restriction ?  : $this->extension;
88
    }
89
90
    public function getRestriction()
91
    {
92
        return $this->restriction;
93
    }
94
95
    public function setRestriction(Restriction $restriction)
96
    {
97
        $this->restriction = $restriction;
98
        return $this;
99
    }
100
101
    public function getExtension()
102
    {
103
        return $this->extension;
104
    }
105
106
    public function setExtension(Extension $extension)
107
    {
108
        $this->extension = $extension;
109
        return $this;
110
    }
111
}
112