Test Failed
Push — main ( 828f5f...2efb32 )
by Jean-Christophe
03:47
created

Role   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 9
dl 0
loc 38
ccs 6
cts 9
cp 0.6667
rs 10
c 2
b 1
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getParents() 0 2 1
A setParents() 0 5 2
A getParentsArray() 0 2 1
1
<?php
2
namespace Ubiquity\security\acl\models;
3
4
/**
5
 * Ubiquity\security\acl\models$Role
6
 * This class is part of Ubiquity
7
 *
8
 * @author jc
9
 * @version 1.0.0
10
 *
11
 */
12
class Role extends AbstractAclPart {
13
14 8
	public function __construct(?string $name = null, $parents = '') {
15 8
		parent::__construct($name);
16 8
		$this->setParents($parents);
17 8
	}
18
19
	/**
20
	 *
21
	 * @var string
22
	 */
23
	protected $parents = '';
24
25
	/**
26
	 *
27
	 * @return string
28
	 */
29 7
	public function getParents() {
30 7
		return $this->parents;
31
	}
32
33
	/**
34
	 *
35
	 * @return array
36
	 */
37
	public function getParentsArray() {
38
		return \explode(',', $this->parents);
39
	}
40
41
	/**
42
	 *
43
	 * @param array|string $parents
44
	 */
45
	public function setParents($parents) {
46
		if (\is_array($parents)) {
47
			$parents = \implode(',', $parents);
48
		}
49
		$this->parents = $parents;
50
	}
51
}
52
53