Completed
Push — master ( bfd868...ee3a72 )
by Vincent
12:29 queued 10:26
created

AssertAttributesObject   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A assertIsValidAttributesObject() 0 11 2
1
<?php
2
namespace VGirol\JsonApiAssert\Asserts;
3
4
use VGirol\JsonApiAssert\Messages;
5
6
trait AssertAttributesObject
7
{
8
    /**
9
     * Asserts that an attributes object is valid.
10
     *
11
     * @param array $attributes
12
     * 
13
     * @throws PHPUnit\Framework\ExpectationFailedException
14
     */
15 16
    public static function assertIsValidAttributesObject($attributes)
16
    {
17 16
        static::assertIsNotArrayOfObjects(
18 16
            $attributes,
19 16
            Messages::ATTRIBUTES_OBJECT_IS_NOT_ARRAY
20
        );
21
22 14
        static::assertFieldHasNoForbiddenMemberName($attributes);
23
24 13
        foreach ($attributes as $key => $value) {
25 13
            static::assertIsValidMemberName($key);
26
        }
27 11
    }
28
}
29