Completed
Push — master ( 5f3a6c...fcd09b )
by Kacper
05:50
created

StanzaException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getError() 0 4 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