Passed
Push — master ( b1a1ed...6d9281 )
by Darko
11:24
created

FileCompletionStatus   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isComplete() 0 3 1
A description() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Enums;
6
7
/**
8
 * Binary file completion status during collection processing.
9
 */
10
enum FileCompletionStatus: int
11
{
12
    /** File/binary is still incomplete (missing parts) */
13
    case Incomplete = 0;
14
15
    /** File/binary has all parts */
16
    case Complete = 1;
17
18
    /**
19
     * Get human-readable description.
20
     */
21
    public function description(): string
22
    {
23
        return match ($this) {
24
            self::Incomplete => 'Incomplete',
25
            self::Complete => 'Complete',
26
        };
27
    }
28
29
    /**
30
     * Check if file is complete.
31
     */
32
    public function isComplete(): bool
33
    {
34
        return $this === self::Complete;
35
    }
36
}
37
38