Code Duplication    Length = 23-23 lines in 2 locations

Core/Executor/ContentManager.php 1 location

@@ 322-344 (lines=23) @@
319
     * @return ContentCollection
320
     * @throws \Exception
321
     */
322
    protected function matchContents($action, $step)
323
    {
324
        if (!isset($step->dsl['object_id']) && !isset($step->dsl['remote_id']) && !isset($step->dsl['match'])) {
325
            throw new \Exception("The id or remote id of an object or a match condition is required to $action a location");
326
        }
327
328
        // Backwards compat
329
330
        if (isset($step->dsl['match'])) {
331
            $match = $step->dsl['match'];
332
        } else {
333
            if (isset($step->dsl['object_id'])) {
334
                $match = array('content_id' => $step->dsl['object_id']);
335
            } elseif (isset($step->dsl['remote_id'])) {
336
                $match = array('content_remote_id' => $step->dsl['remote_id']);
337
            }
338
        }
339
340
        // convert the references passed in the match
341
        $match = $this->resolveReferencesRecursively($match);
342
343
        return $this->contentMatcher->match($match);
344
    }
345
346
    /**
347
     * Sets references to certain content attributes.

Core/Executor/UserGroupManager.php 1 location

@@ 160-182 (lines=23) @@
157
     * @return UserGroupCollection
158
     * @throws \Exception
159
     */
160
    protected function matchUserGroups($action, $step)
161
    {
162
        if (!isset($step->dsl['id']) && !isset($step->dsl['group']) && !isset($step->dsl['match'])) {
163
            throw new \Exception("The id of a user group or a match condition is required to $action it");
164
        }
165
166
        // Backwards compat
167
        if (isset($step->dsl['match'])) {
168
            $match = $step->dsl['match'];
169
        } else {
170
            if (isset($step->dsl['id'])) {
171
                $match = array('id' => $step->dsl['id']);
172
            }
173
            if (isset($step->dsl['group'])) {
174
                $match = array('id' => $step->dsl['group']);
175
            }
176
        }
177
178
        // convert the references passed in the match
179
        $match = $this->resolveReferencesRecursively($match);
180
181
        return $this->userGroupMatcher->match($match);
182
    }
183
184
    /**
185
     * Set references defined in the DSL for use in another step during the migrations.