Completed
Push — master ( 0e291a...511168 )
by Ievgen
05:31
created

functions.php ➔ isError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace einfach\operation\response;
4
5
const RESPONSE_TYPE_OK = 'ok_step_response';
6
const RESPONSE_TYPE_ERROR = 'error_step_response';
7
8
function ok($appendParams = [])
9
{
10 1
    return ['type' => RESPONSE_TYPE_OK, 'appendParams' => $appendParams];
11
}
12
13
function error($appendError = [])
14
{
15 1
    return ['type' => RESPONSE_TYPE_ERROR, 'appendError' => $appendError];
16
}
17
18
function isOk($type)
19
{
20 2
    return $type == RESPONSE_TYPE_OK;
21
}
22
23
function isError($type)
24
{
25 2
    return $type == RESPONSE_TYPE_ERROR;
26
}
27
28
function isValidResponse($response)
29
{
30 4
    return is_array($response) && isset($response['type']);
31
}
32