Code Duplication    Length = 17-19 lines in 2 locations

src/Auth/HierAuthorize.php 2 locations

@@ 125-143 (lines=19) @@
122
     *
123
     * @return array
124
     */
125
    protected function _getHierarchy()
126
    {
127
        $file = $this->config('hierarchyFile');
128
129
        $yaml = file_get_contents(CONFIG . $file);
130
        try {
131
            $yaml = Yaml::parse($yaml);
132
        } catch (\Exception $e) {
133
            throw new Exception(sprintf('Malformed hierarchy config file, check YAML syntax: %s', $e->getMessage()));
134
        }
135
136
        if (!isset($yaml['hierarchy'])) {
137
            throw new Exception("The hierarchy configuration must be under key \"hierarchy\". No such key was found.");
138
        }
139
140
        $hierarchy = $this->_parseHierarchy($yaml['hierarchy']);
141
142
        return $hierarchy;
143
    }
144
145
    /**
146
     * Parses and flattens hierarchy settings.
@@ 203-219 (lines=17) @@
200
     *
201
     * @return array
202
     */
203
    protected function _getAcl()
204
    {
205
        $file = $this->config('aclFile');
206
207
        $yaml = file_get_contents(CONFIG . $file);
208
        try {
209
            $yaml = Yaml::parse($yaml);
210
        } catch (\Exception $e) {
211
            throw new Exception(sprintf('Malformed acl configuration file. Check syntax: %s', $e->getMessage()));
212
        }
213
214
        if (!isset($yaml['controllers'])) {
215
            throw new Exception('The ACL configuration must be under key \"controllers\". No such key was found.');
216
        }
217
218
        return $this->_parseAcl($yaml['controllers']);
219
    }
220
221
222
    /**