ImageObject::GetRepresentativeOfPage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 12
ccs 6
cts 6
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
* @author SignpostMarv
4
*/
5
declare(strict_types=1);
6
7
namespace SignpostMarv\DaftObject\SchemaOrg\CreativeWork\MediaObject;
8
9
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork\MediaObject;
10
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits;
11
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\PropertyValue;
12
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
13
14
/**
15
* @property array<int, string> $caption
16
* @property array<int, string|PropertyValue> $exifData
17
* @property array<int, bool> $representativeOfPage
18
* @property array<int, MediaObject\ImageObject> $thumbnail
19
*/
20
class ImageObject extends MediaObject
21
{
22
    use DaftObjectTraits\HasCaption;
23
    use DaftObjectTraits\HasThumbnail;
24
25
    const SCHEMA_ORG_TYPE = 'ImageObject';
26
27
    const PROPERTIES = [
28
        'caption',
29
        'exifData',
30
        'representativeOfPage',
31
        'thumbnail',
32
    ];
33
34
    const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [
35
        'caption' => [
36
            'string',
37
        ],
38
        'exifData' => [
39
            'string',
40
            PropertyValue::class,
41
        ],
42
        'representativeOfPage' => [
43
            'boolean',
44
        ],
45
        'thumbnail' => [
46
            MediaObject\ImageObject::class,
47
        ],
48
    ];
49
50
    /**
51
    * @return array<int, string|PropertyValue>
52
    */
53 129
    public function GetExifData() : array
54
    {
55
        /**
56
        * @var array<int, string|PropertyValue>
57
        */
58 129
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
59 129
            'exifData',
60 129
            $this->RetrievePropertyValueFromData('exifData'),
61 129
            static::class
62
        );
63
64 129
        return $out;
65
    }
66
67
    /**
68
    * @param array<int, string|PropertyValue> $value
69
    */
70 1
    public function SetExifData(array $value) : void
71
    {
72 1
        $this->NudgePropertyValue(
73 1
            'exifData',
74 1
            $value,
75 1
            self::BOOL_DEFAULT_AUTOTRIMSTRINGS
76
        );
77 1
    }
78
79
    /**
80
    * @return array<int, bool>
81
    */
82 129
    public function GetRepresentativeOfPage() : array
83
    {
84
        /**
85
        * @var array<int, bool>
86
        */
87 129
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
88 129
            'representativeOfPage',
89 129
            $this->RetrievePropertyValueFromData('representativeOfPage'),
90 129
            static::class
91
        );
92
93 129
        return $out;
94
    }
95
96
    /**
97
    * @param array<int, bool> $value
98
    */
99 1
    public function SetRepresentativeOfPage(array $value) : void
100
    {
101 1
        $this->NudgePropertyWithUniqueBooleans(
102 1
            'representativeOfPage',
103 1
            $value
104
        );
105 1
    }
106
}
107