Passed
Push — master ( d15464...d64dd2 )
by Alexey
05:25
created

Device::indexes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 10
ccs 0
cts 5
cp 0
crap 2
rs 9.4285
c 1
b 0
f 1
1
<?php
2
3
/**
4
 * Subscriber Device
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
12
namespace Notifications\Subscriber;
13
14
class Device extends \Model {
15
16
    public static $logging = false;
17
    static $cols = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $cols.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
18
        'key' => ['type' => 'text'],
19
        'subscriber_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'subscriber'],
20
        'date_last_check' => ['type' => 'dateTime'],
21
        'date_create' => ['type' => 'dateTime'],
22
    ];
23
24
    public static function indexes() {
25
        return [
26
            'notifications_subscriber_device_subscriber_device_key' => [
27
                'type' => 'UNIQUE INDEX',
28
                'cols' => [
29
                    'subscriber_device_key'
30
                ]
31
            ],
32
        ];
33
    }
34
35
    public static function relations() {
36
        return [
37
            'subscriber' => [
38
                'model' => 'Notifications\Subscriber',
39
                'col' => 'subscriber_id'
40
            ]
41
        ];
42
    }
43
}