BaseHomePageController::getNewsItems()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace CWP\CWP\PageTypes;
4
5
use PageController;
0 ignored issues
show
Bug introduced by
The type PageController was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
class BaseHomePageController extends PageController
8
{
9
    public function getNewsPage()
10
    {
11
        return NewsHolder::get_one(NewsHolder::class);
12
    }
13
14
    /**
15
     * @param int $amount The amount of items to provide.
16
     */
17
    public function getNewsItems($amount = 2)
18
    {
19
        $newsHolder = $this->getNewsPage();
20
        if ($newsHolder) {
21
            $controller = NewsHolderController::create($newsHolder);
22
            return $controller->Updates()->limit($amount);
23
        }
24
    }
25
}
26