| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function getStatusCode($path) |
||
| 21 | { |
||
| 22 | // The "Goutte" session should be used because it provides HTTP status codes. |
||
| 23 | // Visit path once again if current session driver is not Goutte. |
||
| 24 | if (!($this->getSessionDriver() instanceof GoutteDriver)) { |
||
| 25 | $this->visitPath($path, 'goutte'); |
||
| 26 | } |
||
| 27 | |||
| 28 | $statusCode = (int) $this->getSession('goutte')->getStatusCode(); |
||
| 29 | |||
| 30 | self::debug(['HTTP status code: %s'], [$statusCode]); |
||
| 31 | |||
| 32 | return $statusCode; |
||
| 33 | } |
||
| 34 | } |
||
| 35 |