None   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 10 2
1
<?php
2
3
namespace Spatie\CollectionMacros\Macros;
4
5
/**
6
 * Check whether a collection doesn't contain any occurrences of a given
7
 * item, key-value pair, or passing truth test. `none` accepts the same
8
 * parameters as the `contains` collection method.
9
 *
10
 * @see \Illuminate\Support\Collection::contains
11
 *
12
 * @param mixed $key
13
 * @param mixed $value
14
 *
15
 * @mixin \Illuminate\Support\Collection
16
 *
17
 * @return bool
18
 */
19
class None
20
{
21
    public function __invoke()
22
    {
23
        return function ($key, $value = null): bool {
24
            if (func_num_args() === 2) {
25
                return ! $this->contains($key, $value);
0 ignored issues
show
Bug introduced by Lucas Michot
The method contains() does not seem to exist on object<Spatie\CollectionMacros\Macros\None>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
            }
27
28
            return ! $this->contains($key);
0 ignored issues
show
Bug introduced by Lucas Michot
The method contains() does not seem to exist on object<Spatie\CollectionMacros\Macros\None>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
29
        };
30
    }
31
}
32