ArrayableTrait   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 68
rs 10
c 1
b 0
f 1

7 Methods

Rating   Name   Duplication   Size   Complexity  
A offsetExists() 0 4 1
A offsetGet() 0 4 1
A offsetSet() 0 4 1
A getIterator() 0 4 1
A count() 0 4 1
A jsonSerialize() 0 4 1
A offsetUnset() 0 4 1
1
<?php
2
namespace Michaels\Manager\Traits;
3
4
use ArrayIterator;
5
6
/**
7
 * Class ArrayableTrait
8
 * @package Michaels\Manager\Traits
9
 */
10
trait ArrayableTrait
11
{
12
    use DependsOnManagesItemsTrait;
13
14
    /**
15
     * @implements ArrayAccess
16
     * @param $offset
17
     * @return bool
18
     */
19
    public function offsetExists($offset)
20
    {
21
        return $this->exists($offset);
22
    }
23
24
    /**
25
     * @implements ArrayAccess
26
     * @param $offset
27
     * @return mixed
28
     */
29
    public function offsetGet($offset)
30
    {
31
        return $this->get($offset);
32
    }
33
34
    /**
35
     * @implements ArrayAccess
36
     * @param $offset
37
     * @param $value
38
     */
39
    public function offsetSet($offset, $value)
40
    {
41
        $this->set($offset, $value);
42
    }
43
44
    /**
45
     * @implements ArrayAccess
46
     * @param $offset
47
     */
48
    public function offsetUnset($offset)
49
    {
50
        $this->remove($offset);
51
    }
52
53
    /**
54
     * @implements IteratorAggregate
55
     */
56
    public function getIterator()
57
    {
58
        return new ArrayIterator($this->getAll());
59
    }
60
61
    /**
62
     * @implements Countable
63
     */
64
    public function count()
65
    {
66
        return count($this->getAll());
67
    }
68
69
    /**
70
     * @implements JSONSerializable
71
     * @return array
72
     */
73
    public function jsonSerialize()
74
    {
75
        return $this->getAll();
76
    }
77
}
78