Passed
Push — 1.x ( 885d6a...11c6d3 )
by Kevin
01:56
created

HtmlResponse::find()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace Zenstruck\Browser\Response;
4
5
use Zenstruck\Browser\Response;
6
7
/**
8
 * @author Kevin Bond <[email protected]>
9
 */
10
class HtmlResponse extends Response
11
{
12
    final public function find(string $selector): string
13
    {
14
        if (!$element = $this->session()->getPage()->find('css', $selector)) {
15
            throw new \RuntimeException("Element \"{$selector}\" not found.");
16
        }
17
18
        return $element->getHtml();
19
    }
20
}
21