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

AbstractSet   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 43
ccs 0
cts 23
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A offsetSet() 0 11 2
A offsetUnset() 0 4 1
A offsetExists() 0 4 1
A offsetGet() 0 4 1
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