Failed Conditions
Push — master ( 55bfad...b74acd )
by Maximo
02:48
created

CustomFieldsController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 31
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A onConstruct() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gewaer\Api\Controllers;
6
7
use Gewaer\CustomFields\CustomFields;
8
9
/**
10
 * Class LanguagesController
11
 *
12
 * @package Gewaer\Api\Controllers
13
 * @property Users $userData
14
 * @property Apps $app
15
 *
16
 */
17
class CustomFieldsController extends BaseController
18
{
19
    /*
20
     * fields we accept to create
21
     *
22
     * @var array
23
     */
24
    protected $createFields = ['name', 'custom_fields_modules_id', 'fields_type_id'];
25
26
    /*
27
     * fields we accept to create
28
     *
29
     * @var array
30
     */
31
    protected $updateFields = ['name', 'custom_fields_modules_id', 'fields_type_id'];
32
33
    /**
34
     * set objects
35
     *
36
     * @return void
37
     */
38 3
    public function onConstruct()
39
    {
40 3
        $this->model = new CustomFields();
41 3
        $this->model->users_id = $this->userData->getId();
42 3
        $this->model->companies_id = $this->userData->default_company;
43 3
        $this->model->apps_id = $this->app->getId();
44
45 3
        $this->additionalSearchFields = [
46 3
            ['apps_id', ':', $this->app->getId()],
47 3
            ['companies_id', ':', $this->userData->default_company],
48
        ];
49 3
    }
50
}
51