VisibilityTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 2
cbo 0
dl 0
loc 54
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A defStatic() 0 6 1
A defProtected() 0 4 1
A defVisibility() 0 6 1
A defPrivate() 0 4 1
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 samsonframework\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 5
    public function defStatic()
27
    {
28 5
        $this->isStatic = true;
29
30 5
        return $this;
31
    }
32
33
    /**
34
     * Set protected property visibility.
35
     *
36
     * @return $this
37
     */
38 3
    public function defProtected()
39
    {
40 3
        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 4
    protected function defVisibility(string $visibility)
51
    {
52 4
        $this->visibility = $visibility;
53
54 4
        return $this;
55
    }
56
57
    /**
58
     * Set private property visibility.
59
     *
60
     * @return $this
61
     */
62 1
    public function defPrivate()
63
    {
64 1
        return $this->defVisibility(ClassGenerator::VISIBILITY_PRIVATE);
65
    }
66
}
67