Passed
Pull Request — main (#48)
by Thierry
13:20
created

Member::fines()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 6
rs 10
1
<?php
2
3
namespace App\Ajax\Web\Report\Session;
4
5
use App\Ajax\CallableClass;
6
use Siak\Tontine\Model\Member as MemberModel;
7
use Siak\Tontine\Model\Session as SessionModel;
8
use Siak\Tontine\Service\Report\MemberService;
9
use Siak\Tontine\Service\Report\SessionService;
10
11
/**
12
 * @exclude
13
 */
14
class Member extends CallableClass
15
{
16
    /**
17
     * @var MemberService
18
     */
19
    protected MemberService $memberService;
20
21
    /**
22
     * @var SessionService
23
     */
24
    protected SessionService $sessionService;
25
26
    /**
27
     * @param MemberService $memberService
28
     * @param SessionService $sessionService
29
     */
30
    public function __construct(MemberService $memberService, SessionService $sessionService)
31
    {
32
        $this->memberService = $memberService;
33
        $this->sessionService = $sessionService;
34
    }
35
36
    /**
37
     * @param SessionModel $session
38
     * @param MemberModel $member
39
     *
40
     * @return void
41
     */
42
    public function show(SessionModel $session, MemberModel $member)
43
    {
44
        $this->deposits($session, $member);
45
        $this->remitments($session, $member);
46
        $this->loans($session, $member);
47
        $this->debts($session, $member);
48
        $this->sessionBills($session, $member);
49
        $this->totalBills($session, $member);
50
        $this->fundings($session, $member);
51
        $this->disbursements($session, $member);
52
        // Empty the profits section.
53
        $this->response->html('report-profits', '');
54
    }
55
56
    private function deposits(SessionModel $session, MemberModel $member)
57
    {
58
        $html = $this->view()->render('tontine.pages.report.session.member.deposits', [
59
            'receivables' => $this->memberService->getReceivables($session, $member),
60
        ]);
61
        $this->response->html('report-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

61
        $this->response->html('report-deposits', /** @scrutinizer ignore-type */ $html);
Loading history...
62
    }
63
64
    private function remitments(SessionModel $session, MemberModel $member)
65
    {
66
        $html = $this->view()->render('tontine.pages.report.session.member.remitments', [
67
            'payables' => $this->memberService->getPayables($session, $member),
68
            'auctions' => $this->memberService->getAuctions($session, $member),
69
        ]);
70
        $this->response->html('report-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

70
        $this->response->html('report-remitments', /** @scrutinizer ignore-type */ $html);
Loading history...
71
    }
72
73
    private function loans(SessionModel $session, MemberModel $member)
74
    {
75
        $html = $this->view()->render('tontine.pages.report.session.member.loans', [
76
            'loans' => $this->memberService->getLoans($session, $member),
77
        ]);
78
        $this->response->html('report-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('report-loans', /** @scrutinizer ignore-type */ $html);
Loading history...
79
    }
80
81
    private function debts(SessionModel $session, MemberModel $member)
82
    {
83
        $html = $this->view()->render('tontine.pages.report.session.member.debts', [
84
            'debts' => $this->memberService->getDebts($session, $member),
85
        ]);
86
        $this->response->html('report-refunds', $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

86
        $this->response->html('report-refunds', /** @scrutinizer ignore-type */ $html);
Loading history...
87
    }
88
89
    private function sessionBills(SessionModel $session, MemberModel $member)
90
    {
91
        $html = $this->view()->render('tontine.pages.report.session.member.bills.session', [
92
            'bills' => $this->memberService->getBills($session, $member),
93
        ]);
94
        $this->response->html('report-session-bills', $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

94
        $this->response->html('report-session-bills', /** @scrutinizer ignore-type */ $html);
Loading history...
95
    }
96
97
    private function totalBills(SessionModel $session, MemberModel $member)
98
    {
99
        $html = $this->view()->render('tontine.pages.report.session.member.bills.total', [
100
            'charges' => $this->sessionService->getTotalCharges($session, $member),
101
        ]);
102
        $this->response->html('report-total-bills', $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

102
        $this->response->html('report-total-bills', /** @scrutinizer ignore-type */ $html);
Loading history...
103
    }
104
105
    private function fundings(SessionModel $session, MemberModel $member)
106
    {
107
        $html = $this->view()->render('tontine.pages.report.session.member.fundings', [
108
            'fundings' => $this->memberService->getFundings($session, $member),
109
        ]);
110
        $this->response->html('report-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

110
        $this->response->html('report-fundings', /** @scrutinizer ignore-type */ $html);
Loading history...
111
    }
112
113
    private function disbursements(SessionModel $session, MemberModel $member)
114
    {
115
        $html = $this->view()->render('tontine.pages.report.session.member.disbursements', [
116
            'disbursements' => $this->memberService->getDisbursements($session, $member),
117
        ]);
118
        $this->response->html('report-disbursements', $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

118
        $this->response->html('report-disbursements', /** @scrutinizer ignore-type */ $html);
Loading history...
119
    }
120
}
121