RecipeLandingController::paginatedList()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 18
rs 9.9666
c 0
b 0
f 0
cc 4
nc 8
nop 1
1
<?php
2
3
namespace Dynamic\RecipeBook\Page;
4
5
use SilverStripe\ORM\PaginatedList;
6
7
class RecipeLandingController extends \PageController
8
{
9
    public function paginatedList(HTTPRequest $request = null)
0 ignored issues
show
Bug introduced by
The type Dynamic\RecipeBook\Page\HTTPRequest was not found. Did you mean HTTPRequest? If so, make sure to prefix the type with \.
Loading history...
10
    {
11
        if ($request === null) {
12
            $request = $this->request;
13
        }
14
        $start = ($request->getVar('start')) ? (int) $request->getVar('start') : 0;
15
16
        $records = PaginatedList::create($this->data()->Children(), $request);
17
        $records->setPageStart($start);
18
19
        if ($limit = $this->data()->PerPage) {
20
            $records->setPageLength($limit);
21
        }
22
23
        // allow $records to be updated via extension
24
        $this->owner->extend('updatePaginatedList', $records);
0 ignored issues
show
Bug Best Practice introduced by
The property owner does not exist on Dynamic\RecipeBook\Page\RecipeLandingController. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
The method extend() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        $this->owner->/** @scrutinizer ignore-call */ 
25
                      extend('updatePaginatedList', $records);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
25
26
        return $records;
27
    }
28
}
29