Completed
Push — master ( 74ffa0...ed410a )
by Mariano
10:21
created

ServerError::execute()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 3
Bugs 0 Features 2
Metric Value
c 3
b 0
f 2
dl 0
loc 10
ccs 8
cts 8
cp 1
rs 9.4285
cc 3
eloc 6
nc 2
nop 2
crap 3
1
<?php
2
namespace Mcustiel\PowerRoute\Actions;
3
4
use Mcustiel\PowerRoute\Common\TransactionData;
5
6
class ServerError implements ActionInterface
7
{
8 4
    public function execute(TransactionData $transactionData, $argument = null)
9
    {
10 4
        $argument = (integer) $argument;
11 4
        if ($argument < 500 || $argument >= 600) {
12 3
            $argument = 500;
13 3
        }
14 4
        return $transactionData->setResponse(
15 4
            $transactionData->getResponse()->withStatus($argument)
16 4
        );
17
    }
18
}
19