Code Duplication    Length = 11-13 lines in 3 locations

src/WebHemi/Data/Entity/EntitySet.php 3 locations

@@ 41-51 (lines=11) @@
38
     * @throws InvalidArgumentException
39
     * @return bool
40
     */
41
    public function offsetExists($offset) : bool
42
    {
43
        if (!is_int($offset)) {
44
            throw new InvalidArgumentException(
45
                sprintf(__METHOD__.' requires parameter 1 to be integer, %s given.', gettype($offset)),
46
                1000
47
            );
48
        }
49
50
        return isset($this->container[$offset]);
51
    }
52
53
    /**
54
     * Returns the value at an offset.
@@ 60-70 (lines=11) @@
57
     * @throws InvalidArgumentException
58
     * @return null|EntityInterface
59
     */
60
    public function offsetGet($offset)
61
    {
62
        if (!is_int($offset)) {
63
            throw new InvalidArgumentException(
64
                sprintf(__METHOD__.' requires parameter 1 to be integer, %s given.', gettype($offset)),
65
                1001
66
            );
67
        }
68
69
        return $this->container[$offset] ?? null;
70
    }
71
72
    /**
73
     * Sets a value for an offset. It appends it if offset is Null.
@@ 110-122 (lines=13) @@
107
     * @param mixed $offset
108
     * @throws InvalidArgumentException
109
     */
110
    public function offsetUnset($offset) : void
111
    {
112
        if (!is_int($offset)) {
113
            throw new InvalidArgumentException(
114
                sprintf(__METHOD__.' requires parameter 1 to be integer, %s given.', gettype($offset)),
115
                1004
116
            );
117
        }
118
119
        if ($this->offsetExists($offset)) {
120
            unset($this->container[$offset]);
121
        }
122
    }
123
124
    /**
125
     * Rewinds the Iterator to the first element.