Psr7MiddlewareAction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 23
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 14 2
1
<?php
2
3
namespace Mcustiel\PowerRoute\Actions;
4
5
use Mcustiel\PowerRoute\Common\TransactionData;
6
use Mcustiel\PowerRoute\Common\Conditions\ClassArgumentObject;
7
8
class Psr7MiddlewareAction implements ActionInterface
9
{
10
    /**
11
     * Executes a PSR-7 middleware.
12
     *
13
     * @param \Mcustiel\PowerRoute\Common\TransactionData                $transactionData
14
     * @param \Mcustiel\PowerRoute\Common\Conditions\ClassArgumentObject $argument
15
     */
16 3
    public function execute(TransactionData $transactionData, $argument = null)
17
    {
18 3
        if ($argument instanceof ClassArgumentObject) {
19 3
            $middleware = $argument->getInstance();
20
21 3
            $transactionData->setResponse(
22 3
                $middleware(
23 3
                    $transactionData->getRequest(),
24 3
                    $transactionData->getResponse(),
25 3
                    $argument->getArgument()
26 3
                )
27 3
            );
28 3
        }
29 3
    }
30
}
31