Code Duplication    Length = 11-14 lines in 4 locations

src/Subjects/BunchSubject.php 4 locations

@@ 518-531 (lines=14) @@
515
     * @return integer The ID of the actual store
516
     * @throws \Exception Is thrown, if the store with the actual code is not available
517
     */
518
    public function getRowStoreId()
519
    {
520
521
        // load the store view code the create the product/attributes for
522
        $storeViewCode = $this->getStoreViewCode();
523
524
        // query whether or not, the requested store is available
525
        if (isset($this->stores[$storeViewCode])) {
526
            return (integer) $this->stores[$storeViewCode][MemberNames::STORE_ID];
527
        }
528
529
        // throw an exception, if not
530
        throw new \Exception(sprintf('Found invalid store view code %s', $storeViewCode));
531
    }
532
533
    /**
534
     * Return's the tax class ID for the passed tax class name.
@@ 541-551 (lines=11) @@
538
     * @return integer The tax class ID
539
     * @throws \Exception Is thrown, if the tax class with the requested name is not available
540
     */
541
    public function getTaxClassIdByTaxClassName($taxClassName)
542
    {
543
544
        // query whether or not, the requested tax class is available
545
        if (isset($this->taxClasses[$taxClassName])) {
546
            return (integer) $this->taxClasses[$taxClassName][MemberNames::CLASS_ID];
547
        }
548
549
        // throw an exception, if not
550
        throw new \Exception(sprintf('Found invalid tax class name %s', $taxClassName));
551
    }
552
553
    /**
554
     * Return's the store website for the passed code.
@@ 561-571 (lines=11) @@
558
     * @return integer The store website ID
559
     * @throws \Exception Is thrown, if the store website with the requested code is not available
560
     */
561
    public function getStoreWebsiteIdByCode($code)
562
    {
563
564
        // query whether or not, the requested store website is available
565
        if (isset($this->storeWebsites[$code])) {
566
            return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID];
567
        }
568
569
        // throw an exception, if not
570
        throw new \Exception(sprintf('Found invalid website code %s', $code));
571
    }
572
573
    /**
574
     * Return's the visibility key for the passed visibility string.
@@ 763-776 (lines=14) @@
760
     * @return array The store's root category
761
     * @throws \Exception Is thrown if the root category for the passed store code is NOT available
762
     */
763
    public function getRootCategory()
764
    {
765
766
        // load the actual store view code
767
        $storeViewCode = $this->getStoreViewCode();
768
769
        // query weather or not we've a root category or not
770
        if (isset($this->rootCategories[$storeViewCode])) {
771
            return $this->rootCategories[$storeViewCode];
772
        }
773
774
        // throw an exception if the root category is NOT available
775
        throw new \Exception(sprintf('Root category for %s is not available', $storeViewCode));
776
    }
777
778
    /**
779
     * Persist's the passed product data and return's the ID.