Completed
Pull Request — master (#49)
by Maks
23:20
created

Mongo::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 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
/**
17
 * The connection point between MongoDB and PHP.
18
 * This class is used to initiate a connection and for database server commands.
19
 * @link http://www.php.net/manual/en/class.mongo.php
20
 * @deprecated This class has been DEPRECATED as of version 1.3.0.
21
 * Relying on this feature is highly discouraged. Please use MongoClient instead.
22
 * @see MongoClient
23
 */
24
class Mongo extends MongoClient
25
{
26
    /**
27
     * Get pool size for connection pools
28
     *
29
     * @link http://php.net/manual/en/mongo.getpoolsize.php
30
     * @return int Returns the current pool size.
31
     *
32
     * @deprecated This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::getSize() instead.
33
     */
34
    public function getPoolSize()
35
    {
36
        $this->notImplemented();
37
    }
38
39
    /**
40
     * Returns the address being used by this for slaveOkay reads
41
     *
42
     * @link http://php.net/manual/en/mongo.getslave.php
43
     * @return bool The address of the secondary this connection is using for
44
     * reads. This returns NULL if this is not connected to a replica set or not yet
45
     * initialized.
46
     */
47
    public function getSlave()
48
    {
49
        $this->notImplemented();
50
    }
51
52
    /**
53
     * Get slaveOkay setting for this connection
54
     *
55
     * @link http://php.net/manual/en/mongo.getslaveokay.php
56
     * @return bool Returns the value of slaveOkay for this instance.
57
     */
58
    public function getSlaveOkay()
59
    {
60
        $this->notImplemented();
61
    }
62
63
    /**
64
     * Connects to paired database server
65
     *
66
     * @link http://www.php.net/manual/en/mongo.pairconnect.php
67
     * @throws MongoConnectionException
68
     * @return boolean
69
     *
70
     * @deprecated Pass a string of the form "mongodb://server1,server2" to the constructor instead of using this method.
71
     */
72
    public function pairConnect()
73
    {
74
        $this->notImplemented();
75
    }
76
77
    /**
78
     * Returns information about all connection pools.
79
     *
80
     * @link http://php.net/manual/en/mongo.pooldebug.php
81
     * @return array
82
     * @deprecated This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::info() instead.
83
     */
84
    public function poolDebug()
85
    {
86
        $this->notImplemented();
87
    }
88
89
    /**
90
     * Change slaveOkay setting for this connection
91
     *
92
     * @link http://php.net/manual/en/mongo.setslaveokay.php
93
     * @param bool $ok
94
     * @return bool returns the former value of slaveOkay for this instance.
95
     */
96
    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...
97
    {
98
        $this->notImplemented();
99
    }
100
101
    /**
102
     * Set the size for future connection pools.
103
     *
104
     * @link http://php.net/manual/en/mongo.setpoolsize.php
105
     * @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>
106
     * @return bool Returns the former value of pool size.
107
     * @deprecated Relying on this feature is highly discouraged. Please use MongoPool::setSize() instead.
108
     */
109
    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...
110
    {
111
        $this->notImplemented();
112
    }
113
114
    /**
115
     * Creates a persistent connection with a database server
116
     *
117
     * @link http://www.php.net/manual/en/mongo.persistconnect.php
118
     * @param string $username A username used to identify the connection.
119
     * @param string $password A password used to identify the connection.
120
     * @throws MongoConnectionException
121
     * @return boolean If the connection was successful.
122
     * @deprecated Pass array("persist" => $id) to the constructor instead of using this method.
123
     */
124
    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...
125
    {
126
        $this->notImplemented();
127
    }
128
129
    /**
130
     * Creates a persistent connection with paired database servers
131
     *
132
     * @link http://www.php.net/manual/en/mongo.pairpersistconnect.php
133
     * @param string $username A username used to identify the connection.
134
     * @param string $password A password used to identify the connection.
135
     * @throws MongoConnectionException
136
     * @return boolean If the connection was successful.
137
     * @deprecated Pass "mongodb://server1,server2" and array("persist" => $id) to the constructor instead of using this method.
138
     */
139
    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...
140
    {
141
        $this->notImplemented();
142
    }
143
144
    /**
145
     * Connects with a database server
146
     *
147
     * @link http://www.php.net/manual/en/mongo.connectutil.php
148
     * @throws MongoConnectionException
149
     * @return boolean If the connection was successful.
150
     */
151
    protected function connectUtil()
152
    {
153
        $this->notImplemented();
154
    }
155
156
    /**
157
     * Check if there was an error on the most recent db operation performed
158
     *
159
     * @link http://www.php.net/manual/en/mongo.lasterror.php
160
     * @return array|null Returns the error, if there was one, or NULL.
161
     * @deprecated Use MongoDB::lastError() instead.
162
     */
163
    public function lastError()
164
    {
165
        $this->notImplemented();
166
    }
167
168
    /**
169
     * Checks for the last error thrown during a database operation
170
     *
171
     * @link http://www.php.net/manual/en/mongo.preverror.php
172
     * @return array Returns the error and the number of operations ago it occurred.
173
     * @deprecated Use MongoDB::prevError() instead.
174
     */
175
    public function prevError()
176
    {
177
        $this->notImplemented();
178
    }
179
180
    /**
181
     * Clears any flagged errors on the connection
182
     *
183
     * @link http://www.php.net/manual/en/mongo.reseterror.php
184
     * @return array Returns the database response.
185
     * @deprecated Use MongoDB::resetError() instead.
186
     */
187
    public function resetError()
188
    {
189
        $this->notImplemented();
190
    }
191
192
    /**
193
     * Choose a new secondary for slaveOkay reads
194
     *
195
     * @link www.php.net/manual/en/mongo.switchslave.php
196
     * @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.
197
     * @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).
198
     */
199
    public function switchSlave()
200
    {
201
        $this->notImplemented();
202
    }
203
204
    /**
205
     * Creates a database error on the database.
206
     *
207
     * @link http://www.php.net/manual/en/mongo.forceerror.php
208
     * @return boolean The database response.
209
     * @deprecated Use MongoDB::forceError() instead.
210
     */
211
    public function forceError()
212
    {
213
        $this->notImplemented();
214
    }
215
216
    protected function notImplemented()
217
    {
218
        throw new \Exception('The Mongo class is deprecated and not supported through mongo-php-adapter');
219
    }
220
}
221