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

Errorable   A

Complexity

Total Complexity 30

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 30
c 2
b 1
f 0
lcom 1
cbo 0
dl 0
loc 50
ccs 0
cts 25
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getArrErrors() 0 7 2
A addError() 0 7 2
A addArrErrors() 0 9 3
A resetErrors() 0 4 1
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