Code Duplication    Length = 14-16 lines in 2 locations

Controller/AdminBlockController.php 1 location

@@ 101-114 (lines=14) @@
98
     *
99
     * Check role define in different parameter of block or content_types cms.yml
100
     */
101
    protected function checkRolesCMS(array $role)
102
    {
103
        $user = $this->getUser();
104
105
        if (!$user) {
106
            throw new NotFoundHttpException(sprintf('unable to find user in %s file', __FILE__));
107
        }
108
109
        if (!array_key_exists('role', $role) || in_array($user->getRoles()[0], $role['role'])) {
110
            return true;
111
        }
112
113
        return false;
114
    }
115
116
    /**
117
     * Get content in cms.yml and set in $_cmsParameter.

Controller/AdminNodeController.php 1 location

@@ 105-120 (lines=16) @@
102
        ], null, $request);
103
    }
104
105
    protected function checkRolesCMS(array $role)
106
    {
107
        $user = $this->getUser();
108
109
        if (!$user) {
110
            throw new NotFoundHttpException(sprintf('unable to find user in %s file', __FILE__));
111
        }
112
113
        $userRole = $user->getRoles()[0];
114
115
        if (!array_key_exists('role', $role) || in_array($userRole, $role['role'])) {
116
            return true;
117
        }
118
119
        return false;
120
    }
121
122
    protected function findContentFromNode(Node $node)
123
    {