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'));
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

@@ 93-108 (lines=16) @@
90
        ], null, $request);
91
    }
92
93
    protected function checkRolesCMS(array $role)
94
    {
95
        $user = $this->getUser();
96
97
        if (!$user) {
98
            throw new NotFoundHttpException(sprintf('unable to find user'));
99
        }
100
101
        $userRole = $user->getRoles()[0];
102
103
        if (!array_key_exists('role', $role) || in_array($userRole, $role['role'])) {
104
            return true;
105
        }
106
107
        return false;
108
    }
109
110
}
111