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

Member::fines()   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\Member as MemberModel;
7
use Siak\Tontine\Model\Session as SessionModel;
8
use Siak\Tontine\Service\Meeting\Summary\MemberService;
9
10
/**
11
 * @exclude
12
 */
13
class Member extends CallableClass
14
{
15
    /**
16
     * @var MemberService
17
     */
18
    protected MemberService $memberService;
19
20
    /**
21
     * @var SessionModel
22
     */
23
    private SessionModel $session;
24
25
    /**
26
     * @var MemberModel
27
     */
28
    private MemberModel $member;
29
30
    /**
31
     * @param SessionModel $session
32
     * @param MemberModel $member
33
     * @param boolean $isFinancial
34
     * @param MemberService $memberService
35
     *
36
     * @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...
37
     */
38
    public function show(SessionModel $session, MemberModel $member, bool $isFinancial, MemberService $memberService)
39
    {
40
        $this->session = $session;
41
        $this->member = $member;
42
        $this->memberService = $memberService;
43
44
        $this->deposits();
45
        $this->remitments();
46
        if($isFinancial)
47
        {
48
            $this->fundings();
49
            $this->loans();
50
        }
51
        $this->fees();
52
        $this->fines();
53
54
        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...
55
    }
56
57
    private function deposits()
58
    {
59
        $html = $this->view()->render('tontine.pages.meeting.summary.member.deposits', [
60
            'subscriptions' => $this->memberService->getDeposits($this->member, $this->session),
61
        ]);
62
        $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

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

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

78
        $this->response->html('member-fundings', /** @scrutinizer ignore-type */ $html);
Loading history...
79
    }
80
81
    private function loans()
82
    {
83
        $html = $this->view()->render('tontine.pages.meeting.summary.member.loans', [
84
            'loans' => $this->memberService->getLoans($this->member, $this->session),
85
        ]);
86
        $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

86
        $this->response->html('member-loans', /** @scrutinizer ignore-type */ $html);
Loading history...
87
88
        $html = $this->view()->render('tontine.pages.meeting.summary.member.refunds.principal', [
89
            'loans' => $this->memberService->getPrincipalRefunds($this->member, $this->session),
90
        ]);
91
        $this->response->html('member-refunds-principal', $html);
92
93
        $html = $this->view()->render('tontine.pages.meeting.summary.member.refunds.interest', [
94
            'loans' => $this->memberService->getInterestRefunds($this->member, $this->session),
95
        ]);
96
        $this->response->html('member-refunds-interest', $html);
97
    }
98
99
    private function fees()
100
    {
101
        $html = $this->view()->render('tontine.pages.meeting.summary.member.fees', [
102
            'fees' => $this->memberService->getFees($this->member, $this->session),
103
        ]);
104
        $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

104
        $this->response->html('member-fees', /** @scrutinizer ignore-type */ $html);
Loading history...
105
    }
106
107
    private function fines()
108
    {
109
        $html = $this->view()->render('tontine.pages.meeting.summary.member.fines', [
110
            'fines' => $this->memberService->getFines($this->member, $this->session),
111
        ]);
112
        $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

112
        $this->response->html('member-fines', /** @scrutinizer ignore-type */ $html);
Loading history...
113
    }
114
}
115