ObjectTypeHintTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertObject() 0 6 2
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of the pinepain/php-object-maps PHP library.
5
 *
6
 * Copyright (c) 2016-2017 Bogdan Padalko <[email protected]>
7
 *
8
 * Licensed under the MIT license: http://opensource.org/licenses/MIT
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code or visit http://opensource.org/licenses/MIT
12
 */
13
14
namespace Pinepain\ObjectMaps;
15
16
17
use function is_object;
18
use Pinepain\ObjectMaps\Exceptions\UnexpectedValueException;
19
20
21
trait ObjectTypeHintTrait
22
{
23 42
    protected function assertObject($value, string $name)
24
    {
25 42
        if (!is_object($value)) {
26 10
            throw new UnexpectedValueException("{$name} is not an object");
27
        }
28 34
    }
29
}
30