XOrderValidationException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
c 3
b 1
f 1
dl 0
loc 5
rs 9.4286
cc 1
eloc 3
nc 1
nop 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