Code Duplication    Length = 23-23 lines in 2 locations

Core/Executor/UserGroupManager.php 1 location

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

Core/Executor/ContentManager.php 1 location

@@ 334-356 (lines=23) @@
331
     * @return ContentCollection
332
     * @throws \Exception
333
     */
334
    protected function matchContents($action, $step)
335
    {
336
        if (!isset($step->dsl['object_id']) && !isset($step->dsl['remote_id']) && !isset($step->dsl['match'])) {
337
            throw new \Exception("The id or remote id of an object or a match condition is required to $action a content");
338
        }
339
340
        // Backwards compat
341
342
        if (isset($step->dsl['match'])) {
343
            $match = $step->dsl['match'];
344
        } else {
345
            if (isset($step->dsl['object_id'])) {
346
                $match = array('content_id' => $step->dsl['object_id']);
347
            } elseif (isset($step->dsl['remote_id'])) {
348
                $match = array('content_remote_id' => $step->dsl['remote_id']);
349
            }
350
        }
351
352
        // convert the references passed in the match
353
        $match = $this->resolveReferencesRecursively($match);
354
355
        return $this->contentMatcher->match($match);
356
    }
357
358
    /**
359
     * Sets references to certain content attributes.