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

Action   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 32
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A run() 0 8 1
init() 0 1 ?
performChecks() 0 1 ?
performAction() 0 1 ?
performCallBack() 0 1 ?
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