ApiAuth_UserKeyRecord::defineRelations()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 3
c 2
b 1
f 0
nc 1
nop 0
dl 0
loc 6
rs 9.4285
1
<?php
2
3
namespace Craft;
4
5
/**
6
 * Class ApiAuth_UserKeyRecord.
7
 *
8
 * @author    Nerds & Company
9
 * @copyright Copyright (c) 2015, Nerds & Company
10
 * @license   MIT
11
 *
12
 * @link      http://www.nerds.company
13
 *
14
 * @property int $id
15
 * @property int $userId
16
 * @property string $key
17
 * @property DateTime $expires
18
 */
19
class ApiAuth_UserKeyRecord extends BaseRecord
20
{
21
    /**
22
     * @inheritdoc
23
     */
24
    public function getTableName()
25
    {
26
        return 'apiauth_userkeys';
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32 View Code Duplication
    protected function defineAttributes()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
33
    {
34
        return array(
35
            'userId' => array(AttributeType::Number, 'required' => true),
36
            'key' => array(AttributeType::String, 'required' => true, 'unique' => true),
37
            'expires' => array(AttributeType::DateTime, 'required' => true),
38
        );
39
    }
40
41
    /**
42
     * @inheritdoc
43
     */
44
    public function defineRelations()
45
    {
46
        return array(
47
            'user' => array(static::BELONGS_TO, 'UserRecord', 'required' => true),
48
        );
49
    }
50
}
51