HasStatus::getStatusColumn()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Malekbenelouafi\LaravelStatus;
3
use Malekbenelouafi\LaravelStatus\Scopes\StatusScope;
4
5
trait HasStatus
6
{
7
8
    /**
9
     * Boot the Active Events trait for a model.
10
     *
11
     * @return void
12
     */
13
    public static function bootHasStatus()
14
    {
15
        static::addGlobalScope(new StatusScope);
16
    }
17
18
19
    /**
20
     * Get the name of the "deleted at" column.
21
     *
22
     * @return string
23
     */
24
    public function getStatusColumn()
25
    {
26
        return defined('static::STATUS') ? static::STATUS : 'status';
0 ignored issues
show
Bug introduced by
The constant Malekbenelouafi\LaravelStatus\HasStatus::STATUS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
27
    }
28
29
    /**
30
     * Get the fully qualified "deleted at" column.
31
     *
32
     * @return string
33
     */
34
    public function getQualifiedStatusColumn()
35
    {
36
        return $this->qualifyColumn($this->getStatusColumn());
0 ignored issues
show
Bug introduced by
It seems like qualifyColumn() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
        return $this->/** @scrutinizer ignore-call */ qualifyColumn($this->getStatusColumn());
Loading history...
37
    }
38
39
}
40