Completed
Push — master ( 3b7d13...36c690 )
by David
28s queued 12s
created

EmptyInnerResultIterator::offsetExists()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
4
namespace TheCodingMachine\TDBM;
5
6
use Iterator;
7
8
/**
9
 * @internal
10
 */
11
class EmptyInnerResultIterator implements Iterator, InnerResultIteratorInterface
12
{
13
14
    /**
15
     * Return the current element
16
     * @link https://php.net/manual/en/iterator.current.php
17
     * @return mixed Can return any type.
18
     * @since 5.0.0
19
     */
20
    public function current()
21
    {
22
        return null;
23
    }
24
25
    /**
26
     * Move forward to next element
27
     * @link https://php.net/manual/en/iterator.next.php
28
     * @return void Any returned value is ignored.
29
     * @since 5.0.0
30
     */
31
    public function next()
32
    {
33
    }
34
35
    /**
36
     * Return the key of the current element
37
     * @link https://php.net/manual/en/iterator.key.php
38
     * @return mixed scalar on success, or null on failure.
39
     * @since 5.0.0
40
     */
41
    public function key()
42
    {
43
        return null;
44
    }
45
46
    /**
47
     * Checks if current position is valid
48
     * @link https://php.net/manual/en/iterator.valid.php
49
     * @return boolean The return value will be casted to boolean and then evaluated.
50
     * Returns true on success or false on failure.
51
     * @since 5.0.0
52
     */
53
    public function valid()
54
    {
55
        return false;
56
    }
57
58
    /**
59
     * Rewind the Iterator to the first element
60
     * @link https://php.net/manual/en/iterator.rewind.php
61
     * @return void Any returned value is ignored.
62
     * @since 5.0.0
63
     */
64
    public function rewind()
65
    {
66
    }
67
68
    /**
69
     * Whether a offset exists
70
     * @link https://php.net/manual/en/arrayaccess.offsetexists.php
71
     * @param mixed $offset <p>
72
     * An offset to check for.
73
     * </p>
74
     * @return boolean true on success or false on failure.
75
     * </p>
76
     * <p>
77
     * The return value will be casted to boolean if non-boolean was returned.
78
     * @since 5.0.0
79
     */
80
    public function offsetExists($offset)
81
    {
82
        return false;
83
    }
84
85
    /**
86
     * Offset to retrieve
87
     * @link https://php.net/manual/en/arrayaccess.offsetget.php
88
     * @param mixed $offset <p>
89
     * The offset to retrieve.
90
     * </p>
91
     * @return mixed Can return all value types.
92
     * @since 5.0.0
93
     */
94
    public function offsetGet($offset)
95
    {
96
        throw new TDBMInvalidOffsetException('Offset "'.$offset.'" does not exist in result set.');
97
    }
98
99
    /**
100
     * Offset to set
101
     * @link https://php.net/manual/en/arrayaccess.offsetset.php
102
     * @param mixed $offset <p>
103
     * The offset to assign the value to.
104
     * </p>
105
     * @param mixed $value <p>
106
     * The value to set.
107
     * </p>
108
     * @return void
109
     * @since 5.0.0
110
     */
111
    public function offsetSet($offset, $value)
112
    {
113
        throw new TDBMInvalidOperationException('You cannot set values in a TDBM result set.');
114
    }
115
116
    /**
117
     * Offset to unset
118
     * @link https://php.net/manual/en/arrayaccess.offsetunset.php
119
     * @param mixed $offset <p>
120
     * The offset to unset.
121
     * </p>
122
     * @return void
123
     * @since 5.0.0
124
     */
125
    public function offsetUnset($offset)
126
    {
127
        throw new TDBMInvalidOperationException('You cannot unset values in a TDBM result set.');
128
    }
129
130
    /**
131
     * Count elements of an object
132
     * @link https://php.net/manual/en/countable.count.php
133
     * @return int The custom count as an integer.
134
     * </p>
135
     * <p>
136
     * The return value is cast to an integer.
137
     * @since 5.1.0
138
     */
139
    public function count()
140
    {
141
        return 0;
142
    }
143
}
144