AbstractScalar::content()   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 DeGraciaMathieu\FreezeMyScalar;
4
5
abstract class AbstractScalar
6
{
7
    /**
8
     * @var mixed
9
     */
10
    protected $content = null;
11
12
    /**
13
     * @param mixed $content
14
     * @throws \DeGraciaMathieu\FreezeMyScalar\Exceptions\CheckerException
15
     */
16 3
    public function __construct($content)
17
    {
18 3
        Checker::passes($this->rule, $content);
0 ignored issues
show
Bug introduced by
The property rule does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
19
20 2
        $this->content = $content;
21 2
    }
22
23
    /**
24
     * @return return mixed
25
     */
26 2
    public function content()
27
    {
28 2
        return $this->content;
29
    }
30
}
31