Code Duplication    Length = 15-15 lines in 3 locations

src/Subjects/BunchSubject.php 1 location

@@ 267-281 (lines=15) @@
264
     * @return array The requested entity type
265
     * @throws \Exception Is thrown, if the requested entity type is not available
266
     */
267
    public function getEntityType()
268
    {
269
270
        // query whether or not the entity type with the passed code is available
271
        if (isset($this->entityTypes[$entityTypeCode = $this->getEntityTypeCode()])) {
272
            return $this->entityTypes[$entityTypeCode];
273
        }
274
275
        // throw a new exception
276
        throw new \Exception(
277
            $this->appendExceptionSuffix(
278
                sprintf('Requested entity type "%s" is not available', $entityTypeCode)
279
            )
280
        );
281
    }
282
283
    /**
284
     * Return's TRUE, if the passed URL key varchar value IS related with the actual PK.

src/Subjects/AbstractCategorySubject.php 2 locations

@@ 399-413 (lines=15) @@
396
     * @return integer The store website ID
397
     * @throws \Exception Is thrown, if the store website with the requested code is not available
398
     */
399
    public function getStoreWebsiteIdByCode($code)
400
    {
401
402
        // query whether or not, the requested store website is available
403
        if (isset($this->storeWebsites[$code])) {
404
            return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID];
405
        }
406
407
        // throw an exception, if not
408
        throw new \Exception(
409
            $this->appendExceptionSuffix(
410
                sprintf('Found invalid website code "%s"', $code)
411
            )
412
        );
413
    }
414
415
    /**
416
     * Return's the category with the passed path.
@@ 253-267 (lines=15) @@
250
     * @return integer The mapped entity ID
251
     * @throws \Exception Is thrown, if the path can not be mapped
252
     */
253
    public function mapPathEntityId($path)
254
    {
255
256
        // query whether or not a entity ID for the passed path has been mapped
257
        if (isset($this->pathEntityIdMapping[$unifiedPath = $this->unifyPath($path)])) {
258
            return $this->pathEntityIdMapping[$unifiedPath];
259
        }
260
261
        // throw an exception if not
262
        throw new \Exception(
263
            $this->appendExceptionSuffix(
264
                sprintf('Can\'t map path %s to any entity ID', $path)
265
            )
266
        );
267
    }
268
269
    /**
270
     * Add the passed path => store view code mapping.