| @@ 62-76 (lines=15) @@ | ||
| 59 | ); |
|
| 60 | } |
|
| 61 | ||
| 62 | public function getQueryParameter($key, $defaultValue = null) |
|
| 63 | { |
|
| 64 | if (array_key_exists($key, $this->getData)) { |
|
| 65 | return $this->getData[$key]; |
|
| 66 | } |
|
| 67 | ||
| 68 | if (is_null($defaultValue)) { |
|
| 69 | throw new HttpException( |
|
| 70 | sprintf('missing query parameter "%s"', $key), |
|
| 71 | 400 |
|
| 72 | ); |
|
| 73 | } |
|
| 74 | ||
| 75 | return $defaultValue; |
|
| 76 | } |
|
| 77 | ||
| 78 | public function getHeader($key, $defaultValue = null) |
|
| 79 | { |
|
| @@ 78-93 (lines=16) @@ | ||
| 75 | return $defaultValue; |
|
| 76 | } |
|
| 77 | ||
| 78 | public function getHeader($key, $defaultValue = null) |
|
| 79 | { |
|
| 80 | // do some header key normalization |
|
| 81 | if (array_key_exists($key, $this->serverData)) { |
|
| 82 | return $this->serverData[$key]; |
|
| 83 | } |
|
| 84 | ||
| 85 | if (is_null($defaultValue)) { |
|
| 86 | throw new HttpException( |
|
| 87 | sprintf('missing header "%s"', $key), |
|
| 88 | 400 |
|
| 89 | ); |
|
| 90 | } |
|
| 91 | ||
| 92 | return $defaultValue; |
|
| 93 | } |
|
| 94 | ||
| 95 | public function getPostParameter($key, $defaultValue = null) |
|
| 96 | { |
|
| @@ 95-109 (lines=15) @@ | ||
| 92 | return $defaultValue; |
|
| 93 | } |
|
| 94 | ||
| 95 | public function getPostParameter($key, $defaultValue = null) |
|
| 96 | { |
|
| 97 | if (array_key_exists($key, $this->postData)) { |
|
| 98 | return $this->postData[$key]; |
|
| 99 | } |
|
| 100 | ||
| 101 | if (is_null($defaultValue)) { |
|
| 102 | throw new HttpException( |
|
| 103 | sprintf('missing post parameter "%s"', $key), |
|
| 104 | 400 |
|
| 105 | ); |
|
| 106 | } |
|
| 107 | ||
| 108 | return $defaultValue; |
|
| 109 | } |
|
| 110 | } |
|
| 111 | ||