Test Failed
Push — main ( 573841...5a0b4f )
by Jean-Christophe
06:17
created

ResourceAnnotation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A initAnnotation() 0 8 3
1
<?php
2
namespace Ubiquity\annotations\acl;
3
4
use Ubiquity\annotations\BaseAnnotation;
0 ignored issues
show
Bug introduced by
The type Ubiquity\annotations\BaseAnnotation 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...
5
6
/**
7
 * Annotation Resource.
8
 * usages :
9
 * - resource("resourceName")
10
 * - resource("name"=>"resourceName")
11
 *
12
 * @author jc
13
 * @version 1.0.0
14
 * @usage('method'=>true,'class'=>true,'inherited'=>true,'multiple'=>false)
15
 */
16
class ResourceAnnotation extends BaseAnnotation {
17
18
	public $name;
19
20
	/**
21
	 * Initialize the annotation.
22
	 */
23
	public function initAnnotation(array $properties) {
24
		if (isset($properties[0])) {
25
			$this->name = $properties[0];
26
			unset($properties[0]);
27
		} else if (isset($properties['name'])) {
28
			$this->name = $properties['name'];
29
		} else {
30
			throw new \Exception('Resource annotation must have a name');
31
		}
32
	}
33
}
34