Passed
Push — main ( 2bf33d...adc87c )
by Gaetano
08:33
created

AbstractExecutor::parseReferenceDefinition()   A

Complexity

Conditions 6
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 6

Importance

Changes 0
Metric Value
cc 6
eloc 5
c 0
b 0
f 0
nc 3
nop 2
dl 0
loc 9
ccs 6
cts 6
cp 1
crap 6
rs 9.2222
1
<?php
2
3
namespace Kaliop\eZMigrationBundle\Core\Executor;
4
5
use Kaliop\eZMigrationBundle\API\Exception\InvalidStepDefinitionException;
6
use Kaliop\eZMigrationBundle\API\Value\MigrationStep;
7
use Kaliop\eZMigrationBundle\API\ExecutorInterface;
8
9
abstract class AbstractExecutor implements ExecutorInterface
10
{
11
    /// @todo not all subclasses of this do set references. We should move the trait to a dedicated subcalss
12
    use ReferenceSetterTrait;
13 149
14
    protected $supportedStepTypes = array();
15 149
16
    public function supportedTypes()
17
    {
18
        return $this->supportedStepTypes;
19
    }
20
21
    /**
22
     * IT IS MANDATORY TO OVERRIDE THIS IN SUBCLASSES
23
     * @param MigrationStep $step
24 85
     * @return mixed
25
     * @throws InvalidStepDefinitionException
26 85
     */
27
    public function execute(MigrationStep $step)
28
    {
29 85
        if (!in_array($step->type, $this->supportedStepTypes)) {
30
            throw new InvalidStepDefinitionException("Something is wrong! Executor can not work on step of type '{$step->type}'");
31
        }
32
    }
33
}
34