Passed
Push — master ( 439e24...8d28ce )
by SignpostMarv
11:20
created

MusicGroup   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 36
dl 0
loc 83
ccs 26
cts 26
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A GetAlbum() 0 12 1
A SetTrack() 0 8 1
A SetAlbum() 0 7 1
A GetTrack() 0 12 1
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg\Organization\PerformingGroup;
8
9
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\MusicPlaylist\MusicAlbum;
10
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\MusicRecording;
11
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits;
12
use SignpostMarv\DaftObject\SchemaOrg\Intangible\ItemList;
13
use SignpostMarv\DaftObject\SchemaOrg\Organization\PerformingGroup as Base;
14
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
15
16
/**
17
* @property array<int, MusicAlbum> $album
18
* @property array<int, string> $genre
19
* @property array<int, ItemList|MusicRecording> $track
20
*/
21
class MusicGroup extends Base
22
{
23
    use DaftObjectTraits\Genre;
24
25
    const SCHEMA_ORG_TYPE = 'MusicGroup';
26
27
    const PROPERTIES = [
28
        'album',
29
        'genre',
30
        'track',
31
    ];
32
33
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
34
        'album' => [
35
            MusicAlbum::class,
36
        ],
37
        'genre' => [
38
            'string',
39
        ],
40
        'track' => [
41
            ItemList::class,
42
            MusicRecording::class,
43
        ],
44
    ];
45
46
    /**
47
    * @return array<int, MusicAlbum>
48
    */
49 7
    public function GetAlbum() : array
50
    {
51
        /**
52
        * @var array<int, MusicAlbum>
53
        */
54 7
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
55 7
            'album',
56 7
            $this->RetrievePropertyValueFromData('album'),
57 7
            static::class
58
        );
59
60 7
        return $out;
61
    }
62
63
    /**
64
    * @param array<int, MusicAlbum> $value
65
    */
66 1
    public function SetAlbum(array $value) : void
67
    {
68 1
        $this->NudgePropertyWithUniqueValuesOfThings(
69 1
            'album',
70 1
            __METHOD__,
71 1
            $value,
72 1
            MusicAlbum::class
73
        );
74 1
    }
75
76
    /**
77
    * @return array<int, ItemList|MusicRecording>
78
    */
79 7
    public function GetTrack() : array
80
    {
81
        /**
82
        * @var array<int, ItemList|MusicRecording>
83
        */
84 7
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
85 7
            'track',
86 7
            $this->RetrievePropertyValueFromData('track'),
87 7
            static::class
88
        );
89
90 7
        return $out;
91
    }
92
93
    /**
94
    * @param array<int, ItemList|MusicRecording> $value
95
    */
96 1
    public function SetTrack(array $value) : void
97
    {
98 1
        $this->NudgePropertyWithUniqueValuesOfThings(
99 1
            'track',
100 1
            __METHOD__,
101 1
            $value,
102 1
            ItemList::class,
103 1
            MusicRecording::class
104
        );
105 1
    }
106
}
107