PropertyOperation::getReason()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace PHPSemVerChecker\Operation;
4
5
use PhpParser\Node\Stmt;
6
7
abstract class PropertyOperation extends Operation
8
{
9
	/**
10
	 * @var string
11
	 */
12
	protected $context;
13
	/**
14
	 * @var int
15
	 */
16
	protected $visibility;
17
18
	/**
19
	 * @return string
20
	 */
21 4
	public function getCode()
22
	{
23 4
		return $this->code[$this->context][Visibility::get($this->visibility)];
24
	}
25
26
	/**
27
	 * @return string
28
	 */
29 4
	public function getReason()
30
	{
31 4
		return '[' . Visibility::toString($this->visibility) . '] ' . $this->reason;
32
	}
33
34
	/**
35
	 * @param \PhpParser\Node\Stmt $context
36
	 * @return int
37
	 */
38 4
	protected function getVisibility(Stmt $context)
39
	{
40 4
		return Visibility::getForContext($context);
41
	}
42
}
43