MigrationStatus::isMigrationStatusValid()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 14
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
namespace Triadev\EsMigration\Business\Mapper;
3
4
class MigrationStatus
5
{
6
    const MIGRATION_STATUS_WAIT = 0;
7
    const MIGRATION_STATUS_RUNNING = 1;
8
    const MIGRATION_STATUS_DONE = 2;
9
    const MIGRATION_STATUS_ERROR = 3;
10
    
11
    /**
12
     * Is migration status valid
13
     *
14
     * @param int $status
15
     * @return bool
16
     */
17 27
    public function isMigrationStatusValid(int $status) : bool
18
    {
19
        $valid = [
20 27
            self::MIGRATION_STATUS_WAIT,
21 27
            self::MIGRATION_STATUS_RUNNING,
22 27
            self::MIGRATION_STATUS_DONE,
23 27
            self::MIGRATION_STATUS_ERROR
24
        ];
25
        
26 27
        if (in_array($status, $valid)) {
27 27
            return true;
28
        }
29
        
30 2
        return false;
31
    }
32
}
33