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
135
        return count($elements);
136
    }
137
138
    protected function findElement($selector, $locator, $index)
@@ 138-149 (lines=12) @@
135
        return count($elements);
136
    }
137
138
    protected function findElement($selector, $locator, $index)
139
    {
140
        $page = $this->getSession()->getPage();
141
142
        $nodes = $page->findAll($selector, $locator);
143
144
        if (!isset($nodes[$index - 1])) {
145
            throw new \Exception("The $index $selector '$locator' was not found anywhere in the page");
146
        }
147
148
        return $nodes[$index - 1];
149
    }
150
}
151