| Conditions | 9 |
| Paths | 10 |
| Total Lines | 18 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public static function exception($code, $msg = null) |
||
| 17 | { |
||
| 18 | switch ($code) { |
||
| 19 | case 400: |
||
| 20 | $msg = $msg ? $msg : Yii::t('app', 'Bad request'); |
||
| 21 | throw new \yii\web\BadRequestHttpException($msg); |
||
| 22 | case 401: |
||
| 23 | $msg = $msg ? $msg : Yii::t('app', 'Access is unauthorized'); |
||
| 24 | throw new \yii\web\UnauthorizedHttpException($msg); |
||
| 25 | case 403: |
||
| 26 | $msg = $msg ? $msg : Yii::t('app', 'Access Denied'); |
||
| 27 | throw new \yii\web\ForbiddenHttpException($msg); |
||
| 28 | case 404: |
||
| 29 | default: |
||
| 30 | $msg = $msg ? $msg : Yii::t('app', 'Page not found'); |
||
| 31 | throw new \yii\web\NotFoundHttpException($msg); |
||
| 32 | } |
||
| 33 | } |
||
| 34 | } |
||
| 35 |