EncapsulationViolation::getMessage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Solidifier\Defects;
4
5
use Solidifier\Defect;
6
use PhpParser\PrettyPrinter\Standard;
7
use PhpParser\Node\Stmt\Property;
8
9
class EncapsulationViolation extends Defect
10
{
11
    private
12
        $propertyName;
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $propertyName.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
13
    
14
    public function __construct($propertyName, Property $node)
15
    {
16
        parent::__construct($node);
17
    
18
        $this->propertyName = $propertyName;
19
    }
20
    
21
    public function getMessage()
22
    {
23
        return sprintf(
24
            'Both public getter and setter on private property <id>%s</id> is discouraged (encapsulation violation) ',
25
            $this->propertyName
26
        );
27
    }
28
}
29