Code Duplication    Length = 16-17 lines in 2 locations

src/IPub/Permissions/Access/AnnotationChecker.php 1 location

@@ 55-71 (lines=17) @@
52
	/**
53
	 * {@inheritdoc}
54
	 */
55
	public function isAllowed($element) : bool
56
	{
57
		// Check annotations only if element have to be secured
58
		if (
59
			$element instanceof \Reflector
60
			&& $element->hasAnnotation('Secured')
61
		) {
62
			return $this->checkUser($element)
63
			&& $this->checkResources($element)
64
			&& $this->checkPrivileges($element)
65
			&& $this->checkPermission($element)
66
			&& $this->checkRoles($element);
67
68
		} else {
69
			return TRUE;
70
		}
71
	}
72
73
	/**
74
	 * @param UI\ComponentReflection|UI\MethodReflection $element

src/IPub/Permissions/Access/LatteChecker.php 1 location

@@ 54-69 (lines=16) @@
51
	/**
52
	 * {@inheritdoc}
53
	 */
54
	public function isAllowed($element) : bool
55
	{
56
		// Check annotations only if element have to be secured
57
		if (is_array($element)) {
58
			$element = Utils\ArrayHash::from($element);
59
60
			return $this->checkUser($element)
61
			&& $this->checkResources($element)
62
			&& $this->checkPrivileges($element)
63
			&& $this->checkPermission($element)
64
			&& $this->checkRoles($element);
65
66
		} else {
67
			return TRUE;
68
		}
69
	}
70
71
	/**
72
	 * @param Utils\ArrayHash $element