StanzaException::getError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 1
1
<?php
2
/**
3
 * Nucleus - XMPP Library for PHP
4
 *
5
 * Copyright (C) 2016, Some rights reserved.
6
 *
7
 * @author Kacper "Kadet" Donat <[email protected]>
8
 *
9
 * Contact with author:
10
 * Xmpp: [email protected]
11
 * E-mail: [email protected]
12
 *
13
 * From Kadet with love.
14
 */
15
16
namespace Kadet\Xmpp\Exception\Protocol;
17
18
19
use Exception;
20
use Kadet\Xmpp\Exception\PropertyAccessException;
21
use Kadet\Xmpp\Stanza\Error;
22
23
class StanzaException extends PropertyAccessException
24
{
25
    /** @var Error */
26
    private $_error;
27
28
    /**
29
     * Construct the exception. Note: The message is NOT binary safe.
30
     * @link  http://php.net/manual/en/exception.construct.php
31
     * @param Error     $error    Stanza error describing exception
32
     * @param string    $message  [optional] The Exception message to throw.
33
     * @param int       $code     [optional] The Exception code.
34
     * @param Exception $previous [optional] The previous exception used for the exception chaining. Since 5.3.0
35
     * @since 5.1.0
36
     */
37
    public function __construct(Error $error, $message = '', $code = 0, Exception $previous = null)
38
    {
39
        parent::__construct($message, $code, $previous);
40
        $this->_error = $error;
41
    }
42
43
44
    /**
45
     * @return Error
46
     */
47
    public function getError() : Error
48
    {
49
        return $this->_error;
50
    }
51
}
52