Passed
Push — master ( 89d9c2...d06d8f )
by Sebastian
02:25
created

Mailcode_Variables_Collection_Invalid::getFirst()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
/**
3
 * File containing the {@see Mailcode_Variables_Collection} class.
4
 *
5
 * @package Mailcode
6
 * @subpackage Variables
7
 * @see Mailcode_Variables_Collection
8
 */
9
10
declare(strict_types=1);
11
12
namespace Mailcode;
13
14
use AppUtils\OperationResult;
15
16
/**
17
 * Handler for all variable-related tasks.
18
 *
19
 * @package Mailcode
20
 * @subpackage Variables
21
 * @author Sebastian Mordziol <[email protected]>
22
 */
23
class Mailcode_Variables_Collection_Invalid extends Mailcode_Variables_Collection
24
{
25
    public function add(Mailcode_Variables_Variable $variable) : Mailcode_Variables_Collection
26
    {
27
        if($variable->isValid())
28
        {
29
            return $this;
30
        }
31
        
32
        return parent::add($variable);
33
    }
34
    
35
    public function getFirstError() : OperationResult
36
    {
37
        return $this->getFirst()->getValidationResult();
38
    }
39
}
40