TSubPart   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A isSubPart() 0 9 3
1
<?php
2
3
namespace kalanis\kw_files\Traits;
4
5
6
/**
7
 * Trait TSubPart
8
 * @package kalanis\kw_files\Traits
9
 * Is path sub-part of another?
10
 */
11
trait TSubPart
12
{
13
    /**
14
     * @param string[] $what
15
     * @param string[] $in
16
     * @return bool
17
     */
18 51
    protected function isSubPart(array $what, array $in): bool
19
    {
20 51
        $compare = intval(min(count($what), count($in)));
21 51
        for ($i = 0; $i<$compare; $i++) {
22 49
            if ($what[$i] != $in[$i]) {
23 38
                return false;
24
            }
25
        }
26 13
        return true;
27
    }
28
}
29