Completed
Push — master ( 030f70...fd4f15 )
by Andreas
23:15
created

MongoWriteConcernException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 6
rs 9.4285
1
<?php
1 ignored issue
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 24 and the first side effect is on line 17.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
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('MongoWriteConcernException', false)) {
17
    return;
18
}
19
20
/**
21
 * <p>(PECL mongo &gt;= 1.5.0)</p>
22
 * @link http://php.net/manual/en/class.mongowriteconcernexception.php#class.mongowriteconcernexception
23
 */
24
class MongoWriteConcernException extends MongoCursorException
25
{
26
    private $document;
27
28
    /**
29
     * MongoWriteConcernException constructor.
30
     *
31
     * @param string $message
32
     * @param int $code
33
     * @param Exception|null $previous
34
     * @param null $document
35
     *
36
     * @internal The $document parameter is not part of the ext-mongo API
37
     */
38
    public function __construct($message = '', $code = 0, Exception $previous = null, $document = null)
39
    {
40
        parent::__construct($message, $code, $previous);
41
42
        $this->document = $document;
43
    }
44
45
    /**
46
     * Get the error document
47
     * @link http://php.net/manual/en/mongowriteconcernexception.getdocument.php
48
     * @return array <p>A MongoDB document, if available, as an array.</p>
49
     */
50
    public function getDocument()
51
    {
52
        return $this->document;
53
    }
54
}
55