Completed
Push — master ( 8023d3...8b2ccd )
by Sherif
10:04
created

PushNotificationDeviceController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A registerDevice() 0 4 1
1
<?php
2
3
namespace App\Modules\PushNotificationDevices\Http\Controllers;
4
5
use App\Modules\Core\BaseClasses\BaseApiController;
6
use App\Modules\PushNotificationDevices\Services\PushNotificationDeviceService;
7
use App\Modules\PushNotificationDevices\Http\Requests\RegisterDevice;
8
9
class PushNotificationDeviceController extends BaseApiController
10
{
11
    /**
12
     * Path of the sotre form request.
13
     *
14
     * @var string
15
     */
16
    protected $storeFormRequest = 'App\Modules\Users\Http\PushNotificationDevices\StorePushNotificationDevice';
17
18
    /**
19
     * Path of the model resource
20
     *
21
     * @var string
22
     */
23
    protected $modelResource = 'App\Modules\PushNotificationDevices\Http\Resources\PushNotificationDevice';
24
25
    /**
26
     * List of all route actions that the base api controller
27
     * will skip permissions check for them.
28
     * @var array
29
     */
30
    protected $skipPermissionCheck = ['registerDevice'];
31
32
    /**
33
     * Init new object.
34
     *
35
     * @param   PushNotificationDeviceService $service
36
     * @return  void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
37
     */
38
    public function __construct(PushNotificationDeviceService $service)
39
    {
40
        parent::__construct($service);
41
    }
42
43
    /**
44
     * Register the given device to the logged in user.
45
     *
46
     * @param RegisterDevice $request
47
     * @return \Illuminate\Http\Response
48
     */
49
    public function registerDevice(RegisterDevice $request)
50
    {
51
        return new $this->modelResource($this->service->registerDevice($request->all()));
52
    }
53
}
54