Completed
Push — master ( 857394...4794c5 )
by Mahmoud
03:25
created

Controller   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A confirmUserEmail() 0 10 1
1
<?php
2
3
namespace App\Containers\Email\UI\WEB\Controllers;
4
5
use App\Containers\Email\Actions\ValidateUserEmailByConfirmationCodeAction;
6
use App\Containers\Email\UI\API\Requests\ConfirmUserEmailRequest;
7
use App\Port\Controller\Abstracts\PortWebController;
8
use Illuminate\Support\Facades\Config;
9
10
/**
11
 * Class Controller.
12
 *
13
 * @author Mahmoud Zalt <[email protected]>
14
 */
15
class Controller extends PortWebController
16
{
17
18
    /**
19
     * @param \App\Containers\Email\UI\API\Requests\ConfirmUserEmailRequest $request
20
     * @param \App\Containers\Email\Actions\ValidateUserEmailByConfirmationCodeAction $action
21
     *
22
     * @return  \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
23
     */
24
    public function confirmUserEmail(
25
        ConfirmUserEmailRequest $request,
26
        ValidateUserEmailByConfirmationCodeAction $action
27
    ) {
28
        // validate the confirmation code and update user status is code is valid
29
        $action->run($request->id, $request->code);
0 ignored issues
show
Documentation introduced by
The property id does not exist on object<App\Containers\Em...onfirmUserEmailRequest>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
Documentation introduced by
The property code does not exist on object<App\Containers\Em...onfirmUserEmailRequest>. Since you implemented __get, maybe consider adding a @property annotation.

Since your code implements the magic getter _get, this function will be called for any read access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

If the property has read access only, you can use the @property-read annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
30
31
        // redirect to the app URL
32
        return redirect(Config::get('app.url'));
33
    }
34
35
}
36