Passed
Push — main ( 936852...10149e )
by Thierry
15:09
created

Session::reports()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 14
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 21
rs 9.7998
1
<?php
2
3
namespace App\Ajax\Web\Meeting;
4
5
use App\Ajax\CallableClass;
6
use Siak\Tontine\Service\Meeting\SessionService;
7
8
use function Jaxon\jq;
9
use function trans;
10
11
class Session extends CallableClass
12
{
13
    /**
14
     * @param SessionService
15
     */
16
    public function __construct(protected SessionService $sessionService)
17
    {}
18
19
    /**
20
     * @before checkRoundSessions
21
     * @after hideMenuOnMobile
22
     */
23
    public function home()
24
    {
25
        $this->response->html('section-title', trans('tontine.menus.meeting'));
26
        $html = $this->render('pages.meeting.session.list');
27
        $this->response->html('content-home', $html);
0 ignored issues
show
Bug introduced by
It seems like $html can also be of type null; however, parameter $sData of Jaxon\Response\Response::html() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

27
        $this->response->html('content-home', /** @scrutinizer ignore-type */ $html);
Loading history...
28
29
        $this->jq('#btn-sessions-refresh')->click($this->rq()->page());
30
31
        return $this->page();
32
    }
33
34
    public function page(int $pageNumber = 0)
35
    {
36
        $sessionCount = $this->sessionService->getSessionCount();
37
        [$pageNumber, $perPage] = $this->pageNumber($pageNumber, $sessionCount, 'session', 'page');
38
        $sessions = $this->sessionService->getSessions($pageNumber);
39
        $pagination = $this->rq()->page()->paginate($pageNumber, $perPage, $sessionCount);
40
41
        $html = $this->render('pages.meeting.session.page')
42
            ->with('sessions', $sessions)
43
            ->with('statuses', $this->sessionService->getSessionStatuses())
44
            ->with('pagination', $pagination);
45
        $this->response->html('content-page', $html);
0 ignored issues
show
Bug introduced by
It seems like $html can also be of type null; however, parameter $sData of Jaxon\Response\Response::html() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

45
        $this->response->html('content-page', /** @scrutinizer ignore-type */ $html);
Loading history...
46
47
        $sessionId = jq()->parent()->attr('data-session-id')->toInt();
48
        $this->jq('.btn-session-show')->click($this->cl(Session\Home::class)->rq()->home($sessionId));
49
50
        return $this->response;
51
    }
52
}
53