Mercurial > SimpleWebPresenter
comparison StatusCodes.inc @ 83:ff5fc61aa5ea
Throw only specific exceptions, eg. non of type Exception base.
| author | Tom Fredrik "BFG" Klaussen <bfg@blenning.no> |
|---|---|
| date | Mon, 15 Oct 2012 16:52:28 +0200 |
| parents | 5e76b6feb2ad |
| children |
comparison
equal
deleted
inserted
replaced
| 82:4acaab0b02e2 | 83:ff5fc61aa5ea |
|---|---|
| 301 public static function codeFromHeader($header) | 301 public static function codeFromHeader($header) |
| 302 { | 302 { |
| 303 $matches = array(); | 303 $matches = array(); |
| 304 preg_match('/HTTP\/\S+\s(\d+)/', $header, $matches); | 304 preg_match('/HTTP\/\S+\s(\d+)/', $header, $matches); |
| 305 if (count($matches) < 1) | 305 if (count($matches) < 1) |
| 306 throw new Exception("Not an http header"); | 306 throw new InvalidArgumentException("Not an http header"); |
| 307 $n = $matches[1]; | 307 $n = $matches[1]; |
| 308 return $n; | 308 return $n; |
| 309 } | 309 } |
| 310 } | 310 } |
| 311 ?> | 311 ?> |
