Code Duplication    Length = 18-18 lines in 3 locations

Core/Executor/RoleManager.php 1 location

@@ 138-155 (lines=18) @@
135
     * @return RoleCollection
136
     * @throws \Exception
137
     */
138
    protected function matchRoles($action, $step)
139
    {
140
        if (!isset($step->dsl['name']) && !isset($step->dsl['match'])) {
141
            throw new \Exception("The name of a role or a match condition is required to $action it");
142
        }
143
144
        // Backwards compat
145
        if (isset($step->dsl['match'])) {
146
            $match = $step->dsl['match'];
147
        } else {
148
            $match = array('identifier' => $step->dsl['name']);
149
        }
150
151
        // convert the references passed in the match
152
        $match = $this->resolveReferencesRecursively($match);
153
154
        return $this->roleMatcher->match($match);
155
    }
156
157
    /**
158
     * Set references to object attributes to be retrieved later.

Core/Executor/ContentTypeManager.php 1 location

@@ 282-299 (lines=18) @@
279
     * @return ContentTypeCollection
280
     * @throws \Exception
281
     */
282
    protected function matchContentTypes($action, $step)
283
    {
284
        if (!isset($step->dsl['identifier']) && !isset($step->dsl['match'])) {
285
            throw new \Exception("The identifier of a content type or a match condition is required to $action it");
286
        }
287
288
        // Backwards compat
289
        if (isset($step->dsl['match'])) {
290
            $match = $step->dsl['match'];
291
        } else {
292
            $match = array('identifier' => $step->dsl['identifier']);
293
        }
294
295
        // convert the references passed in the match
296
        $match = $this->resolveReferencesRecursively($match);
297
298
        return $this->contentTypeMatcher->match($match);
299
    }
300
301
    /**
302
     * Sets references to object attributes

Core/Executor/LocationManager.php 1 location

@@ 234-251 (lines=18) @@
231
     * @return LocationCollection
232
     * @throws \Exception
233
     */
234
    protected function matchLocations($action, $step)
235
    {
236
        if (!isset($step->dsl['location_id']) && !isset($step->dsl['match'])) {
237
            throw new \Exception("The id or a match condition is required to $action a location");
238
        }
239
240
        // Backwards compat
241
        if (isset($step->dsl['match'])) {
242
            $match = $step->dsl['match'];
243
        } else {
244
            $match = array('location_id' => $step->dsl['location_id']);
245
        }
246
247
        // convert the references passed in the match
248
        $match = $this->resolveReferencesRecursively($match);
249
250
        return $this->locationMatcher->match($match);
251
    }
252
253
    /**
254
     * Sets references to object attributes