Code Duplication    Length = 8-8 lines in 2 locations

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

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

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