TVolumeFiles   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A filesExtCallback() 0 4 3
1
<?php
2
3
namespace kalanis\kw_tree\Traits;
4
5
6
use kalanis\kw_paths\Stuff;
7
use SplFileInfo;
8
9
10
/**
11
 * Trait TVolumeFiles
12
 * @package kalanis\kw_tree\Traits
13
 * Prepared callbacks for usage with data sources
14
 * Return nodes identified as dirs or files with predefined ext; use with deep tree lookup
15
 */
16
trait TVolumeFiles
17
{
18 3
    public function filesExtCallback(SplFileInfo $node): bool
19
    {
20 3
        $ext = Stuff::fileExt($node->getFileName());
21 3
        return $node->isDir() || ($node->isFile() && in_array($ext, $this->whichExtsIWant()));
22
    }
23
24
    /**
25
     * @return string[]
26
     */
27
    abstract protected function whichExtsIWant(): array;
28
}
29