Completed
Push — master ( cf2b70...0b1628 )
by Gaetano
06:47
created

MigrationAbortedException::__construct()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.2
c 0
b 0
f 0
cc 4
eloc 4
nc 2
nop 3
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
    public function __construct($message = "", $status = Migration::STATUS_DONE, \Exception $previous = null)
13
    {
14
        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
        parent::__construct($message, $status, $previous);
19
    }
20
}
21