| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 2 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | 14 | public function create(Response $response, $affectedUrl = null) { |
|
| 23 | 14 | $html = $response->getBody(); |
|
| 24 | 14 | $html = Helper::safeEncodeStr((string) $html); |
|
| 25 | 14 | $contentType = $response->getHeaderLine('content-type'); |
|
| 26 | 14 | $html = HtmlEncodingConverter::convertToUtf($html, $contentType); |
|
|
|
|||
| 27 | 14 | $page = new ElementFinder((string) $html); |
|
| 28 | |||
| 29 | 14 | if ($affectedUrl !== null) { |
|
| 30 | 4 | LinkConverter::convertUrlsToAbsolute($page, $affectedUrl); |
|
| 31 | 4 | } |
|
| 32 | |||
| 33 | 14 | return $page; |
|
| 34 | } |
||
| 35 | |||
| 36 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: