SprintScope::scopeOrder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 7
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace GitScrum\Scopes;
4
5
use GitScrum\Models\ConfigStatus;
6
7
trait SprintScope
8
{
9
    public function scopeOrder($query)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
10
    {
11
        $configStatus = ConfigStatus::type('sprint')->orderby('position', 'ASC')->pluck('id')->implode(',');
12
        return $query->orderByRaw("FIELD(config_status_id, ".$configStatus.")")
13
            ->orderby('date_start', 'DESC')
14
            ->orderby('date_finish', 'ASC');
15
    }
16
}
17