Passed
Push — main ( 6d76a8...9a92e8 )
by Jean-Christophe
02:58 queued 15s
created

AbstractAclPart   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 72
Duplicated Lines 0 %

Test Coverage

Coverage 71.43%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
eloc 17
c 3
b 0
f 1
dl 0
loc 72
ccs 15
cts 21
cp 0.7143
rs 10
wmc 11

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A __toString() 0 2 1
A fromArray() 0 3 2
A getType() 0 2 1
A setName() 0 2 1
A getName() 0 2 1
A castAs() 0 2 1
A toArray() 0 2 1
A getId_() 0 2 1
A setType() 0 2 1
1
<?php
2
3
namespace Ubiquity\security\acl\models;
4
5
use Ubiquity\attributes\items\Transient;
1 ignored issue
show
Bug introduced by
The type Ubiquity\attributes\items\Transient was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
/**
8
 * Ubiquity\security\acl\models$AbastractAclElement
9
 * This class is part of Ubiquity
10
 *
11
 * @author jc
12
 * @version 1.0.1
13
 *
14
 */
15
abstract class AbstractAclPart {
16
17
	/**
18
	 *
19
	 * @id
20
	 * @column("name"=>"name","nullable"=>false,"dbType"=>"varchar(100)")
21
	 */
22
	#[\Ubiquity\attributes\items\Id()]
23
	#[\Ubiquity\attributes\items\Column(name:'name',nullable:false,dbType:'varchar(100)')]
24
	protected $name;
25
26
	/**
27
	 * @var string
28
	 * @transient
29
	 */
30
	#[Transient]
31
	protected $type='';
32
33 22
	public function __construct(?string $name = null) {
34 22
		$this->name = $name;
35
	}
36
37
	/**
38
	 *
39
	 * @return mixed
40
	 */
41 22
	public function getName() {
42 22
		return $this->name;
43
	}
44
45
	public function getId_() {
46
		return $this->name;
47
	}
48
49
	/**
50
	 *
51
	 * @param string $name
52
	 */
53 4
	public function setName($name) {
54 4
		$this->name = $name;
55
	}
56
57 5
	public function toArray(): array {
58 5
		return \get_object_vars($this);
59
	}
60
61 6
	public function fromArray(array $values) {
62 6
		foreach ($values as $k => $v) {
63 6
			$this->$k = $v;
64
		}
65
	}
66
67
	public function __toString() {
68
		return $this->name;
69
	}
70
71
	/**
72
	 * @return string
73
	 */
74
	public function getType(): string {
75
		return $this->type;
76
	}
77
78
	/**
79
	 * @param string $type
80
	 */
81 4
	public function setType(?string $type): void {
82 4
		$this->type = $type;
83
	}
84
85 3
	public function castAs(string $class) {
86 3
		return unserialize(sprintf('O:%d:"%s"%s', \strlen($class), $class, \strstr(\strstr(\serialize($this), '"'), ':')));
87
	}
88
}
89
90