Completed
Push — master ( 11971b...eeafb3 )
by Nate
01:16
created

DateCreatedAttributeTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 24
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A dateCreatedAttributes() 0 6 1
A dateCreatedAttributeLabels() 0 6 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipboxfactory/craft-ember/blob/master/LICENSE
6
 * @link       https://github.com/flipboxfactory/craft-ember/
7
 */
8
9
namespace flipbox\craft\ember\records;
10
11
use Craft;
12
use DateTime;
13
use flipbox\craft\ember\models\DateCreatedRulesTrait;
14
use flipbox\craft\ember\objects\DateCreatedMutatorTrait;
15
16
/**
17
 * Intended to be used on an ActiveRecord, this class provides `$this->dateCreated` attribute along with 'getters'
18
 * and 'setters' to ensure a `DateTime` object usage.  In addition, ActiveRecord rules are available.
19
 *
20
 * @property DateTime|null $dateCreated
21
 *
22
 * @author Flipbox Factory <[email protected]>
23
 * @since 2.0.0
24
 */
25
trait DateCreatedAttributeTrait
26
{
27
    use DateCreatedRulesTrait, DateCreatedMutatorTrait;
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function dateCreatedAttributes(): array
33
    {
34
        return [
35
            'dateCreated'
36
        ];
37
    }
38
39
    /**
40
     * @inheritdoc
41
     */
42
    public function dateCreatedAttributeLabels(): array
43
    {
44
        return [
45
            'dateCreated' => Craft::t('app', 'Date Created')
46
        ];
47
    }
48
}
49