Code Duplication    Length = 23-23 lines in 2 locations

Core/Executor/ContentManager.php 1 location

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

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.