PageContent   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
dl 0
loc 58
rs 10
c 1
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A showPage() 0 8 1
A html() 0 5 1
A count() 0 3 1
A limit() 0 3 1
A bagName() 0 3 1
A bagAttr() 0 3 1
A show() 0 5 1
1
<?php
2
3
use Jaxon\App\PageComponent;
4
use Jaxon\App\PageDatabagTrait;
5
6
/**
7
 * @databag page
8
 */
9
class PageContent extends PageComponent
10
{
11
    use PageDatabagTrait;
12
13
   /**
14
    * @inheritDoc
15
    */
16
   protected function bagName(): string
17
   {
18
       return 'page';
19
   }
20
21
   /**
22
    * @inheritDoc
23
    */
24
   protected function bagAttr(): string
25
   {
26
       return 'number';
27
   }
28
29
   /**
30
    * @inheritDoc
31
    */
32
    protected function limit(): int
33
    {
34
        return 10;
35
    }
36
 
37
    /**
38
     * @inheritDoc
39
     */
40
    protected function count(): int
41
    {
42
        return 150;
43
    }
44
 
45
   public function html():  string
46
    {
47
        return '<div style="margin-bottom:10px;font-weight:bold;">' .
48
            $this->bag('page')->get('title') .
49
            '</div>Showing page number ' . $this->currentPage();
50
    }
51
52
    public function showPage(int $pageNumber)
53
    {
54
        // Get the paginator. This will also set the final page number value.
55
        $paginator = $this->paginator($pageNumber);
56
        // Render the page content.
57
        $this->render();
58
        // Render the pagination component.
59
        $paginator->render($this->rq()->showPage(je()->rd()->page()));
0 ignored issues
show
Bug introduced by
The method showPage() does not exist on Jaxon\Script\Call\JxnCall. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

59
        $paginator->render($this->rq()->/** @scrutinizer ignore-call */ showPage(je()->rd()->page()));
Loading history...
60
    }
61
62
    public function show()
63
    {
64
        $title = 'This is the page title';
65
        $this->bag('page')->set('title', $title);
66
        $this->showPage(1);
67
    }
68
}
69
70
jaxon()->app()->setup(configFile('component.php'));
71