Issues (686)

jaxon-examples/examples/dialogs/code.php (10 issues)

1
<?php
2
3
class HelloWorld
4
{
5
    private function content(string $name): string
6
    {
7
        return '<div ' . attr()->bind(rq(HelloWorld::class)) .
8
            '>This modal dialog is powered by ' . $name . '!!</div>';
9
    }
10
11
    public function showDialog($id, $name)
12
    {
13
        jaxon()->setAppOption('dialogs.default.modal', $id);
14
        $xResponse = jaxon()->getResponse();
15
        $buttons = [
16
            ['title' => 'Close', 'class' => 'btn btn-danger', 'click' => 'close'],
17
            ['title' => 'Do', 'class' => 'btn', 'click' => jo('console')->log("Clicked on the button!!")]
0 ignored issues
show
The method log() does not exist on Jaxon\Script\Call\JsObjectCall. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
            ['title' => 'Do', 'class' => 'btn', 'click' => jo('console')->/** @scrutinizer ignore-call */ log("Clicked on the button!!")]
Loading history...
18
        ];
19
        $options = [];
20
        $xResponse->dialog->show('Modal Dialog', $this->content($name), $buttons, $options);
0 ignored issues
show
The method show() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $xResponse->dialog->/** @scrutinizer ignore-call */ 
21
                            show('Modal Dialog', $this->content($name), $buttons, $options);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug Best Practice introduced by
The property dialog does not exist on Jaxon\Response\Response. Since you implemented __get, consider adding a @property annotation.
Loading history...
The method show() does not exist on Jaxon\Plugin\ResponsePluginInterface. It seems like you code against a sub-type of Jaxon\Plugin\ResponsePluginInterface such as Jaxon\Plugin\Response\Dialog\DialogPlugin. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $xResponse->dialog->/** @scrutinizer ignore-call */ 
21
                            show('Modal Dialog', $this->content($name), $buttons, $options);
Loading history...
The method content() does not exist on HelloWorld. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $xResponse->dialog->show('Modal Dialog', $this->/** @scrutinizer ignore-call */ content($name), $buttons, $options);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
    }
22
23
    public function showConfirm($id, $name)
24
    {
25
        jaxon()->setAppOption('dialogs.default.confirm', $id);
26
        jaxon()->setAppOption('dialogs.default.alert', $id);
27
        jaxon()->getResponse()->alert('Oh! Yeah!!!');
28
    }
29
30
    public function showSuccess($id, $name)
31
    {
32
        jaxon()->setAppOption('dialogs.default.alert', $id);
33
        $xResponse = jaxon()->getResponse();
34
        $xResponse->dialog->title('Yeah Man!!!')->success("Powered by $name!!");
0 ignored issues
show
Bug Best Practice introduced by
The property dialog does not exist on Jaxon\Response\Response. Since you implemented __get, consider adding a @property annotation.
Loading history...
The method title() does not exist on Jaxon\Plugin\ResponsePluginInterface. It seems like you code against a sub-type of Jaxon\Plugin\ResponsePluginInterface such as Jaxon\Plugin\Response\Dialog\DialogPlugin. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
        $xResponse->dialog->/** @scrutinizer ignore-call */ 
35
                            title('Yeah Man!!!')->success("Powered by $name!!");
Loading history...
35
    }
36
37
    public function showInfo($id, $name)
38
    {
39
        jaxon()->setAppOption('dialogs.default.alert', $id);
40
        $xResponse = jaxon()->getResponse();
41
        $xResponse->dialog->title('Yeah Man!!!')->info("Powered by $name!!");
0 ignored issues
show
Bug Best Practice introduced by
The property dialog does not exist on Jaxon\Response\Response. Since you implemented __get, consider adding a @property annotation.
Loading history...
42
    }
43
44
    public function showWarning($id, $name)
45
    {
46
        jaxon()->setAppOption('dialogs.default.alert', $id);
47
        $xResponse = jaxon()->getResponse();
48
        $xResponse->dialog->title('Yeah Man!!!')->warning("Powered by $name!!");
0 ignored issues
show
Bug Best Practice introduced by
The property dialog does not exist on Jaxon\Response\Response. Since you implemented __get, consider adding a @property annotation.
Loading history...
49
    }
50
51
    public function showError($id, $name)
52
    {
53
        jaxon()->setAppOption('dialogs.default.alert', $id);
54
        $xResponse = jaxon()->getResponse();
55
        $xResponse->dialog->title('Yeah Man!!!')->error("Powered by $name!!");
0 ignored issues
show
Bug Best Practice introduced by
The property dialog does not exist on Jaxon\Response\Response. Since you implemented __get, consider adding a @property annotation.
Loading history...
56
    }
57
}
58
59
$jaxon = jaxon();
60
$jaxon->app()->setup(configFile('dialogs.php'));
61