Code Duplication    Length = 12-12 lines in 2 locations

src/Sylius/Behat/Context/Ui/PaypalContext.php 1 location

@@ 132-143 (lines=12) @@
129
     *
130
     * @throws \RuntimeException
131
     */
132
    private function getLastOrder()
133
    {
134
        $customer = $this->sharedStorage->get('user')->getCustomer();
135
        $orders = $this->orderRepository->findByCustomer($customer);
136
        $lastOrder = end($orders);
137
138
        if (false === $lastOrder) {
139
            throw new \RuntimeException(sprintf('There is no last order for %s', $customer->getFullName()));
140
        }
141
142
        return $lastOrder;
143
    }
144
}
145

src/Sylius/Behat/Context/Ui/CheckoutContext.php 1 location

@@ 736-747 (lines=12) @@
733
     *
734
     * @throws \RuntimeException
735
     */
736
    private function getLastOrder()
737
    {
738
        $customer = $this->sharedStorage->get('user')->getCustomer();
739
        $orders = $this->orderRepository->findByCustomer($customer);
740
        $lastOrder = end($orders);
741
742
        if (false === $lastOrder) {
743
            throw new \RuntimeException(sprintf('There is no last order for %s', $customer->getFullName()));
744
        }
745
746
        return $lastOrder;
747
    }
748
}
749