HelloWorld   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A showDialog() 0 6 1
A sayHello() 0 14 3
A setColor() 0 13 2
1
<?php
2
3
use Jaxon\Jaxon;
4
use Jaxon\App\FuncComponent;
5
use Jaxon\Dialogs\Dialog\Library\Bootbox;
6
use Jaxon\Dialogs\Dialog\Library\Noty;
7
8
class HelloWorld extends FuncComponent
9
{
10
    public function sayHello(bool $isCaps, bool $bNotify = true)
11
    {
12
        $text = $isCaps ? 'HELLO WORLD!' : 'Hello World!';
13
        if(($bNotify))
14
        {
15
            // $this->response->confirmCommands(2, 'Skip text assignement?');
16
            $this->response->assign('div2', 'innerHTML', $text);
0 ignored issues
show
Bug Best Practice introduced by
The property response does not exist on HelloWorld. Did you maybe forget to declare it?
Loading history...
17
            // $this->response->confirmCommands(1, 'Skip text notification?');
18
            $this->response->dialog->success("div2 text is now $text");
19
        }
20
        else
21
        {
22
            // $this->response->confirmCommands(1, 'Skip text assignement?');
23
            $this->response->assign('div2', 'innerHTML', $text);
24
        }
25
    }
26
27
    public function setColor(string $sColor, bool $bNotify = true)
28
    {
29
        if(($bNotify))
30
        {
31
            // $this->response->confirmCommands(1, 'Skip color assignement?');
32
            $this->response->assign('div2', 'style.color', $sColor);
0 ignored issues
show
Bug Best Practice introduced by
The property response does not exist on HelloWorld. Did you maybe forget to declare it?
Loading history...
33
            // $this->response->confirmCommands(1, 'Skip color assignement?');
34
            $this->response->dialog->success("div2 color is now $sColor");
35
        }
36
        else
37
        {
38
            // $this->response->confirmCommands(1, 'Skip color assignement?');
39
            $this->response->assign('div2', 'style.color', $sColor);
40
        }
41
    }
42
43
    public function showDialog()
44
    {
45
        $buttons = [['title' => 'Close', 'class' => 'btn', 'click' => 'close']];
46
        $options = ['width' => 500];
47
        $this->response->dialog->show("Modal Dialog",
0 ignored issues
show
Bug Best Practice introduced by
The property response does not exist on HelloWorld. Did you maybe forget to declare it?
Loading history...
48
            "This modal dialog is powered by Bootbox!!", $buttons, $options);
49
    }
50
}
51
52
$jaxon = jaxon();
53
54
// $jaxon->setOption('core.debug.on', true);
55
$jaxon->setOption('core.prefix.class', 'Jaxon');
56
57
// Js options
58
$jaxon->setOption('js.lib.uri', '/js');
59
// $jaxon->setOption('js.lib.uri', '/exp/js/lib');
60
// $jaxon->setOption('js.app.minify', false);
61
62
// Dialog options
63
$jaxon->setAppOption('dialogs.default.modal', Bootbox::NAME);
64
$jaxon->setAppOption('dialogs.default.alert', Noty::NAME);
65
$jaxon->setAppOption('dialogs.default.confirm', Noty::NAME);
66
67
$jaxon->setAppOption('dialogs.confirm.title', 'Confirmer');
68
$jaxon->setAppOption('dialogs.confirm.yes', 'Oui');
69
$jaxon->setAppOption('dialogs.confirm.no', 'Non');
70
71
// Register object
72
$jaxon->register(Jaxon::CALLABLE_CLASS, HelloWorld::class);
73