Code Duplication    Length = 8-8 lines in 2 locations

codeception/_support/Page/Front/ProductDetailPage.php 1 location

@@ 80-87 (lines=8) @@
77
    public function カートに入れる($num, $category1 = null, $category2 = null)
78
    {
79
        $this->tester->fillField(['id' => 'quantity'], $num);
80
        if (!is_null($category1)) {
81
            $this->tester->selectOption(['id' => 'classcategory_id1'], $category1);
82
            if (!is_null($category2)) {
83
                $category2_id = current(array_keys($category2));
84
                $this->tester->waitForElement(['xpath' => "//*[@id='classcategory_id2']/option[@value='${category2_id}']"]);
85
                $this->tester->selectOption(['id' => 'classcategory_id2'], $category2);
86
            }
87
        }
88
        $this->tester->click(['class' => 'add-cart']);
89
        $this->tester->waitForElementVisible(['css' => 'div.ec-modal-box']);
90

codeception/_support/Page/Front/ProductListPage.php 1 location

@@ 55-62 (lines=8) @@
52
    public function カートに入れる($index, $num = 1, $category1 = null, $category2 = null)
53
    {
54
        $this->tester->fillField(['css' => "ul.ec-shelfGrid li.ec-shelfGrid__item:nth-child(${index}) form input[name='quantity']"], $num);
55
        if (!is_null($category1)) {
56
            $this->tester->selectOption(['css' => "ul.ec-shelfGrid li.ec-shelfGrid__item:nth-child(${index}) form select[name='classcategory_id1']"], $category1);
57
            if (!is_null($category2)) {
58
                $category2_id = current(array_keys($category2));
59
                $this->tester->waitForElement(['xpath' => "//ul[@class='ec-shelfGrid']/li[@class='ec-shelfGrid__item'][${index}]//select[@name='classcategory_id2']/option[@value='${category2_id}']"]);
60
                $this->tester->selectOption(['css' => "ul.ec-shelfGrid li.ec-shelfGrid__item:nth-child(${index}) form select[name='classcategory_id2']"], $category2);
61
            }
62
        }
63
        $this->tester->click(['class' => 'add-cart']);
64
        $this->tester->waitForElementVisible(['css' => 'div.ec-modal-box']);
65