AssertMetaObject   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertIsValidMetaObject() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VGirol\JsonApiAssert\Asserts\Structure;
6
7
/**
8
 * Assertions relating to the meta object
9
 */
10
trait AssertMetaObject
11
{
12
    /**
13
     * Asserts that a json fragment is a valid meta object.
14
     *
15
     * It will do the following checks :
16
     * 1) asserts that the meta object is not an array of objects (@see assertIsNotArrayOfObjects).
17
     * 2) asserts that each member of the meta object is valid (@see assertIsValidMemberName).
18
     *
19
     * @param array   $json
20
     * @param boolean $strict If true, unsafe characters are not allowed when checking members name.
21
     *
22
     * @return void
23
     * @throws \PHPUnit\Framework\AssertionFailedError
24
     */
25 15
    public static function assertIsValidMetaObject($json, bool $strict): void
26
    {
27 15
        static::askService('validateMetaObject', $json, $strict);
28 3
    }
29
}
30