Code Duplication    Length = 13-16 lines in 2 locations

src/Subjects/AbstractProductSubject.php 2 locations

@@ 733-745 (lines=13) @@
730
     *
731
     * @return array The link attribute
732
     */
733
    public function getProductLinkAttribute($linkTypeId, $attributeCode)
734
    {
735
736
        // try to load the link attribute with the passed link type ID and attribute code
737
        foreach ($this->linkAttributes as $linkAttribute) {
738
            if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId &&
739
                $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] === $attributeCode
740
            ) {
741
                // return the matching link attribute
742
                return $linkAttribute;
743
            }
744
        }
745
    }
746
747
    /**
748
     * Return's the link attribute for the passed link type and attribute code.
@@ 755-770 (lines=16) @@
752
     *
753
     * @return array The link attribute
754
     */
755
    public function getProductLinkAttributeByLinkTypeCodeAndAttributeCode($linkTypeCode, $attributeCode)
756
    {
757
758
        // map the link type code => ID
759
        $linkTypeId = $this->mapLinkTypeCodeToLinkTypeId($linkTypeCode);
760
761
        // try to load the link attribute with the passed link type ID and attribute code
762
        foreach ($this->linkAttributes as $linkAttribute) {
763
            if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId &&
764
                $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] === $attributeCode
765
            ) {
766
                // return the matching link attribute
767
                return $linkAttribute;
768
            }
769
        }
770
    }
771
772
    /**
773
     * Returns the product link attributes for the passed link type code.