Completed
Pull Request — master (#7)
by ARCANEDEV
04:58
created

DirectoryCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 80%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 23
c 1
b 0
f 0
wmc 3
lcom 0
cbo 2
ccs 4
cts 5
cp 0.8
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A exclude() 0 9 3
1
<?php namespace Arcanesoft\Media\Entities;
2
3
use Illuminate\Support\Collection;
4
use Illuminate\Support\Str;
5
6
/**
7
 * Class     DirectoryCollection
8
 *
9
 * @package  Arcanesoft\Media\Entities
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class DirectoryCollection extends Collection
13
{
14
    /* -----------------------------------------------------------------
15
     |  Main Methods
16
     | -----------------------------------------------------------------
17
     */
18
    /**
19
     * ExcludePattern directories with the given patterns.
20
     *
21
     * @param  array  $patterns
22
     *
23
     * @return self
24
     */
25
    public function exclude(array $patterns)
26
    {
27 6
        return $this->reject(function ($directory) use ($patterns) {
28 6
            foreach ($patterns as $pattern)
29
                if (Str::is($pattern, $directory['path'])) return true;
30
31 6
            return false;
32 6
        });
33
    }
34
}
35