Code Duplication    Length = 12-14 lines in 3 locations

src/Transfer/EzPlatform/Repository/Manager/ContentManager.php 1 location

@@ 186-199 (lines=14) @@
183
    /**
184
     * {@inheritdoc}
185
     */
186
    public function createOrUpdate(ObjectInterface $object)
187
    {
188
        if (!$object instanceof ContentObject) {
189
            throw new UnsupportedObjectOperationException(ContentObject::class, get_class($object));
190
        }
191
192
        try {
193
            $this->find($object);
194
195
            return $this->update($object);
196
        } catch (NotFoundException $notFound) {
197
            return $this->create($object);
198
        }
199
    }
200
201
    /**
202
     * {@inheritdoc}

src/Transfer/EzPlatform/Repository/Manager/LocationManager.php 2 locations

@@ 175-188 (lines=14) @@
172
    /**
173
     * {@inheritdoc}
174
     */
175
    public function createOrUpdate(ObjectInterface $object)
176
    {
177
        if (!$object instanceof LocationObject) {
178
            throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object));
179
        }
180
181
        try {
182
            $this->find($object);
183
184
            return $this->update($object);
185
        } catch (NotFoundException $notFound) {
186
            return $this->create($object);
187
        }
188
    }
189
190
    /**
191
     * Creates/updates/deletes locations in ContentObject->parent_locations.
@@ 244-255 (lines=12) @@
241
    /**
242
     * {@inheritdoc}
243
     */
244
    public function remove(ObjectInterface $object)
245
    {
246
        if (!$object instanceof LocationObject) {
247
            throw new UnsupportedObjectOperationException(LocationObject::class, get_class($object));
248
        }
249
250
        if ($location = $this->find($object)) {
251
            $this->locationService->deleteLocation($location);
252
        }
253
254
        return true;
255
    }
256
257
    /**
258
     * Hides a location.