Passed
Push — main ( c5d8d3...f30db6 )
by Michael
04:23
created

DefinesColumns::getRedeemerIdColumn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MichaelRubel\Couponables\Models\Traits;
6
7
trait DefinesColumns
8
{
9
    /**
10
     * @return string
11
     */
12 15
    public function getCodeColumn(): string
13
    {
14 15
        return 'code';
15
    }
16
17
    /**
18
     * @return string
19
     */
20 1
    public function getTypeColumn(): string
21
    {
22 1
        return 'type';
23
    }
24
25
    /**
26
     * @return string
27
     */
28 13
    public function getQuantityColumn(): string
29
    {
30 13
        return 'quantity';
31
    }
32
33
    /**
34
     * @return string
35
     */
36 13
    public function getLimitColumn(): string
37
    {
38 13
        return 'limit';
39
    }
40
41
    /**
42
     * @return string
43
     */
44 16
    public function getExpiresAtColumn(): string
45
    {
46 16
        return 'expires_at';
47
    }
48
49
    /**
50
     * @return string
51
     */
52 13
    public function getRedeemerTypeColumn(): string
53
    {
54 13
        return 'redeemer_type';
55
    }
56
57
    /**
58
     * @return string
59
     */
60 2
    public function getRedeemerIdColumn(): string
61
    {
62 2
        return 'redeemer_id';
63
    }
64
65
    /**
66
     * @return bool
67
     */
68 13
    public function isMorphColumnsFilled(): bool
69
    {
70 13
        return ! is_null($this->{$this->getRedeemerTypeColumn()})
71 13
            && ! is_null($this->{$this->getRedeemerIdColumn()});
72
    }
73
}
74