Completed
Push — master ( 58a57e...9c59b1 )
by Vitaly
02:16
created

VisibilityTrait::defPrivate()   A

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 declare(strict_types = 1);
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 04.09.16 at 12:03
5
 */
6
namespace samsonphp\generator;
7
8
/**
9
 * Class VisibilityTrait
10
 *
11
 * @author Vitaly Egorov <[email protected]>
12
 */
13
trait VisibilityTrait
14
{
15
    /** @var string Method visibility */
16
    protected $visibility = ClassGenerator::VISIBILITY_PUBLIC;
17
18
    /** @var bool Flag that method is static */
19
    protected $isStatic = false;
20
21
    /**
22
     * Set method to be static.
23
     *
24
     * @return $this
25
     */
26
    public function defStatic()
27
    {
28
        $this->isStatic = true;
29
30
        return $this;
31
    }
32
33
    /**
34
     * Set protected property visibility.
35
     *
36
     * @return $this
37
     */
38
    public function defProtected()
39
    {
40
        return $this->defVisibility(ClassGenerator::VISIBILITY_PROTECTED);
41
    }
42
43
    /**
44
     * Set property visibility.
45
     *
46
     * @param string $visibility Property visibility
47
     *
48
     * @return $this
49
     */
50
    protected function defVisibility(string $visibility)
51
    {
52
        $this->visibility = $visibility;
53
54
        return $this;
55
    }
56
57
    /**
58
     * Set private property visibility.
59
     *
60
     * @return $this
61
     */
62
    public function defPrivate()
63
    {
64
        return $this->defVisibility(ClassGenerator::VISIBILITY_PRIVATE);
65
    }
66
}
67