Property   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 2 Features 0
Metric Value
wmc 9
c 4
b 2
f 0
lcom 1
cbo 2
dl 0
loc 49
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubNodeNames() 0 3 1
A isPublic() 0 4 2
A isProtected() 0 3 1
A isStatic() 0 3 1
A isPrivate() 0 3 1
A __construct() 0 13 3
1
<?php
2
3
namespace PhpParser\Node\Stmt;
4
5
use PhpParser\Node;
6
use PhpParser\Error;
7
8
class Property extends Node\Stmt
9
{
10
    /** @var int Modifiers */
11
    public $type;
12
    /** @var PropertyProperty[] Properties */
13
    public $props;
14
15
    /**
16
     * Constructs a class property list node.
17
     *
18
     * @param int                $type       Modifiers
19
     * @param PropertyProperty[] $props      Properties
20
     * @param array              $attributes Additional attributes
21
     */
22
    public function __construct($type, array $props, array $attributes = array()) {
23
        if ($type & Class_::MODIFIER_ABSTRACT) {
24
            throw new Error('Properties cannot be declared abstract');
25
        }
26
27
        if ($type & Class_::MODIFIER_FINAL) {
28
            throw new Error('Properties cannot be declared final');
29
        }
30
31
        parent::__construct($attributes);
32
        $this->type = $type;
33
        $this->props = $props;
34
    }
35
36
    public function getSubNodeNames() {
37
        return array('type', 'props');
38
    }
39
40
    public function isPublic() {
41
        return ($this->type & Class_::MODIFIER_PUBLIC) !== 0
42
            || ($this->type & Class_::VISIBILITY_MODIFER_MASK) === 0;
43
    }
44
45
    public function isProtected() {
46
        return (bool) ($this->type & Class_::MODIFIER_PROTECTED);
47
    }
48
49
    public function isPrivate() {
50
        return (bool) ($this->type & Class_::MODIFIER_PRIVATE);
51
    }
52
53
    public function isStatic() {
54
        return (bool) ($this->type & Class_::MODIFIER_STATIC);
55
    }
56
}
57