Code Duplication    Length = 17-17 lines in 2 locations

eZ/Publish/Core/Persistence/Cache/ContentTypeHandler.php 1 location

@@ 222-238 (lines=17) @@
219
    /**
220
     * @see \eZ\Publish\SPI\Persistence\Content\Type\Handler::create
221
     */
222
    public function create(CreateStruct $contentType)
223
    {
224
        $this->logger->logCall(__METHOD__, array('struct' => $contentType));
225
        $type = $this->persistenceHandler->contentTypeHandler()->create($contentType);
226
227
        if ($type->status === Type::STATUS_DEFINED) {
228
            // Warm-up cache
229
            $this->cache->save(
230
                $this->cache->getItem('ez-content-type-'.$type->id)
231
                    ->set($type)
232
                    ->tag('type-'.$type->id)
233
            );
234
            $this->cache->invalidateTags(['type-map']);
235
        }
236
237
        return $type;
238
    }
239
240
    /**
241
     * @see \eZ\Publish\SPI\Persistence\Content\Type\Handler::update

eZ/Publish/Core/Persistence/Cache/LocationHandler.php 1 location

@@ 216-232 (lines=17) @@
213
    /**
214
     * @inheritdoc
215
     */
216
    public function create(CreateStruct $locationStruct)
217
    {
218
        $this->logger->logCall(__METHOD__, array('struct' => $locationStruct));
219
        $location = $this->persistenceHandler->locationHandler()->create($locationStruct);
220
221
        // invalidate cache connected to the content
222
        $this->cache->invalidateTags(['content-'.$locationStruct->contentId]);
223
224
        // warm-up cache
225
        $this->cache->save(
226
            $this->cache->getItem('location-'.$location->id)
227
                ->set($location)
228
                ->tag($this->getCacheTags($location))
229
        );
230
231
        return $location;
232
    }
233
234
    /**
235
     * @inheritdoc