CommandFactory::createFromAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Nip\Dispatcher\Commands;
4
5
use Nip\Dispatcher\Exceptions\ForwardException;
6
use Psr\Http\Message\ServerRequestInterface;
7
8
/**
9
 * Class CommandFactory
10
 * @package Nip\Dispatcher\Commands
11
 */
12
class CommandFactory
13
{
14
    /**
15
     * @param $action
16
     * @return Command
17
     */
18
    public static function createFromAction($action): Command
19
    {
20
        $command = new Command();
21
        $command->setAction($action);
22
        return $command;
23
    }
24
25
    /**
26
     * @param ServerRequestInterface|null $request
27
     * @return Command
28
     */
29
    public static function createFromRequest(ServerRequestInterface $request): Command
30
    {
31
        $command = new Command();
32
        $command->setRequest($request);
33
        return $command;
34
    }
35
36
    /**
37
     * @param ForwardException $exception
38
     * @return Command
39
     */
40
    public static function createFromForwardException(ForwardException $exception)
0 ignored issues
show
Unused Code introduced by
The parameter $exception is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

40
    public static function createFromForwardException(/** @scrutinizer ignore-unused */ ForwardException $exception)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
41
    {
42
        $command = new Command();
43
        return $command;
44
    }
45
}
46