Code Duplication    Length = 11-14 lines in 4 locations

src/Subjects/BunchSubject.php 4 locations

@@ 563-576 (lines=14) @@
560
     * @return integer The ID of the actual store
561
     * @throws \Exception Is thrown, if the store with the actual code is not available
562
     */
563
    public function getRowStoreId()
564
    {
565
566
        // load the store view code the create the product/attributes for
567
        $storeViewCode = $this->getStoreViewCode();
568
569
        // query whether or not, the requested store is available
570
        if (isset($this->stores[$storeViewCode])) {
571
            return (integer) $this->stores[$storeViewCode][MemberNames::STORE_ID];
572
        }
573
574
        // throw an exception, if not
575
        throw new \Exception(sprintf('Found invalid store view code %s', $storeViewCode));
576
    }
577
578
    /**
579
     * Return's the tax class ID for the passed tax class name.
@@ 586-596 (lines=11) @@
583
     * @return integer The tax class ID
584
     * @throws \Exception Is thrown, if the tax class with the requested name is not available
585
     */
586
    public function getTaxClassIdByTaxClassName($taxClassName)
587
    {
588
589
        // query whether or not, the requested tax class is available
590
        if (isset($this->taxClasses[$taxClassName])) {
591
            return (integer) $this->taxClasses[$taxClassName][MemberNames::CLASS_ID];
592
        }
593
594
        // throw an exception, if not
595
        throw new \Exception(sprintf('Found invalid tax class name %s', $taxClassName));
596
    }
597
598
    /**
599
     * Return's the store website for the passed code.
@@ 606-616 (lines=11) @@
603
     * @return integer The store website ID
604
     * @throws \Exception Is thrown, if the store website with the requested code is not available
605
     */
606
    public function getStoreWebsiteIdByCode($code)
607
    {
608
609
        // query whether or not, the requested store website is available
610
        if (isset($this->storeWebsites[$code])) {
611
            return (integer) $this->storeWebsites[$code][MemberNames::WEBSITE_ID];
612
        }
613
614
        // throw an exception, if not
615
        throw new \Exception(sprintf('Found invalid website code %s', $code));
616
    }
617
618
    /**
619
     * Return's the visibility key for the passed visibility string.
@@ 808-821 (lines=14) @@
805
     * @return array The store's root category
806
     * @throws \Exception Is thrown if the root category for the passed store code is NOT available
807
     */
808
    public function getRootCategory()
809
    {
810
811
        // load the actual store view code
812
        $storeViewCode = $this->getStoreViewCode();
813
814
        // query weather or not we've a root category or not
815
        if (isset($this->rootCategories[$storeViewCode])) {
816
            return $this->rootCategories[$storeViewCode];
817
        }
818
819
        // throw an exception if the root category is NOT available
820
        throw new \Exception(sprintf('Root category for %s is not available', $storeViewCode));
821
    }
822
823
    /**
824
     * Persist's the passed product data and return's the ID.