Code Duplication    Length = 15-15 lines in 4 locations

src/Subjects/BunchSubject.php 1 location

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

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.
@@ 694-708 (lines=15) @@
691
     * @return integer The mapped link type ID
692
     * @throws \TechDivision\Import\Product\Exceptions\MapLinkTypeCodeToIdException Is thrown if the link type code is not mapped yet
693
     */
694
    public function mapLinkTypeCodeToLinkTypeId($linkTypeCode)
695
    {
696
697
        // query weather or not the link type code has been mapped
698
        if (isset($this->linkTypes[$linkTypeCode])) {
699
            return $this->linkTypes[$linkTypeCode][MemberNames::LINK_TYPE_ID];
700
        }
701
702
        // throw an exception if the link type code has not been mapped yet
703
        throw new MapLinkTypeCodeToIdException(
704
            $this->appendExceptionSuffix(
705
                sprintf('Found not mapped link type code %s', $linkTypeCode)
706
            )
707
        );
708
    }
709
710
    /**
711
     * Return's the link attribute for the passed link type ID and attribute code.