Passed
Pull Request — master (#6)
by Alexander
04:02
created

TimestampTestMock::behaviors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Horat1us\Yii\Tests\Mocks;
4
5
use Horat1us\Yii\Behaviors\FlexibleTimestampBehavior;
6
use yii\base\Model;
7
8
/**
9
 * Class TimestampTestMock
10
 * @package Horat1us\Yii\Tests\Mocks
11
 */
12
class TimestampTestMock extends Model
13
{
14
    /** @var  int */
15
    public $timestamp;
16
17
    /** @var  string */
18
    public $date;
19
20
    /**
21
     * @return array
22
     */
23
    public function behaviors()
24
    {
25
        return [
26
            'flexibleTimestamp' => [
27
                'class' => FlexibleTimestampBehavior::class,
28
                'attributes' => ['timestamp', 'date',],
29
            ],
30
        ];
31
    }
32
33
    /**
34
     * @return array
35
     */
36
    public function rules()
37
    {
38
        return [
39
            [['timestamp', 'date',], 'date', 'format' => 'php:Y-m-d',],
40
        ];
41
    }
42
}