Passed
Push — main ( f36a6b...da0e77 )
by Thierry
05:41
created

CallableSelectClass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 40
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A selectRound() 0 11 2
A selectTontine() 0 15 2
1
<?php
2
3
namespace App\Ajax;
4
5
use Siak\Tontine\Model\Round;
6
use Siak\Tontine\Model\Tontine;
7
8
use function config;
9
10
class CallableSelectClass extends CallableClass
11
{
12
    /**
13
     * @param Tontine $tontine
14
     *
15
     * @return void
16
     */
17
    protected function selectTontine(Tontine $tontine)
18
    {
19
        $this->response->html('section-tontine-name', $tontine->name);
20
21
        // Set the tontine sidebar menu
22
        $this->response->html('sidebar-menu-tontine', $this->render('parts.sidebar.tontine'));
0 ignored issues
show
Bug introduced by
It seems like $this->render('parts.sidebar.tontine') 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

22
        $this->response->html('sidebar-menu-tontine', /** @scrutinizer ignore-type */ $this->render('parts.sidebar.tontine'));
Loading history...
23
        $this->jq('a', '#sidebar-menu-tontine')->css('color', '#6777ef');
24
25
        foreach(config('menu.tontine') as $menuId => $menuClass)
26
        {
27
            $this->jq($menuId)->click($this->rq($menuClass)->home());
28
        }
29
30
        // Reset the round sidebar menu
31
        $this->response->html('sidebar-menu-round', $this->render('parts.sidebar.round'));
32
    }
33
34
    /**
35
     * @param Round $round
36
     *
37
     * @return void
38
     */
39
    protected function selectRound(Round $round)
40
    {
41
        $this->response->html('section-tontine-name', $round->tontine->name . ' - ' . $round->title);
42
43
        // Set the round sidebar menu
44
        $this->response->html('sidebar-menu-round', $this->render('parts.sidebar.round'));
0 ignored issues
show
Bug introduced by
It seems like $this->render('parts.sidebar.round') 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

44
        $this->response->html('sidebar-menu-round', /** @scrutinizer ignore-type */ $this->render('parts.sidebar.round'));
Loading history...
45
        $this->jq('a', '#sidebar-menu-round')->css('color', '#6777ef');
46
47
        foreach(config('menu.round') as $menuId => $menuClass)
48
        {
49
            $this->jq($menuId)->click($this->rq($menuClass)->home());
50
        }
51
    }
52
}
53