ArrayOfOaccTelephone::next()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Gueststream\PMS\IQWare\API;
4
5 View Code Duplication
class ArrayOfOaccTelephone implements \ArrayAccess, \Iterator, \Countable
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
6
{
7
8
    /**
9
     * @var OaccTelephone[] $oaccTelephone
10
     */
11
    protected $oaccTelephone = null;
12
13
    
14
    public function __construct()
15
    {
16
    
17
    }
18
19
    /**
20
     * @return OaccTelephone[]
21
     */
22
    public function getOaccTelephone()
23
    {
24
        return $this->oaccTelephone;
25
    }
26
27
    /**
28
     * @param OaccTelephone[] $oaccTelephone
29
     *
30
*@return \Gueststream\PMS\IQWare\API\ArrayOfOaccTelephone
31
     */
32
    public function setOaccTelephone(array $oaccTelephone = null)
33
    {
34
        $this->oaccTelephone = $oaccTelephone;
0 ignored issues
show
Documentation Bug introduced by
It seems like $oaccTelephone can be null. However, the property $oaccTelephone is declared as array. Maybe change the type of the property to array|null or add a type check?

Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.

To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.

function aContainsB(array $needle = null, array  $haystack) {
    if (!$needle) {
        return false;
    }

    return array_intersect($haystack, $needle) == $haystack;
}

The function can be called with either null or an array for the parameter $needle but will only accept an array as $haystack.

Loading history...
35
        return $this;
36
    }
37
38
    /**
39
     * ArrayAccess implementation
40
     *
41
     * @param mixed $offset An offset to check for
42
     * @return boolean true on success or false on failure
43
     */
44
    public function offsetExists($offset)
45
    {
46
        return isset($this->oaccTelephone[$offset]);
47
    }
48
49
    /**
50
     * ArrayAccess implementation
51
     *
52
     * @param mixed $offset The offset to retrieve
53
     *
54
*@return OaccTelephone
55
     */
56
    public function offsetGet($offset)
57
    {
58
        return $this->oaccTelephone[$offset];
59
    }
60
61
    /**
62
     * ArrayAccess implementation
63
     *
64
     * @param mixed $offset The offset to assign the value to
65
     * @param OaccTelephone $value The value to set
66
     *
67
*@return void
68
     */
69
    public function offsetSet($offset, $value)
70
    {
71
        $this->oaccTelephone[$offset] = $value;
72
    }
73
74
    /**
75
     * ArrayAccess implementation
76
     *
77
     * @param mixed $offset The offset to unset
78
     * @return void
79
     */
80
    public function offsetUnset($offset)
81
    {
82
        unset($this->oaccTelephone[$offset]);
83
    }
84
85
    /**
86
     * Iterator implementation
87
     *
88
     * @return OaccTelephone Return the current element
89
     */
90
    public function current()
91
    {
92
        return current($this->oaccTelephone);
93
    }
94
95
    /**
96
     * Iterator implementation
97
     * Move forward to next element
98
     *
99
     * @return void
100
     */
101
    public function next()
102
    {
103
        next($this->oaccTelephone);
104
    }
105
106
    /**
107
     * Iterator implementation
108
     *
109
     * @return string|null Return the key of the current element or null
110
     */
111
    public function key()
112
    {
113
        return key($this->oaccTelephone);
114
    }
115
116
    /**
117
     * Iterator implementation
118
     *
119
     * @return boolean Return the validity of the current position
120
     */
121
    public function valid()
122
    {
123
        return $this->key() !== null;
124
    }
125
126
    /**
127
     * Iterator implementation
128
     * Rewind the Iterator to the first element
129
     *
130
     * @return void
131
     */
132
    public function rewind()
133
    {
134
        reset($this->oaccTelephone);
135
    }
136
137
    /**
138
     * Countable implementation
139
     *
140
     * @return OaccTelephone Return count of elements
141
     */
142
    public function count()
143
    {
144
        return count($this->oaccTelephone);
145
    }
146
}
147