Code Duplication    Length = 22-23 lines in 2 locations

src/OroCRM/Bundle/MagentoBundle/ImportExport/Strategy/GuestCustomerStrategy.php 1 location

@@ 62-83 (lines=22) @@
59
     * @param Customer $entity
60
     * @return array
61
     */
62
    protected function getSearchContext(Customer $entity)
63
    {
64
        $searchContext = [
65
            'email' => $entity->getEmail(),
66
            'channel' => $entity->getChannel()
67
        ];
68
69
        if ($entity->getWebsite()) {
70
            $website = $this->databaseHelper->findOneBy(
71
                'OroCRM\Bundle\MagentoBundle\Entity\Website',
72
                [
73
                    'originId' => $entity->getWebsite()->getOriginId(),
74
                    'channel' => $entity->getChannel()
75
                ]
76
            );
77
            if ($website) {
78
                $searchContext['website'] = $website;
79
            }
80
        }
81
82
        return $searchContext;
83
    }
84
85
    /**
86
     * @param Customer $entity

src/OroCRM/Bundle/MagentoBundle/ImportExport/Strategy/OrderWithExistingCustomerStrategy.php 1 location

@@ 111-133 (lines=23) @@
108
     * @param Order $order
109
     * @return array
110
     */
111
    protected function getSearchContext(Order $order)
112
    {
113
        $customer = $order->getCustomer();
114
        $searchContext = [
115
            'email' => $order->getCustomerEmail(),
116
            'channel' => $customer->getChannel()
117
        ];
118
119
        if ($customer->getWebsite()) {
120
            $website = $this->databaseHelper->findOneBy(
121
                'OroCRM\Bundle\MagentoBundle\Entity\Website',
122
                [
123
                    'originId' => $customer->getWebsite()->getOriginId(),
124
                    'channel' => $customer->getChannel()
125
                ]
126
            );
127
            if ($website) {
128
                $searchContext['website'] = $website;
129
            }
130
        }
131
132
        return $searchContext;
133
    }
134
135
    /**
136
     * Get existing entity