Passed
Pull Request — master (#17)
by Dedipyaman
03:18
created

Failure::getErrors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
/*
4
 * This file is part of Phypes.
5
 *
6
 * (c) Dedipyaman Das <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Phypes\Result;
13
14
use Phypes\Error\Error;
15
16
/**
17
 * Class Failure
18
 *
19
 * Specialized result class for failed cases
20
 * @package Phypes\AbstractResult
21
 * @author Dedipyaman Das <[email protected]>
22
 */
23
class Failure extends Result
24
{
25
    public function __construct(Error ...$errors)
26
    {
27
        parent::__construct(false, ...$errors);
28
    }
29
    /**
30
     * @return array
31
     */
32
    public function getErrors(): array
33
    {
34
        return $this->errors;
35
    }
36
37
    public function getFirstError() : Error
38
    {
39
        return $this->errors[0];
40
41
    }
42
}