Completed
Push — master ( 554aca...3b1a80 )
by Vincenzo
04:50
created

Action::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 3
1
<?php
2
3
4
namespace App\Lib\Slime\RestAction;
5
6
7
use Psr\Http\Message\RequestInterface;
8
use Psr\Http\Message\ResponseInterface;
9
10
abstract class Action
11
{
12
    protected $args;
13
    protected $request;
14
    protected $response;
15
16
    public function __construct(
17
        RequestInterface $request = null,
18
        ResponseInterface $response = null,
19
        array $args = []
20
    )
21
    {
22
        $this->args = $args;
23
        $this->request = $request;
24
        $this->response = $response;
25
    }
26
27
    public function run()
28
    {
29
        $this->init();
30
        $this->performChecks();
31
        $this->performAction();
32
        $this->performCallBack();
33
        return $this->response;
34
    }
35
36
    protected abstract function init();
37
    protected abstract function performChecks();
38
    protected abstract function performAction();
39
    protected abstract function performCallBack();
40
41
}
42