Code Duplication    Length = 23-23 lines in 2 locations

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
     * @param Content $content

Core/Executor/UserGroupManager.php 1 location

@@ 172-194 (lines=23) @@
169
     * @return UserGroupCollection
170
     * @throws \Exception
171
     */
172
    protected function matchUserGroups($action, $step)
173
    {
174
        if (!isset($step->dsl['id']) && !isset($step->dsl['group']) && !isset($step->dsl['match'])) {
175
            throw new \Exception("The id of a user group or a match condition is required to $action it");
176
        }
177
178
        // Backwards compat
179
        if (isset($step->dsl['match'])) {
180
            $match = $step->dsl['match'];
181
        } else {
182
            if (isset($step->dsl['id'])) {
183
                $match = array('id' => $step->dsl['id']);
184
            }
185
            if (isset($step->dsl['group'])) {
186
                $match = array('id' => $step->dsl['group']);
187
            }
188
        }
189
190
        // convert the references passed in the match
191
        $match = $this->resolveReferencesRecursively($match);
192
193
        return $this->userGroupMatcher->match($match);
194
    }
195
196
    /**
197
     * @param UserGroup $userGroup