Completed
Push — master ( 9e4d7b...c3f58e )
by Gabriel
03:57 queued 11s
created

HasErrorsTrait::getErrors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Nip\Form\Elements\Traits;
4
5
use Nip\Form\Elements\AbstractElement;
6
7
/**
8
 * Trait HasErrorsTrait
9
 * @package Nip\Form\Elements\Traits
10
 */
11
trait HasErrorsTrait
12
{
13
    protected $_errors = [];
14
15
    /**
16
     * @param $message
17
     * @return $this
18
     */
19
    public function addError($message)
20
    {
21
        $this->_errors[] = $message;
22
23
        return $this;
24
    }
25
26
    /**
27
     * @return array
28
     */
29
    public function getErrors()
30
    {
31
        return $this->_errors;
32
    }
33
34
    /**
35
     * @return bool
36
     */
37 8
    public function isError()
38
    {
39 8
        return count($this->_errors) > 0;
40
    }
41
}
42