Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
37 | private function insertIntoPostForms(ResponseInterface $response, callable $replace) |
||
38 | { |
||
39 | $html = (string) $response->getBody(); |
||
40 | $html = preg_replace_callback('/(<form\s[^>]*method=["\']?POST["\']?[^>]*>)/i', $replace, $html, -1, $count); |
||
41 | |||
42 | if (!empty($count)) { |
||
43 | $body = Middleware::createStream(); |
||
44 | $body->write($html); |
||
45 | |||
46 | return $response->withBody($body); |
||
47 | } |
||
48 | |||
49 | return $response; |
||
50 | } |
||
51 | } |
||
52 |