| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function post($params) |
||
| 26 | { |
||
| 27 | $refreshToken = Yii::$app->request->post('refresh_token', false); |
||
| 28 | $model = RefreshToken::find()->where([ |
||
| 29 | 'user_id' => Yii::$app->user->id, |
||
| 30 | 'token' => $refreshToken |
||
| 31 | ])->one(); |
||
| 32 | |||
| 33 | if ($model === null) { |
||
| 34 | throw new HttpException(401, Yii::t('yrc', 'The refresh token provided is either not valid, or has expired.')); |
||
| 35 | } |
||
| 36 | |||
| 37 | // If we can delete the token, send a newly generated token out |
||
| 38 | if ($model->delete()) { |
||
| 39 | // Merge any extra attributes with the generated tokens |
||
| 40 | $tokenClass = (Yii::$app->user->identityClass::TOKEN_CLASS); |
||
| 41 | $tokens = ArrayHelper::merge($this->extraAttributes, $tokenClass::generate(Yii::$app->user->id)->getAuthResponse()); |
||
| 42 | // Merge the identity attributes |
||
| 43 | foreach ($this->identityAttributes as $attr) { |
||
| 44 | $tokens[$attr] = Yii::$app->user->getIdentity()->$attr; |
||
| 45 | } |
||
| 46 | return $tokens; |
||
| 47 | } |
||
| 48 | |||
| 49 | throw new HttpException(400, Yii::t('yrc', 'An unexpected error occurred. Please re-authenticate.')); |
||
| 50 | } |
||
| 52 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths