Completed
Push — master ( d1ff53...78d2a6 )
by Lorenzo
02:16
created

Errorable::resetErrors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Padosoft\TesseraSanitaria\traits;
4
5
/**
6
 * Class Errorable
7
 * @package Padosoft\TesseraSanitaria\traits
8
 */
9
trait Errorable
10
{
11
	/**
12
	 * @var array
13
	 */
14
	protected $arrErrors = array();
15
16
	/**
17
	 * @return array
18
	 */
19
	public function getArrErrors()
20
	{
21
		if(!is_array($this->arrErrors)){
22
			$this->arrErrors = array();
23
		}
24
		return $this->arrErrors;
25
	}
26
27
	/**
28
	 * @param $str
29
	 */
30
	public function addError($str)
31
	{
32
		if($str == ""){
33
			return;
34
		}
35
		$this->arrErrors[] = $str;
36
	}
37
38
	/**
39
	 * @param $add
40
	 */
41
	public function addArrErrors($add)
42
	{
43
		if(!is_array($add) || count($add)<1){
44
			return;
45
		}
46
47
		$this->arrErrors = array_merge($this->arrErrors, $add);
48
49
	}
50
51
	/**
52
	 *
53
	 */
54
	public function resetErrors()
55
	{
56
		$this->arrErrors = array();
57
	}
58
}
59