Passed
Push — master ( 35c21b...a82c2e )
by SignpostMarv
12:21
created

AcceptedPaymentMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A GetAcceptedPaymentMethod() 0 12 1
A SetAcceptedPaymentMethod() 0 8 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\Intangible\Enumeration\PaymentMethod;
10
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Service\FinancialProduct\LoanOrCredit;
11
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities;
12
13
trait AcceptedPaymentMethod
14
{
15
    use DaftObjectTrait;
16
17
    /**
18
    * @return array<int, LoanOrCredit|PaymentMethod>
19
    */
20 88
    public function GetAcceptedPaymentMethod() : array
21
    {
22
        /**
23
        * @var array<int, LoanOrCredit|PaymentMethod>
24
        */
25 88
        $out = TypeUtilities::ExpectRetrievedValueIsArray(
26 88
            'acceptedPaymentMethod',
27 88
            $this->RetrievePropertyValueFromData('acceptedPaymentMethod'),
0 ignored issues
show
Bug introduced by
It seems like RetrievePropertyValueFromData() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
            $this->/** @scrutinizer ignore-call */ 
28
                   RetrievePropertyValueFromData('acceptedPaymentMethod'),
Loading history...
28 88
            static::class
29
        );
30
31 88
        return $out;
32
    }
33
34
    /**
35
    * @param array<int, LoanOrCredit|PaymentMethod> $value
36
    */
37 2
    public function SetAcceptedPaymentMethod(array $value) : void
38
    {
39 2
        $this->NudgePropertyWithUniqueValuesOfThings(
40 2
            'acceptedPaymentMethod',
41 2
            __METHOD__,
42 2
            $value,
43 2
            LoanOrCredit::class,
44 2
            PaymentMethod::class
45
        );
46 2
    }
47
}
48