ActivationAction   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A post() 0 13 3
1
<?php
2
3
namespace yrc\actions;
4
5
use common\forms\Activation;
0 ignored issues
show
Bug introduced by
The type common\forms\Activation was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use yrc\rest\Action as RestAction;
7
8
use yii\web\HttpException;
9
use Yii;
10
11
/**
12
 * Handles token refresh
13
 * @class ActivationAction
14
 */
15
class ActivationAction extends RestAction
16
{
17
    /**
18
     * Activates a user given their activation token
19
     * @return mixed
20
     */
21
    public function post($params)
0 ignored issues
show
Unused Code introduced by
The parameter $params is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

21
    public function post(/** @scrutinizer ignore-unused */ $params)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23
        $model = new Activation;
24
        
25
        if ($model->load(['Activation' => Yii::$app->request->post()])) {
26
            if ($model->validate()) {
27
                return $model->activate();
28
            }
29
30
            throw new HttpException(400, \json_encode($model->getErrors()));
31
        }
32
            
33
        return false;
34
    }
35
}
36