GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ValueObjectComplex::guard()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DBUnt1tled\VO\VObjects;
6
7
use DBUnt1tled\VO\Exception\InvalidVOArgumentException;
8
9
abstract class ValueObjectComplex extends ValueObject
10
{
11
12
    /**
13
     * @param mixed $value
14
     * @param mixed ...$other
15
     * @throws \ReflectionException
16
     */
17 25
    public function guard($value, ...$other): void
18
    {
19 25
        if (!$value instanceof ValueObjectInterface) {
20 1
            throw new InvalidVOArgumentException(sprintf('%s cannot create by base type.', $this->getReflection()->getShortName()), $this->value);
21
        }
22 24
    }
23
24
    /**
25
     * @return mixed
26
     */
27 11
    public function getValue()
28
    {
29
        /** @var ValueObjectInterface $vo */
30 11
        $vo = parent::getValue();
31 11
        return $vo->getValue();
32
    }
33
34
    /**
35
     * @return string
36
     */
37 2
    public function __toString(): string
38
    {
39 2
        $vo = $this->getValue();
40 2
        if (is_scalar($vo)) {
41 1
            return (string)$vo;
42
        }
43 1
        return (string)json_encode($vo, 320);
44
    }
45
}
46