Code Duplication    Length = 12-12 lines in 2 locations

src/Context/BaseContext.php 2 locations

@@ 124-135 (lines=12) @@
121
        return $context;
122
    }
123
124
    protected function countElements($element, $index, $parent)
125
    {
126
        $page = $this->getSession()->getPage();
127
128
        $parents = $page->findAll('css', $parent);
129
        if (!isset($parents[$index - 1])) {
130
            throw new \Exception("The $index element '$parent' was not found anywhere in the page");
131
        }
132
133
        $elements = $parents[$index - 1]->findAll('css', $element);
134
        return count($elements);
135
    }
136
137
    protected function findElement($selector, $locator, $index)
138
    {
@@ 137-148 (lines=12) @@
134
        return count($elements);
135
    }
136
137
    protected function findElement($selector, $locator, $index)
138
    {
139
        $page = $this->getSession()->getPage();
140
141
        $nodes = $page->findAll($selector, $locator);
142
143
        if (!isset($nodes[$index - 1])) {
144
            throw new \Exception("The $index $selector '$locator' was not found anywhere in the page");
145
        }
146
147
        return $nodes[$index - 1];
148
    }
149
}
150