ValidationException::errors()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace TestMonitor\ActiveCampaign\Exceptions;
4
5
use Exception;
6
7
class ValidationException extends Exception
8
{
9
    /**
10
     * The array of errors.
11
     *
12
     * @var array
13
     */
14
    public $errors;
15
16
    /**
17
     * Create a new exception instance.
18
     *
19
     * @param array $errors
20
     */
21
    public function __construct(array $errors)
22
    {
23
        parent::__construct('The given data failed to pass validation.');
24
25
        $this->errors = $errors;
26
    }
27
28
    /**
29
     * The array of errors.
30
     *
31
     * @return array
32
     */
33
    public function errors()
34
    {
35
        return $this->errors['errors'] ?? [];
36
    }
37
}
38