Passed
Push — main ( 1a087d...8eeb21 )
by Thierry
17:35 queued 13:18
created

Session::fees()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
namespace App\Ajax\App\Meeting\Summary;
4
5
use App\Ajax\CallableClass;
6
use Siak\Tontine\Model\Session as SessionModel;
7
use Siak\Tontine\Service\Meeting\Summary\SessionService;
8
9
/**
10
 * @exclude
11
 */
12
class Session extends CallableClass
13
{
14
    /**
15
     * @var SessionService
16
     */
17
    protected SessionService $sessionService;
18
19
    /**
20
     * @var SessionModel
21
     */
22
    private SessionModel $session;
23
24
    /**
25
     * @param SessionModel $session
26
     * @param boolean $isFinancial
27
     * @param SessionService $sessionService
28
     *
29
     * @return Response
0 ignored issues
show
Bug introduced by
The type App\Ajax\App\Meeting\Summary\Response was not found. Did you mean Response? If so, make sure to prefix the type with \.
Loading history...
30
     */
31
    public function show(SessionModel $session, bool $isFinancial, SessionService $sessionService)
32
    {
33
        $this->session = $session;
34
        $this->sessionService = $sessionService;
35
36
        $this->deposits();
37
        $this->remitments();
38
        if($isFinancial)
39
        {
40
            $this->fundings();
41
            $this->loans();
42
        }
43
        $this->fees();
44
        $this->fines();
45
46
        return $this->response;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->response returns the type Jaxon\Response\Response which is incompatible with the documented return type App\Ajax\App\Meeting\Summary\Response.
Loading history...
47
    }
48
49
    private function deposits()
50
    {
51
        $html = $this->view()->render('tontine.pages.meeting.summary.session.deposits', [
52
            'pools' => $this->sessionService->getDeposits($this->session),
53
        ]);
54
        $this->response->html('member-deposits', $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

54
        $this->response->html('member-deposits', /** @scrutinizer ignore-type */ $html);
Loading history...
55
    }
56
57
    private function remitments()
58
    {
59
        $html = $this->view()->render('tontine.pages.meeting.summary.session.remitments', [
60
            'pools' => $this->sessionService->getRemitments($this->session),
61
        ]);
62
        $this->response->html('member-remitments', $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

62
        $this->response->html('member-remitments', /** @scrutinizer ignore-type */ $html);
Loading history...
63
    }
64
65
    private function fundings()
66
    {
67
        $html = $this->view()->render('tontine.pages.meeting.summary.session.fundings', [
68
            'funding' => $this->sessionService->getFunding($this->session),
69
        ]);
70
        $this->response->html('member-fundings', $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

70
        $this->response->html('member-fundings', /** @scrutinizer ignore-type */ $html);
Loading history...
71
    }
72
73
    private function loans()
74
    {
75
        $html = $this->view()->render('tontine.pages.meeting.summary.session.loans', [
76
            'loan' => $this->sessionService->getLoan($this->session),
77
        ]);
78
        $this->response->html('member-loans', $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

78
        $this->response->html('member-loans', /** @scrutinizer ignore-type */ $html);
Loading history...
79
80
        $refund = $this->sessionService->getRefund($this->session);
81
        $html = $this->view()->render('tontine.pages.meeting.summary.session.refunds.principal', [
82
            'refund' => $refund,
83
        ]);
84
        $this->response->html('member-refunds-principal', $html);
85
86
        $html = $this->view()->render('tontine.pages.meeting.summary.session.refunds.interest', [
87
            'refund' => $refund,
88
        ]);
89
        $this->response->html('member-refunds-interest', $html);
90
    }
91
92
    private function fees()
93
    {
94
        $html = $this->view()->render('tontine.pages.meeting.summary.session.fees', [
95
            'fees' => $this->sessionService->getFees($this->session),
96
        ]);
97
        $this->response->html('member-fees', $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

97
        $this->response->html('member-fees', /** @scrutinizer ignore-type */ $html);
Loading history...
98
    }
99
100
    private function fines()
101
    {
102
        $html = $this->view()->render('tontine.pages.meeting.summary.session.fines', [
103
            'fines' => $this->sessionService->getFines($this->session),
104
        ]);
105
        $this->response->html('member-fines', $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

105
        $this->response->html('member-fines', /** @scrutinizer ignore-type */ $html);
Loading history...
106
    }
107
}
108