Completed
Pull Request — master (#8)
by ARCANEDEV
05:47
created

DirectoryCollection   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

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 12
        return $this->reject(function ($directory) use ($patterns) {
28 12
            foreach ($patterns as $pattern)
29 12
                if (Str::is($pattern, $directory['path'])) return true;
30
31 12
            return false;
32 12
        });
33
    }
34
}
35