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

CallableSessionClass   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 28
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSession() 0 4 1
A showBalanceAmounts() 0 3 1
1
<?php
2
3
namespace App\Ajax;
4
5
use Siak\Tontine\Model\Session as SessionModel;
6
use Siak\Tontine\Service\Meeting\SessionService;
7
8
/**
9
 * @databag meeting
10
 * @before getSession
11
 */
12
class CallableSessionClass extends CallableClass
13
{
14
    /**
15
     * @var SessionModel|null
16
     */
17
    protected ?SessionModel $session = null;
18
19
    /**
20
     * @di
21
     * @var SessionService
22
     */
23
    protected SessionService $sessionService;
24
25
    /**
26
     * @return void
27
     */
28
    protected function getSession()
29
    {
30
        $sessionId = $this->bag('meeting')->get('session.id');
31
        $this->session = $this->sessionService->getSession($sessionId);
0 ignored issues
show
Bug introduced by
It seems like $sessionId can also be of type null; however, parameter $sessionId of Siak\Tontine\Service\Mee...onService::getSession() does only seem to accept integer, 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

31
        $this->session = $this->sessionService->getSession(/** @scrutinizer ignore-type */ $sessionId);
Loading history...
32
    }
33
34
    /**
35
     * @return void
36
     */
37
    protected function showBalanceAmounts()
38
    {
39
        $this->response->call('showBalanceAmounts');
40
    }
41
}
42