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   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 24
ccs 11
cts 11
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 3
A getReferenceValue() 0 7 1
A hasReference() 0 4 2
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