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

AbstractExecutor::generateTemplate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
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