Completed
Push — master ( f066c0...72d72a )
by Yaro
01:50 queued 10s
created

OrderByHandlerTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 21
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A orderBy() 0 6 1
init() 0 1 ?
bound() 0 1 ?
crud() 0 1 ?
can() 0 1 ?
1
<?php
2
3
namespace Yaro\Jarboe\Http\Controllers\Traits\Handlers;
4
5
use Yaro\Jarboe\Table\CRUD;
6
7
trait OrderByHandlerTrait
8
{
9
    /**
10
     * Save direction by column.
11
     *
12
     * @param $column
13
     * @param $direction
14
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
15
     */
16 1
    public function orderBy($column, $direction)
17
    {
18 1
        $this->crud()->saveOrderFilterParam($column, $direction);
19
20 1
        return redirect($this->crud()->listUrl());
21
    }
22
23
    abstract protected function init();
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
24
    abstract protected function bound();
0 ignored issues
show
Documentation introduced by
For interfaces and abstract methods it is generally a good practice to add a @return annotation even if it is just @return void or @return null, so that implementors know what to do in the overridden method.

For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a @return doc comment to communicate to implementors of these methods what they are expected to return.

Loading history...
25
    abstract protected function crud(): CRUD;
26
    abstract protected function can($action): bool;
27
}
28