MetaParser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
c 0
b 0
f 0
dl 0
loc 12
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Swis\JsonApi\Client\Parsers;
6
7
use Swis\JsonApi\Client\Exceptions\ValidationException;
8
use Swis\JsonApi\Client\Meta;
9
10
/**
11
 * @internal
12
 */
13
class MetaParser
14
{
15
    /**
16
     * @param  mixed  $data
17
     */
18 104
    public function parse($data): Meta
19
    {
20 104
        if (! is_object($data)) {
21 24
            throw new ValidationException(sprintf('Meta MUST be an object, "%s" given.', gettype($data)));
22
        }
23
24 80
        return new Meta((array) $data);
25
    }
26
}
27