Code Duplication    Length = 14-14 lines in 2 locations

src/Context/BrowserContext.php 2 locations

@@ 77-90 (lines=14) @@
74
     *
75
     * @When (I )follow the :index :link link
76
     */
77
    public function iFollowTheNthLink($index, $link)
78
    {
79
        $page = $this->getSession()->getPage();
80
81
        $links = $page->findAll('named', [
82
            'link', $this->getSession()->getSelectorsHandler()->xpathLiteral($link)
83
        ]);
84
85
        if (!isset($links[$index - 1])) {
86
            throw new \Exception("The $index link '$link' was not found anywhere in the page");
87
        }
88
89
        $links[$index - 1]->click();
90
    }
91
92
    /**
93
     * Presses the nth specified button
@@ 97-110 (lines=14) @@
94
     *
95
     * @When (I )press the :index :button
96
     */
97
    public function pressTheNthButton($index, $button)
98
    {
99
        $page = $this->getSession()->getPage();
100
101
        $buttons = $page->findAll('named', [
102
            'button', $this->getSession()->getSelectorsHandler()->xpathLiteral($button)
103
        ]);
104
105
        if (!isset($buttons[$index - 1])) {
106
            throw new \Exception("The $index button '$button' was not found anywhere in the page");
107
        }
108
109
        $buttons[$index - 1]->press();
110
    }
111
112
    /**
113
     * Fills in form field with current date