AbstractProcessor   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 30
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 1 1
A afterCheckPassed() 0 1 1
A afterCheckFailed() 0 1 1
A __construct() 0 6 1
A getName() 0 8 1
1
<?php
2
3
namespace Sokil\FraudDetector\Processor;
4
5
use Sokil\FraudDetector\Detector;
6
7
abstract class AbstractProcessor implements ProcessorInterface
8
{
9
    /**
10
     *
11
     * @var \Sokil\FraudDetector\Detector
12
     */
13
    protected $detector;
14
15
    protected function init() {}
16
17
    public function __construct(Detector $detector)
18
    {
19
        $this->detector = $detector;
20
21
        $this->init();
22
    }
23
24
    public function getName()
25
    {
26
        $fullyQualifiedClassNameChunks = explode('\\', get_called_class());
27
        $className = array_pop($fullyQualifiedClassNameChunks);
28
29
        // remove "Processor" suffix and lovercase first char
30
        return lcfirst(substr($className, 0, -9));
31
    }
32
33
    public function afterCheckPassed() {}
34
35
    public function afterCheckFailed() {}
36
}