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

HtmlResponse   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
dl 0
loc 9
rs 10
c 1
b 0
f 1
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A find() 0 7 2
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