Code Duplication    Length = 21-21 lines in 2 locations

actions/ActivationAction.php 1 location

@@ 15-35 (lines=21) @@
12
 * @class ActivationAction
13
 * Handles token refresh
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)
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
}

actions/RegisterAction.php 1 location

@@ 15-35 (lines=21) @@
12
 * @class RegisterAction
13
 * Handles user registration
14
 */
15
class RegisterAction extends RestAction
16
{
17
    /**
18
     * Handles registration of users
19
     * @return mixed
20
     */
21
    public function post($params)
22
    {
23
        $model = new Registration;
24
        
25
        if ($model->load(['Registration' => Yii::$app->request->post()])) {
26
            if ($model->register()) {
27
                return true;
28
            }
29
30
            throw new HttpException(400, \json_encode($model->getErrors()));
31
        }
32
            
33
        return false;
34
    }
35
}