Code Duplication    Length = 15-15 lines in 4 locations

src/Subjects/AbstractProductSubject.php 3 locations

@@ 446-460 (lines=15) @@
443
     * @return integer The tax class ID
444
     * @throws \Exception Is thrown, if the tax class with the requested name is not available
445
     */
446
    public function getTaxClassIdByTaxClassName($taxClassName)
447
    {
448
449
        // query whether or not, the requested tax class is available
450
        if (isset($this->taxClasses[$taxClassName])) {
451
            return (integer) $this->taxClasses[$taxClassName][MemberNames::CLASS_ID];
452
        }
453
454
        // throw an exception, if not
455
        throw new \Exception(
456
            $this->appendExceptionSuffix(
457
                sprintf('Found invalid tax class name %s', $taxClassName)
458
            )
459
        );
460
    }
461
462
    /**
463
     * Return's the store website for the passed code.
@@ 470-484 (lines=15) @@
467
     * @return integer The store website ID
468
     * @throws \Exception Is thrown, if the store website with the requested code is not available
469
     */
470
    public function getStoreWebsiteIdByCode($code)
471
    {
472
473
        // query whether or not, the requested store website is available
474
        if (isset($this->storeWebsites[$code])) {
475
            return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID];
476
        }
477
478
        // throw an exception, if not
479
        throw new \Exception(
480
            $this->appendExceptionSuffix(
481
                sprintf('Found invalid website code %s', $code)
482
            )
483
        );
484
    }
485
486
    /**
487
     * Return's the category with the passed path.
@@ 666-680 (lines=15) @@
663
     * @return integer The mapped link type ID
664
     * @throws \TechDivision\Import\Product\Exceptions\MapLinkTypeCodeToIdException Is thrown if the link type code is not mapped yet
665
     */
666
    public function mapLinkTypeCodeToLinkTypeId($linkTypeCode)
667
    {
668
669
        // query weather or not the link type code has been mapped
670
        if (isset($this->linkTypes[$linkTypeCode])) {
671
            return $this->linkTypes[$linkTypeCode][MemberNames::LINK_TYPE_ID];
672
        }
673
674
        // throw an exception if the link type code has not been mapped yet
675
        throw new MapLinkTypeCodeToIdException(
676
            $this->appendExceptionSuffix(
677
                sprintf('Found not mapped link type code %s', $linkTypeCode)
678
            )
679
        );
680
    }
681
682
    /**
683
     * Return's the link attribute for the passed link type ID and attribute code.

src/Subjects/BunchSubject.php 1 location

@@ 319-333 (lines=15) @@
316
     * @return array The requested entity type
317
     * @throws \Exception Is thrown, if the requested entity type is not available
318
     */
319
    public function getEntityType()
320
    {
321
322
        // query whether or not the entity type with the passed code is available
323
        if (isset($this->entityTypes[$entityTypeCode = $this->getEntityTypeCode()])) {
324
            return $this->entityTypes[$entityTypeCode];
325
        }
326
327
        // throw a new exception
328
        throw new \Exception(
329
            $this->appendExceptionSuffix(
330
                sprintf('Requested entity type "%s" is not available', $entityTypeCode)
331
            )
332
        );
333
    }
334
335
    /**
336
     * Loads and returns the media roles.