HasAuthor   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SetAuthor() 0 3 1
A GetAuthor() 0 12 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits;
8
9
use SignpostMarv\DaftObject\SchemaOrg\Organization;
10
use SignpostMarv\DaftObject\SchemaOrg\Person;
11
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
12
13
trait HasAuthor
14
{
15
    use DaftObjectTrait;
16
17
    /**
18
    * @return array<int, Organization|Person>
19
    */
20 223
    public function GetAuthor() : array
21
    {
22
        /**
23
        * @var array<int, Organization|Person>
24
        */
25 223
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
26 223
            'author',
27 223
            $this->RetrievePropertyValueFromData('author'),
28 223
            static::class
29
        );
30
31 223
        return $out;
32
    }
33
34
    /**
35
    * @param array<int, Organization|Person> $value
36
    */
37 30
    public function SetAuthor(array $value) : void
38
    {
39 30
        $this->NudgePropertyValue('author', $value);
40 30
    }
41
}
42