Sorter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getDirections() 0 3 1
1
<?php
2
3
namespace musa11971\SortRequest\Support\Foundation\Contracts;
4
5
use Illuminate\Database\Eloquent\Builder;
6
use Illuminate\Http\Request;
7
8
abstract class Sorter
9
{
10
    /** @var string $column */
11
    public $column;
12
13
    /**
14
     * Applies the sorter to the Eloquent builder.
15
     *
16
     * @param Request $request
17
     * @param Builder $builder
18
     * @param string $direction
19
     *
20
     * @return Builder
21
     */
22
    abstract public function apply(Request $request, Builder $builder, $direction): Builder;
23
24
    /**
25
     * Returns the directions that can be sorted on.
26
     *
27
     * @return array
28
     */
29
    public function getDirections()
30
    {
31
        return [];
32
    }
33
}