PerPageHandlerTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 23
ccs 6
cts 6
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A perPage() 0 9 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->beforeInit();
18 1
        $this->init();
19 1
        $this->bound();
20
21 1
        $this->crud()->setPerPageParam((int) $perPage);
22
23 1
        return redirect($this->crud()->listUrl());
24
    }
25
26
    abstract protected function beforeInit();
27
    abstract protected function init();
28
    abstract protected function bound();
29
    abstract protected function crud(): CRUD;
30
}
31