Passed
Push — main ( 921f5e...c50c0e )
by Jean-Christophe
02:28
created

AclManagerTester   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
dl 0
loc 41
ccs 6
cts 12
cp 0.5
rs 10
c 1
b 0
f 1
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A resourceExists() 0 2 1
A permissionExists() 0 2 1
A cacheUpdated() 0 2 1
A existAclIn() 0 2 1
A existPartIn() 0 2 1
A roleExists() 0 2 1
1
<?php
2
3
namespace Ubiquity\security\acl\traits;
4
5
use Ubiquity\security\acl\models\AbstractAclPart;
6
use Ubiquity\security\acl\models\AclElement;
7
use Ubiquity\security\acl\models\AclList;
8
9
/**
10
 * @property ?AclList $aclList
11
 */
12
trait AclManagerTester {
13
14
	/**
15
	 * Checks if ACL cache is updated.
16
	 * Do not use directly from this class: use checkCache instead.
17
	 * @return bool
18
	 */
19
	public static function cacheUpdated(): bool {
20
		return self::$aclList->cacheUpdated();
0 ignored issues
show
Bug introduced by
The method cacheUpdated() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
		return self::$aclList->/** @scrutinizer ignore-call */ cacheUpdated();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
	}
22
23
	/**
24
	 *
25
	 * @param AbstractAclPart $part
26
	 * @param string $providerClass
27
	 * @return boolean
28
	 */
29 2
	public static function existPartIn(AbstractAclPart $part, string $providerClass):bool {
30 2
		return self::$aclList->existPartIn($part, $providerClass);
31
	}
32
33
	/**
34
	 *
35
	 * @param AclElement $elm
36
	 * @param string $providerClass
37
	 * @return boolean
38
	 */
39 2
	public static function existAclIn(AclElement $elm, string $providerClass):bool {
40 2
		return self::$aclList->existAclIn($elm, $providerClass);
41
	}
42
	
43 1
	public static function roleExists(string $roleName): bool {
44 1
		return self::$aclList->roleExists($roleName);
45
	}
46
47
	public static function resourceExists(string $resourceName): bool {
48
		return self::$aclList->resourceExists($resourceName);
49
	}
50
51
	public static function permissionExists(string $permissionName): bool {
52
		return self::$aclList->permissionExists($permissionName);
53
	}
54
}