Completed
Push — master ( e93f60...2f787f )
by Mahmoud
08:56 queued 02:41
created

Controller   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createApplication() 0 13 1
1
<?php
2
3
namespace App\Containers\Application\UI\API\Controllers;
4
5
use App\Containers\Application\Actions\CreateApplicationWithTokenAction;
6
use App\Containers\Application\UI\API\Requests\CreateApplicationRequest;
7
use App\Port\Controller\Abstracts\PortApiController;
8
9
/**
10
 * Class Controller.
11
 *
12
 * @author Mahmoud Zalt <[email protected]>
13
 */
14
class Controller extends PortApiController
15
{
16
17
    /**
18
     * @param \App\Containers\Application\UI\API\Requests\GenerateApplicationTokenRequest $request
19
     * @param \App\Containers\Application\Actions\GenerateApplicationTokenAction          $action
20
     *
21
     * @return  \Dingo\Api\Http\Response
22
     */
23
    public function createApplication(
24
        CreateApplicationRequest $request,
25
        CreateApplicationWithTokenAction $action
26
    ) {
27
28
        $app = $action->run($request->name, $request->user()->id);
0 ignored issues
show
Documentation introduced by
The property name does not exist on object<App\Containers\Ap...eateApplicationRequest>. 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...
29
30
        return $this->response->accepted(null, [
31
            'application_name'  => $app->name,
32
            'application_id'    => $app->id,
33
            'application_token' => $app->token,
34
        ]);
35
    }
36
37
}
38