XOrderValidationException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getErrors() 0 4 1
1
<?php
2
3
/**
4
 * xOrder Validation Exception.
5
 *
6
 * @package     craftt/xorder-sdk
7
 * @author      Ryan Stratton <[email protected]>
8
 * @copyright   Copyright (c) Ryan Stratton
9
 * @license     https://github.com/craftt/xorder-php-sdk/blob/master/LICENSE.md Apache 2.0
10
 * @link        https://github.com/craftt/xorder-php-sdk
11
 */
12
13
namespace XOrder\Exceptions;
14
15
use Exception;
16
17
/**
18
 * XOrder Validation Exception
19
 * @codeCoverageIgnore
20
 */
21
class XOrderValidationException extends Exception
22
{
23
24
    /**
25
     * @var array
26
     */
27
    public $errors;
28
29
    /**
30
     * Constructor
31
     *
32
     * @param array $errors
33
     */
34
    public function __construct(array $errors)
35
    {
36
        parent::__construct($errors[0]->message);
37
        $this->errors = $errors;
38
    }
39
40
    /**
41
     * Get the array of xml validation errors.
42
     *
43
     * @return array
44
     */
45
    final public function getErrors()
46
    {
47
        return $this->errors;
48
    }
49
}
50