| Conditions | 5 |
| Paths | 7 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 30 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function run(string $token) |
||
| 32 | { |
||
| 33 | if(false === ($route = Jwt::getInstance()->getRoute()->claim($token))) { |
||
| 34 | throw new NotFoundHttpException("Invalid token."); |
||
| 35 | } |
||
| 36 | |||
| 37 | $params = []; |
||
| 38 | if (is_array($route)) { |
||
| 39 | list($route, $params) = $route; |
||
| 40 | } |
||
| 41 | |||
| 42 | $result = Craft::$app->runAction($route, $params); |
||
| 43 | |||
| 44 | if ($result instanceof Response) { |
||
| 45 | return $result; |
||
| 46 | } |
||
| 47 | |||
| 48 | $response = Craft::$app->getResponse(); |
||
| 49 | if ($result !== null) { |
||
| 50 | $response->data = $result; |
||
| 51 | } |
||
| 52 | |||
| 53 | return $response; |
||
| 54 | } |
||
| 55 | } |
||
| 56 |