Completed
Push — master ( 660564...17f31f )
by Andreas
18s queued 10s
created

Mongo::forceError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 */
15
16
if (class_exists('Mongo', false)) {
17
    return;
18
}
19
20
/**
21
 * The connection point between MongoDB and PHP.
22
 * This class is used to initiate a connection and for database server commands.
23
 * @link http://www.php.net/manual/en/class.mongo.php
24
 * @deprecated This class has been DEPRECATED as of version 1.3.0.
25
 * Relying on this feature is highly discouraged. Please use MongoClient instead.
26
 * @see MongoClient
27
 */
28
class Mongo extends MongoClient
29
{
30
    /**
31
     * Dummy constructor to throw an exception
32
     */
33
    public function __construct()
34
    {
35
        $this->notImplemented();
36
    }
37
38
    /**
39
     * Get pool size for connection pools
40
     *
41
     * @link http://php.net/manual/en/mongo.getpoolsize.php
42
     * @return int Returns the current pool size.
43
     *
44
     * @deprecated This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::getSize() instead.
45
     */
46
    public function getPoolSize()
47
    {
48
        $this->notImplemented();
49
    }
50
51
    /**
52
     * Returns the address being used by this for slaveOkay reads
53
     *
54
     * @link http://php.net/manual/en/mongo.getslave.php
55
     * @return bool The address of the secondary this connection is using for
56
     * reads. This returns NULL if this is not connected to a replica set or not yet
57
     * initialized.
58
     */
59
    public function getSlave()
60
    {
61
        $this->notImplemented();
62
    }
63
64
    /**
65
     * Get slaveOkay setting for this connection
66
     *
67
     * @link http://php.net/manual/en/mongo.getslaveokay.php
68
     * @return bool Returns the value of slaveOkay for this instance.
69
     */
70
    public function getSlaveOkay()
71
    {
72
        $this->notImplemented();
73
    }
74
75
    /**
76
     * Connects to paired database server
77
     *
78
     * @link http://www.php.net/manual/en/mongo.pairconnect.php
79
     * @throws MongoConnectionException
80
     * @return boolean
81
     *
82
     * @deprecated Pass a string of the form "mongodb://server1,server2" to the constructor instead of using this method.
83
     */
84
    public function pairConnect()
85
    {
86
        $this->notImplemented();
87
    }
88
89
    /**
90
     * Returns information about all connection pools.
91
     *
92
     * @link http://php.net/manual/en/mongo.pooldebug.php
93
     * @return array
94
     * @deprecated This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::info() instead.
95
     */
96
    public function poolDebug()
97
    {
98
        $this->notImplemented();
99
    }
100
101
    /**
102
     * Change slaveOkay setting for this connection
103
     *
104
     * @link http://php.net/manual/en/mongo.setslaveokay.php
105
     * @param bool $ok
106
     * @return bool returns the former value of slaveOkay for this instance.
107
     */
108
    public function setSlaveOkay($ok)
0 ignored issues
show
Unused Code introduced by
The parameter $ok is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
109
    {
110
        $this->notImplemented();
111
    }
112
113
    /**
114
     * Set the size for future connection pools.
115
     *
116
     * @link http://php.net/manual/en/mongo.setpoolsize.php
117
     * @param $size <p>The max number of connections future pools will be able to create. Negative numbers mean that the pool will spawn an infinite number of connections.</p>
118
     * @return bool Returns the former value of pool size.
119
     * @deprecated Relying on this feature is highly discouraged. Please use MongoPool::setSize() instead.
120
     */
121
    public function setPoolSize($size)
0 ignored issues
show
Unused Code introduced by
The parameter $size is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
122
    {
123
        $this->notImplemented();
124
    }
125
126
    /**
127
     * Creates a persistent connection with a database server
128
     *
129
     * @link http://www.php.net/manual/en/mongo.persistconnect.php
130
     * @param string $username A username used to identify the connection.
131
     * @param string $password A password used to identify the connection.
132
     * @throws MongoConnectionException
133
     * @return boolean If the connection was successful.
134
     * @deprecated Pass array("persist" => $id) to the constructor instead of using this method.
135
     */
136
    public function persistConnect($username = "", $password = "")
0 ignored issues
show
Unused Code introduced by
The parameter $username is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $password is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
137
    {
138
        $this->notImplemented();
139
    }
140
141
    /**
142
     * Creates a persistent connection with paired database servers
143
     *
144
     * @link http://www.php.net/manual/en/mongo.pairpersistconnect.php
145
     * @param string $username A username used to identify the connection.
146
     * @param string $password A password used to identify the connection.
147
     * @throws MongoConnectionException
148
     * @return boolean If the connection was successful.
149
     * @deprecated Pass "mongodb://server1,server2" and array("persist" => $id) to the constructor instead of using this method.
150
     */
151
    public function pairPersistConnect($username = "", $password = "")
0 ignored issues
show
Unused Code introduced by
The parameter $username is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $password is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
152
    {
153
        $this->notImplemented();
154
    }
155
156
    /**
157
     * Connects with a database server
158
     *
159
     * @link http://www.php.net/manual/en/mongo.connectutil.php
160
     * @throws MongoConnectionException
161
     * @return boolean If the connection was successful.
162
     */
163
    protected function connectUtil()
164
    {
165
        $this->notImplemented();
166
    }
167
168
    /**
169
     * Check if there was an error on the most recent db operation performed
170
     *
171
     * @link http://www.php.net/manual/en/mongo.lasterror.php
172
     * @return array|null Returns the error, if there was one, or NULL.
173
     * @deprecated Use MongoDB::lastError() instead.
174
     */
175
    public function lastError()
176
    {
177
        $this->notImplemented();
178
    }
179
180
    /**
181
     * Checks for the last error thrown during a database operation
182
     *
183
     * @link http://www.php.net/manual/en/mongo.preverror.php
184
     * @return array Returns the error and the number of operations ago it occurred.
185
     * @deprecated Use MongoDB::prevError() instead.
186
     */
187
    public function prevError()
188
    {
189
        $this->notImplemented();
190
    }
191
192
    /**
193
     * Clears any flagged errors on the connection
194
     *
195
     * @link http://www.php.net/manual/en/mongo.reseterror.php
196
     * @return array Returns the database response.
197
     * @deprecated Use MongoDB::resetError() instead.
198
     */
199
    public function resetError()
200
    {
201
        $this->notImplemented();
202
    }
203
204
    /**
205
     * Choose a new secondary for slaveOkay reads
206
     *
207
     * @link www.php.net/manual/en/mongo.switchslave.php
208
     * @return string The address of the secondary this connection is using for reads. This may be the same as the previous address as addresses are randomly chosen. It may return only one address if only one secondary (or only the primary) is available.
209
     * @throws MongoException (error code 15) if it is called on a non-replica-set connection. It will also throw MongoExceptions if it cannot find anyone (primary or secondary) to read from (error code 16).
210
     */
211
    public function switchSlave()
212
    {
213
        $this->notImplemented();
214
    }
215
216
    /**
217
     * Creates a database error on the database.
218
     *
219
     * @link http://www.php.net/manual/en/mongo.forceerror.php
220
     * @return boolean The database response.
221
     * @deprecated Use MongoDB::forceError() instead.
222
     */
223
    public function forceError()
224
    {
225
        $this->notImplemented();
226
    }
227
228
    protected function notImplemented()
229
    {
230
        throw new \Exception('The Mongo class is deprecated and not supported through mongo-php-adapter');
231
    }
232
}
233