Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — 0.9 ( 7d978d...1ce8ac )
by Henrique
07:01 queued 01:39
created

Attribute::__construct()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 3
eloc 4
nc 2
nop 3
crap 3
1
<?php
2
namespace Respect\Validation\Rules;
3
4
use ReflectionProperty;
5
use Respect\Validation\Exceptions\ComponentException;
6
use Respect\Validation\Validatable;
7
8
class Attribute extends AbstractRelated
9
{
10 16
    public function __construct($reference, Validatable $validator = null, $mandatory = true)
11
    {
12 16
        if (!is_string($reference) || empty($reference)) {
13 3
            throw new ComponentException('Invalid attribute/property name');
14
        }
15
16 13
        parent::__construct($reference, $validator, $mandatory);
17 13
    }
18
19 8
    public function getReferenceValue($input)
20
    {
21 8
        $propertyMirror = new ReflectionProperty($input, $this->reference);
22 8
        $propertyMirror->setAccessible(true);
23
24 8
        return $propertyMirror->getValue($input);
25
    }
26
27 13
    public function hasReference($input)
28
    {
29 13
        return is_object($input) && property_exists($input, $this->reference);
30
    }
31
}
32