Completed
Branch master (e35419)
by Gaetano
06:40
created

MigrationAbortedException::__construct()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 4.25

Importance

Changes 0
Metric Value
cc 4
eloc 3
nc 2
nop 3
dl 0
loc 7
ccs 3
cts 4
cp 0.75
crap 4.25
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Kaliop\eZMigrationBundle\API\Exception;
4
5
use Kaliop\eZMigrationBundle\API\Value\Migration;
6
7
/**
8
 * Throw this exception in any step to abort the migration and mark it as finished in either DONE or SKIPPED status
9
 */
10
class MigrationAbortedException extends \Exception
11
{
12 3
    public function __construct($message = "", $status = Migration::STATUS_DONE, \Exception $previous = null)
13
    {
14 3
        if ($status !== Migration::STATUS_DONE && $status !== Migration::STATUS_SKIPPED && $status !== Migration::STATUS_FAILED) {
15
            throw new \Exception("Unsupported migration status $status in MigrationAbortedException");
16
        }
17
18 3
        parent::__construct($message, $status, $previous);
19 3
    }
20
}
21