ClassGenerator::markAsAbstract()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2014-04-26 
5
 */
6
7
namespace Net\Bazzline\Component\CodeGenerator;
8
9
use Net\Bazzline\Component\CodeGenerator\InvalidArgumentException;
10
use Net\Bazzline\Component\CodeGenerator\RuntimeException;
11
12
/**
13
 * Class ClassGenerator
14
 * @package Net\Bazzline\Component\Locator\LocatorGenerator\Generator
15
 */
16
class ClassGenerator extends SignatureGenerator
17
{
18
    /**
19
     * @param string $className
20
     * @param boolean $addToUse
21
     * @return $this
22
     */
23
    public function setExtends($className, $addToUse = false)
24
    {
25
        $this->addGeneratorProperty('extends', (string) $className, false);
26
27
        if ($addToUse) {
28
            $this->addUse($className);
29
        }
30
31
        return $this;
32
    }
33
34
    /**
35
     * @param string $interfaceName
36
     * @param boolean $addToUse
37
     * @return $this
38
     */
39
    public function addImplements($interfaceName, $addToUse = false)
40
    {
41
        $this->addGeneratorProperty('implements', (string) $interfaceName);
42
43
        if ($addToUse) {
44
            $this->addUse($interfaceName);
45
        }
46
47
        return $this;
48
    }
49
50
    /**
51
     * @param PropertyGenerator $property
52
     * @return $this
53
     */
54
    public function addProperty(PropertyGenerator $property)
55
    {
56
        $this->addGeneratorProperty('properties', $property);
57
58
        return $this;
59
    }
60
61
    /**
62
     * @param TraitGenerator $trait
63
     * @return $this
64
     */
65
    public function addTrait(TraitGenerator $trait)
66
    {
67
        $this->addGeneratorProperty('traits', $trait->getName());
68
69
        return $this;
70
    }
71
72
    /**
73
     * @return $this
74
     */
75
    public function markAsAbstract()
76
    {
77
        $this->addGeneratorProperty('abstract', true, false);
78
79
        return $this;
80
    }
81
82
    /**
83
     * @return $this
84
     */
85
    public function markAsFinal()
86
    {
87
        $this->addGeneratorProperty('final', true, false);
88
89
        return $this;
90
    }
91
}