AssertMetaObject::assertIsValidMetaObject()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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