Passed
Push — master ( deb522...4fcdf3 )
by Gabriel
02:32
created

CheckLoadedFunctionsTrait::offsetSet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 4
rs 10
ccs 3
cts 3
cp 1
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Nip\Collections\Lazy\Traits;
4
5
/**
6
 * Trait CheckLoadedFunctionsTrait
7
 * @package Nip\Collections\Lazy\Traits
8
 * @internal
9
 */
10
trait CheckLoadedFunctionsTrait
11
{
12
    /**
13
     * @inheritDoc
14
     */
15 1
    public function offsetSet($key, $value)
16
    {
17 1
        $this->load();
0 ignored issues
show
Bug introduced by
It seems like load() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        $this->/** @scrutinizer ignore-call */ 
18
               load();
Loading history...
18 1
        return parent::offsetSet($key, $value);
19
    }
20
21
    /**
22
     * @inheritDoc
23
     */
24
    public function offsetGet($key)
25
    {
26
        $this->load();
27
        return parent::offsetGet($key);
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33
    public function offsetExists($key)
34
    {
35
        $this->load();
36
        return parent::offsetExists($key);
37
    }
38
39
    /**
40
     * @inheritDoc
41
     */
42
    public function offsetUnset($key)
43
    {
44
        $this->load();
45
        return parent::offsetUnset($key);
46
    }
47
48
    /**
49
     * @inheritDoc
50
     */
51
    public function filter(callable $callback = null)
52
    {
53
        $this->load();
54
        return parent::filter($callback);
55
    }
56
57
58
    /**
59
     * @inheritDoc
60
     */
61 2
    public function count()
62
    {
63 2
        $this->load();
64 2
        return parent::count();
65
    }
66
}