Code Duplication    Length = 16-17 lines in 2 locations

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

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

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

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