Completed
Pull Request — master (#2)
by Emily
02:14
created

AbstractSet::offsetSet()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 11
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 6
1
<?php
2
/**
3
 * This file is part of the Composite Utils package.
4
 *
5
 * (c) Emily Shepherd <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the
8
 * LICENSE.md file that was distributed with this source code.
9
 *
10
 * @package spaark/composite-utils
11
 * @author Emily Shepherd <[email protected]>
12
 * @license MIT
13
 */
14
15
namespace Spaark\CompositeUtils\Model\Collection;
16
17
/**
18
 * Represents an abstract collection which acts as a list of items
19
 */
20
abstract class AbstractSet
21
    extends AbstractCollection
0 ignored issues
show
Coding Style introduced by
The extends keyword must be on the same line as the class name
Loading history...
Coding Style introduced by
Expected 0 spaces between "AbstractCollection" and comma; 1 found
Loading history...
22
    implements SetInterface
0 ignored issues
show
Coding Style introduced by
The implements keyword must be on the same line as the class name
Loading history...
23
{
24
    /**
25
     * {@inheritDoc}
26
     */
27
    public function offsetSet($offset, $value)
28
    {
29
        if ($offset === null)
30
        {
31
            $this->push($value);
0 ignored issues
show
Bug introduced by
The method push() does not seem to exist on object<Spaark\CompositeU...Collection\AbstractSet>.

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...
32
        }
33
        else
34
        {
35
            throw new \Exception();
36
        }
37
    }
38
39
    /**
40
     * {@inheritDoc}
41
     */
42
    public function offsetUnset($index)
43
    {
44
        throw new \Exception();
45
    }
46
47
    /**
48
     * {@inheritDoc}
49
     */
50
    public function offsetExists($index)
51
    {
52
        throw new \Exception();
53
    }
54
55
    /**
56
     * {@inheritDoc}
57
     */
58
    public function offsetGet($index)
59
    {
60
        throw new \Exception();
61
    }
62
}
63
64