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

PerPageHandlerTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A perPage() 0 9 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 PerPageHandlerTrait
8
{
9
    /**
10
     * Handle setting per page param.
11
     *
12
     * @param $perPage
13
     * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
14
     */
15 1
    public function perPage($perPage)
16
    {
17 1
        $this->init();
18 1
        $this->bound();
19
20 1
        $this->crud()->setPerPageParam((int) $perPage);
21
22 1
        return redirect($this->crud()->listUrl());
23
    }
24
25
    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...
26
    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...
27
    abstract protected function crud(): CRUD;
28
    abstract protected function can($action): bool;
29
}
30