Code Duplication    Length = 13-16 lines in 2 locations

src/Subjects/AbstractProductSubject.php 2 locations

@@ 718-730 (lines=13) @@
715
     *
716
     * @return array The link attribute
717
     */
718
    public function getProductLinkAttribute($linkTypeId, $attributeCode)
719
    {
720
721
        // try to load the link attribute with the passed link type ID and attribute code
722
        foreach ($this->linkAttributes as $linkAttribute) {
723
            if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId &&
724
                $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] === $attributeCode
725
            ) {
726
                // return the matching link attribute
727
                return $linkAttribute;
728
            }
729
        }
730
    }
731
732
    /**
733
     * Return's the link attribute for the passed link type and attribute code.
@@ 740-755 (lines=16) @@
737
     *
738
     * @return array The link attribute
739
     */
740
    public function getProductLinkAttributeByLinkTypeCodeAndAttributeCode($linkTypeCode, $attributeCode)
741
    {
742
743
        // map the link type code => ID
744
        $linkTypeId = $this->mapLinkTypeCodeToLinkTypeId($linkTypeCode);
745
746
        // try to load the link attribute with the passed link type ID and attribute code
747
        foreach ($this->linkAttributes as $linkAttribute) {
748
            if ($linkAttribute[MemberNames::LINK_TYPE_ID] === $linkTypeId &&
749
                $linkAttribute[MemberNames::PRODUCT_LINK_ATTRIBUTE_CODE] === $attributeCode
750
            ) {
751
                // return the matching link attribute
752
                return $linkAttribute;
753
            }
754
        }
755
    }
756
757
    /**
758
     * Returns the product link attributes for the passed link type code.