Code Duplication    Length = 20-20 lines in 2 locations

src/Chamilo/CoreBundle/Security/Authorization/Voter/CourseVoter.php 1 location

@@ 63-82 (lines=20) @@
60
    /**
61
     * @inheritdoc
62
     */
63
    protected function supports($attribute, $subject)
64
    {
65
        $options = [
66
            self::VIEW,
67
            self::EDIT,
68
            self::DELETE
69
        ];
70
71
        // if the attribute isn't one we support, return false
72
        if (!in_array($attribute, $options)) {
73
            return false;
74
        }
75
76
        // only vote on Post objects inside this voter
77
        if (!$subject instanceof Course) {
78
            return false;
79
        }
80
81
        return true;
82
    }
83
84
    /**
85
     * @inheritdoc

src/Chamilo/CoreBundle/Security/Authorization/Voter/GroupVoter.php 1 location

@@ 78-97 (lines=20) @@
75
     /**
76
     * @inheritdoc
77
     */
78
    protected function supports($attribute, $subject)
79
    {
80
        $options = [
81
            self::VIEW,
82
            self::EDIT,
83
            self::DELETE
84
        ];
85
86
        // if the attribute isn't one we support, return false
87
        if (!in_array($attribute, $options)) {
88
            return false;
89
        }
90
91
        // only vote on Post objects inside this voter
92
        if (!$subject instanceof CGroupInfo) {
93
            return false;
94
        }
95
96
        return true;
97
    }
98
99
     /**
100
     * @inheritdoc