FileCollection   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

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