Test Failed
Pull Request — master (#160)
by Maximo
06:15
created

NotificationsController::processOutput()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 5
c 1
b 0
f 1
nc 2
nop 1
dl 0
loc 8
ccs 0
cts 7
cp 0
crap 6
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Canvas\Api\Controllers;
6
7
use Canvas\Models\Notifications;
8
use Canvas\Dto\Notification as NotificationDto;
9
use Canvas\Mapper\NotificationMapper;
10
use Canvas\Contracts\Controllers\ProcessOutputMapperTrait;
11
12
/**
13
 * Class LanguagesController.
14
 *
15
 * @package Canvas\Api\Controllers
16
 *
17
 */
18
class NotificationsController extends BaseController
19
{
20
    use ProcessOutputMapperTrait;
21
    /*
22
     * fields we accept to create
23
     *
24
     * @var array
25
     */
26
    protected $createFields = ['read'];
27
28
    /*
29
     * fields we accept to create
30
     *
31
     * @var array
32
     */
33
    protected $updateFields = ['read'];
34
35
    /**
36
     * set objects.
37
     *
38
     * @return void
39
     */
40
    public function onConstruct()
41
    {
42
        $this->model = new Notifications();
43
        $this->dto = NotificationDto::class;
44
        $this->dtoMapper = new NotificationMapper();
45
46
        $this->additionalSearchFields = [
47
            ['is_deleted', ':', '0'],
48
            ['users_id', ':', $this->userData->getId()],
49
            ['companies_id', ':', $this->userData->currentCompanyId()],
50
        ];
51
    }
52
}
53