Code Duplication    Length = 18-18 lines in 3 locations

Core/Executor/ContentTypeManager.php 1 location

@@ 320-337 (lines=18) @@
317
     * @return ContentTypeCollection
318
     * @throws \Exception
319
     */
320
    protected function matchContentTypes($action, $step)
321
    {
322
        if (!isset($step->dsl['identifier']) && !isset($step->dsl['match'])) {
323
            throw new \Exception("The identifier of a content type or a match condition is required to $action it");
324
        }
325
326
        // Backwards compat
327
        if (isset($step->dsl['match'])) {
328
            $match = $step->dsl['match'];
329
        } else {
330
            $match = array('identifier' => $step->dsl['identifier']);
331
        }
332
333
        // convert the references passed in the match
334
        $match = $this->resolveReferencesRecursively($match);
335
336
        return $this->contentTypeMatcher->match($match);
337
    }
338
339
    /**
340
     * @param ContentType $contentType

Core/Executor/LocationManager.php 1 location

@@ 248-265 (lines=18) @@
245
     * @return LocationCollection
246
     * @throws \Exception
247
     */
248
    protected function matchLocations($action, $step)
249
    {
250
        if (!isset($step->dsl['location_id']) && !isset($step->dsl['match'])) {
251
            throw new \Exception("The id or a match condition is required to $action a location");
252
        }
253
254
        // Backwards compat
255
        if (isset($step->dsl['match'])) {
256
            $match = $step->dsl['match'];
257
        } else {
258
            $match = array('location_id' => $step->dsl['location_id']);
259
        }
260
261
        // convert the references passed in the match
262
        $match = $this->resolveReferencesRecursively($match);
263
264
        return $this->locationMatcher->match($match);
265
    }
266
267
    /**
268
     * @param Location $location

Core/Executor/RoleManager.php 1 location

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