Completed
Push — master ( 2824ad...f222c1 )
by Joachim
12:43
created

Payload::assertInArray()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 8
loc 8
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
crap 2
1
<?php
2
namespace Loevgaard\AltaPay\Payload;
3
4
abstract class Payload implements PayloadInterface
5
{
6
    /**
7
     * @inheritdoc
8
     */
9
    public function getPayload(): array
10
    {
11 3
        return [];
12
    }
13 3
14
    /**
15
     * This method will remove null values from the input array
16
     *
17
     * @param array $payload
18
     * @return array
19
     */
20
    protected function cleanPayload(array $payload) : array
21
    {
22 6
        foreach ($payload as $k => $v) {
23
            if ($v === null) {
24 6
                unset($payload[$k]);
25 6
            }
26 6
        }
27 4
28 4
        return $payload;
29
    }
30
}
31