Passed
Push — master ( 9ea830...49221b )
by Petr
08:01
created

TCheckModes   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 12
ccs 3
cts 3
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkSupportedModes() 0 4 2
1
<?php
2
3
namespace kalanis\kw_files\Traits;
4
5
6
use kalanis\kw_files\FilesException;
7
8
9
/**
10
 * trait TCheckModes
11
 * @package kalanis\kw_files\Traits
12
 */
13
trait TCheckModes
14
{
15
    use TLang;
16
17
    /**
18
     * @param int<0, max> $mode
19
     * @throws FilesException
20
     */
21 28
    protected function checkSupportedModes(int $mode): void
22
    {
23 28
        if (!in_array($mode, [0, FILE_APPEND])) {
24 2
            throw new FilesException($this->getFlLang()->flBadMode($mode));
25
        }
26 26
    }
27
}
28