Code Duplication    Length = 9-10 lines in 2 locations

src/Sylius/Behat/Context/Transform/OrderContext.php 2 locations

@@ 50-58 (lines=9) @@
47
    /**
48
     * @Transform :order
49
     */
50
    public function getOrderByNumber($orderNumber)
51
    {
52
        $orderNumber = $this->getOrderNumber($orderNumber);
53
        $order = $this->orderRepository->findOneBy(['number' => $orderNumber]);
54
55
        Assert::notNull($order, sprintf('Cannot find order with number %s', $orderNumber));
56
57
        return $order;
58
    }
59
60
    /**
61
     * @Transform /^this order made by "([^"]+)"$/
@@ 63-72 (lines=10) @@
60
    /**
61
     * @Transform /^this order made by "([^"]+)"$/
62
     */
63
    public function getOrderByCustomer($email)
64
    {
65
        $customer = $this->customerRepository->findOneBy(['email' => $email]);
66
        Assert::notNull($customer, sprintf('Cannot find customer with email %s.', $email));
67
68
        $orders = $this->orderRepository->findByCustomer($customer);
69
        Assert::notEmpty($orders);
70
71
        return end($orders);
72
    }
73
74
    /**
75
     * @Transform :orderNumber