Passed
Push — main ( b35506...bda31a )
by Jean-Christophe
06:20
created

AbstractAclPart::setId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Ubiquity\security\acl\models;
3
4
/**
5
 * Ubiquity\security\acl\models$AbastractAclElement
6
 * This class is part of Ubiquity
7
 *
8
 * @author jc
9
 * @version 1.0.0
10
 *
11
 */
12
abstract class AbstractAclPart {
13
14
	/**
15
	 *
16
	 * @id
17
	 * @column("name"=>"id","nullable"=>false,"dbType"=>"int(11)")
18
	 */
19
	protected $id;
20
21
	/**
22
	 *
23
	 * @var string
24
	 */
25
	protected $name;
26
27 20
	public function __construct(?string $name = null) {
28 20
		$this->name = $name;
29 20
	}
30
31
	/**
32
	 *
33
	 * @return mixed
34
	 */
35 20
	public function getName() {
36 20
		return $this->name;
37
	}
38
39
	/**
40
	 *
41
	 * @param string $name
42
	 */
43 3
	public function setName($name) {
44 3
		$this->name = $name;
45 3
	}
46
47 5
	public function toArray(): array {
48 5
		return \get_object_vars($this);
49
	}
50
51 5
	public function fromArray(array $values) {
52 5
		foreach ($values as $k => $v) {
53 5
			$this->$k = $v;
54
		}
55 5
	}
56
57
	/**
58
	 *
59
	 * @return mixed
60
	 */
61
	public function getId() {
62
		return $this->id;
63
	}
64
65
	/**
66
	 *
67
	 * @param mixed $id
68
	 */
69 3
	public function setId($id) {
70 3
		$this->id = $id;
71 3
	}
72
73
	public function __toString() {
74
		return $this->name;
75
	}
76
}
77
78