Code Duplication    Length = 18-19 lines in 2 locations

Core/Executor/TrashManager.php 2 locations

@@ 42-59 (lines=18) @@
39
    /**
40
     * Handles the trash-restore migration action
41
     */
42
    protected function restore($step)
43
    {
44
        $itemsCollection = $this->matchItems('restore', $step);
45
46
        if (count($itemsCollection) > 1 && array_key_exists('references', $step->dsl)) {
47
            throw new \Exception("Can not execute Trash restore because multiple types match, and a references section is specified in the dsl. References can be set when only 1 section matches");
48
        }
49
50
        $trashService = $this->repository->getTrashService();
51
        foreach ($itemsCollection as $key => $item) {
52
            /// @todo support handling of custom restoration locations
53
            $trashService->recover($item);
54
        }
55
56
        $this->setReferences($itemsCollection, $step);
57
58
        return $itemsCollection;
59
    }
60
61
    /**
62
     * Handles the trash-restore migration action
@@ 64-82 (lines=19) @@
61
    /**
62
     * Handles the trash-restore migration action
63
     */
64
    protected function delete($step)
65
    {
66
        $itemsCollection = $this->matchItems('delete', $step);
67
68
        if (count($itemsCollection) > 1 && array_key_exists('references', $step->dsl)) {
69
            throw new \Exception("Can not execute Trash restore because multiple types match, and a references section is specified in the dsl. References can be set when only 1 section matches");
70
        }
71
72
        $this->setReferences($itemsCollection, $step);
73
74
        $trashService = $this->repository->getTrashService();
75
        foreach ($itemsCollection as $key => $item) {
76
            $trashService->deleteTrashItem($item);
77
        }
78
79
        $this->setReferences($itemsCollection, $step);
80
81
        return $itemsCollection;
82
    }
83
84
    /**
85
     * @param string $action