Code Duplication    Length = 13-16 lines in 2 locations

src/Subjects/AbstractProductSubject.php 2 locations

@@ 742-754 (lines=13) @@
739
     *
740
     * @return array The link attribute
741
     */
742
    public function getProductLinkAttribute($linkTypeId, $attributeCode)
743
    {
744
745
        // try to load the link attribute with the passed link type ID and attribute code
746
        foreach ($this->linkAttributes as $linkAttribute) {
747
            if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId &&
748
                $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] === $attributeCode
749
            ) {
750
                // return the matching link attribute
751
                return $linkAttribute;
752
            }
753
        }
754
    }
755
756
    /**
757
     * Return's the link attribute for the passed link type and attribute code.
@@ 764-779 (lines=16) @@
761
     *
762
     * @return array The link attribute
763
     */
764
    public function getProductLinkAttributeByLinkTypeCodeAndAttributeCode($linkTypeCode, $attributeCode)
765
    {
766
767
        // map the link type code => ID
768
        $linkTypeId = $this->mapLinkTypeCodeToLinkTypeId($linkTypeCode);
769
770
        // try to load the link attribute with the passed link type ID and attribute code
771
        foreach ($this->linkAttributes as $linkAttribute) {
772
            if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId &&
773
                $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] === $attributeCode
774
            ) {
775
                // return the matching link attribute
776
                return $linkAttribute;
777
            }
778
        }
779
    }
780
781
    /**
782
     * Returns the product link attributes for the passed link type code.