Completed
Pull Request — master (#91)
by
unknown
07:04
created

AbstractExecutor   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
dl 0
loc 27
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1
ccs 5
cts 6
cp 0.8333
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A supportedTypes() 0 4 1
A execute() 0 6 2
A generateTemplate() 0 4 1
1
<?php
2
3
namespace Kaliop\eZMigrationBundle\Core\Executor;
4
5
use Kaliop\eZMigrationBundle\API\Value\MigrationStep;
6
use Kaliop\eZMigrationBundle\API\ExecutorInterface;
7
8
abstract class AbstractExecutor implements ExecutorInterface
9
{
10
    protected $supportedStepTypes = array();
11
12 20
    public function supportedTypes()
13
    {
14 20
        return $this->supportedStepTypes;
15
    }
16
17
    /**
18
     * IT IS MANDATORY TO OVERRIDE THIS IN SUBCLASSES
19
     * @param MigrationStep $step
20
     * @return mixed
21
     * @throws \Exception
22 12
     */
23
    public function execute(MigrationStep $step)
24 12
    {
25
        if (!in_array($step->type, $this->supportedStepTypes)) {
26
            throw new \Exception("Something is wrong! Executor can not work on step of type '{$step->type}'");
27 12
        }
28
    }
29
30
    public function generateTemplate($identifier)
31
    {
32
        throw new \Exception("Executor can not generate a template");
33
    }
34
}
35