Code Duplication    Length = 16-17 lines in 2 locations

eZ/Publish/Core/Repository/URLWildcardService.php 1 location

@@ 140-156 (lines=17) @@
137
     *
138
     * @param \eZ\Publish\API\Repository\Values\Content\UrlWildcard $urlWildcard the url wildcard to remove
139
     */
140
    public function remove(URLWildcard $urlWildcard)
141
    {
142
        if ($this->repository->hasAccess('content', 'urltranslator') !== true) {
143
            throw new UnauthorizedException('content', 'urltranslator');
144
        }
145
146
        $this->repository->beginTransaction();
147
        try {
148
            $this->urlWildcardHandler->remove(
149
                $urlWildcard->id
150
            );
151
            $this->repository->commit();
152
        } catch (Exception $e) {
153
            $this->repository->rollback();
154
            throw $e;
155
        }
156
    }
157
158
    /**
159
     * Loads a url wild card.

eZ/Publish/Core/Repository/TrashService.php 1 location

@@ 217-232 (lines=16) @@
214
     *
215
     * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to empty the trash
216
     */
217
    public function emptyTrash()
218
    {
219
        if ($this->repository->hasAccess('content', 'cleantrash') !== true) {
220
            throw new UnauthorizedException('content', 'cleantrash');
221
        }
222
223
        $this->repository->beginTransaction();
224
        try {
225
            // Persistence layer takes care of deleting content objects
226
            $this->persistenceHandler->trashHandler()->emptyTrash();
227
            $this->repository->commit();
228
        } catch (Exception $e) {
229
            $this->repository->rollback();
230
            throw $e;
231
        }
232
    }
233
234
    /**
235
     * Deletes a trash item.