Verification::tableName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * This is the model class for table "verification".
5
 *
6
 * The followings are the available columns in table 'verification':
7
 * @property integer $account_id
8
 * @property integer $type
9
 * @property string $code
10
 * @property string $data
11
 */
12
class Verification extends CActiveRecord
13
{
14
    const TYPE_REGISTER = 1;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
15
    const TYPE_CHANGE_EMAIL = 2;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
16
    const TYPE_RESET_PASSWORD = 3;
17
18
    /**
19
     * Returns the static model of the specified AR class.
20
     * @param string $className active record class name.
21
     * @return Verification the static model class
22
     */
23
    public static function model($className = __CLASS__)
24
    {
25
        return parent::model($className);
26
    }
27
28
    /**
29
     * @return string the associated database table name
30
     */
31
    public function tableName()
32
    {
33
        return 'verification';
34
    }
35
36
    /**
37
     * Generates a random code
38
     */
39
    public function generateCode()
40
    {
41
        return md5(mt_rand());
42
    }
43
44
    /**
45
     * Validates the code
46
     */
47
    public function validateCode($code)
48
    {
49
        return $code===$this->code;
50
    }
51
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
52