Code Duplication    Length = 15-15 lines in 4 locations

src/Subjects/BunchSubject.php 1 location

@@ 305-319 (lines=15) @@
302
     * @return array The requested entity type
303
     * @throws \Exception Is thrown, if the requested entity type is not available
304
     */
305
    public function getEntityType()
306
    {
307
308
        // query whether or not the entity type with the passed code is available
309
        if (isset($this->entityTypes[$entityTypeCode = $this->getEntityTypeCode()])) {
310
            return $this->entityTypes[$entityTypeCode];
311
        }
312
313
        // throw a new exception
314
        throw new \Exception(
315
            $this->appendExceptionSuffix(
316
                sprintf('Requested entity type "%s" is not available', $entityTypeCode)
317
            )
318
        );
319
    }
320
321
    /**
322
     * Return's TRUE, if the passed URL key varchar value IS related with the actual PK.

src/Subjects/AbstractProductSubject.php 3 locations

@@ 455-469 (lines=15) @@
452
     * @return integer The tax class ID
453
     * @throws \Exception Is thrown, if the tax class with the requested name is not available
454
     */
455
    public function getTaxClassIdByTaxClassName($taxClassName)
456
    {
457
458
        // query whether or not, the requested tax class is available
459
        if (isset($this->taxClasses[$taxClassName])) {
460
            return (integer) $this->taxClasses[$taxClassName][MemberNames::CLASS_ID];
461
        }
462
463
        // throw an exception, if not
464
        throw new \Exception(
465
            $this->appendExceptionSuffix(
466
                sprintf('Found invalid tax class name %s', $taxClassName)
467
            )
468
        );
469
    }
470
471
    /**
472
     * Return's the store website for the passed code.
@@ 479-493 (lines=15) @@
476
     * @return integer The store website ID
477
     * @throws \Exception Is thrown, if the store website with the requested code is not available
478
     */
479
    public function getStoreWebsiteIdByCode($code)
480
    {
481
482
        // query whether or not, the requested store website is available
483
        if (isset($this->storeWebsites[$code])) {
484
            return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID];
485
        }
486
487
        // throw an exception, if not
488
        throw new \Exception(
489
            $this->appendExceptionSuffix(
490
                sprintf('Found invalid website code %s', $code)
491
            )
492
        );
493
    }
494
495
    /**
496
     * Return's the category with the passed path.
@@ 709-723 (lines=15) @@
706
     * @return integer The mapped link type ID
707
     * @throws \TechDivision\Import\Product\Exceptions\MapLinkTypeCodeToIdException Is thrown if the link type code is not mapped yet
708
     */
709
    public function mapLinkTypeCodeToLinkTypeId($linkTypeCode)
710
    {
711
712
        // query weather or not the link type code has been mapped
713
        if (isset($this->linkTypes[$linkTypeCode])) {
714
            return $this->linkTypes[$linkTypeCode][MemberNames::LINK_TYPE_ID];
715
        }
716
717
        // throw an exception if the link type code has not been mapped yet
718
        throw new MapLinkTypeCodeToIdException(
719
            $this->appendExceptionSuffix(
720
                sprintf('Found not mapped link type code %s', $linkTypeCode)
721
            )
722
        );
723
    }
724
725
    /**
726
     * Return's the link attribute for the passed link type ID and attribute code.