Passed
Push — master ( c81968...b18996 )
by Maximilian
01:27 queued 12s
created

PropertyHelper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 3
c 1
b 0
f 0
dl 0
loc 22
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A checkNullValueString() 0 3 2
A checkNullValueInt() 0 3 2
1
<?php
2
3
namespace MaxBeckers\AmazonAlexa\Helper;
4
5
/**
6
 * This helper class simplifies the property handling.
7
 *
8
 * @author Maximilian Beckers <[email protected]>
9
 */
10
class PropertyHelper
11
{
12
    /**
13
     * @param array  $data
14
     * @param string $key
15
     *
16
     * @return string|null
17
     */
18 46
    public static function checkNullValueString(array $data, string $key)
19
    {
20 46
        return isset($data[$key]) ? $data[$key] : null;
21
    }
22
23
    /**
24
     * @param array  $data
25
     * @param string $key
26
     *
27
     * @return int|null
28
     */
29 25
    public static function checkNullValueInt(array $data, string $key)
30
    {
31 25
        return isset($data[$key]) ? $data[$key] : null;
32
    }
33
}
34