Passed
Push — main ( 1848b7...f24d21 )
by Thierry
06:50
created

SelectCallable   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A selectTontine() 0 15 2
A selectRound() 0 11 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 SelectCallable extends CallableClass
11
{
12
    /**
13
     * @var string
14
     */
15
    static protected $activeMenuColor = '#6777ef';
16
17
    /**
18
     * @param Tontine $tontine
19
     *
20
     * @return void
21
     */
22
    protected function selectTontine(Tontine $tontine)
23
    {
24
        $this->response->html('section-tontine-name', $tontine->name);
25
26
        // Set the tontine sidebar menu
27
        $this->response->html('sidebar-menu-tontine', $this->renderView('parts.sidebar.tontine'));
0 ignored issues
show
Bug introduced by
It seems like $this->renderView('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

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

49
        $this->response->html('sidebar-menu-round', /** @scrutinizer ignore-type */ $this->renderView('parts.sidebar.round'));
Loading history...
50
        $this->jq('a', '#sidebar-menu-round')->css('color', self::$activeMenuColor);
51
52
        foreach(config('menu.round') as $menuId => $menuClass)
53
        {
54
            $this->jq($menuId)->click($this->rq($menuClass)->home());
55
        }
56
    }
57
}
58