Passed
Push — main ( 87fed9...27211a )
by Thierry
04:04
created

Misc::simple()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
use Jaxon\App\FuncComponent;
4
5
class Misc extends FuncComponent
6
{
7
    public function simple()
8
    {
9
        $this->response->alert('This is the global response!');
10
        $aCommands = $this->response->getCommands();
11
        $aCommands[0]->setOption('name1', 'value1');
12
        $aCommands[0]->setOption('name2', 'value2');
13
    }
14
15
    public function merge()
16
    {
17
        $this->response->alert('This is the global response!');
18
19
        $xResponse = jaxon()->newResponse();
20
        $xResponse->debug('This is a different response!');
21
    }
22
23
    public function appendBefore()
24
    {
25
        $this->response->alert('This is the global response!');
26
        $xResponse = jaxon()->newResponse();
27
        $xResponse->debug('This is a different response!');
28
    }
29
30
    public function commands()
31
    {
32
        // Create a DOM node
33
        $this->response->create('parent', 'div', 'child');
0 ignored issues
show
Deprecated Code introduced by
The function Jaxon\Response\Response::create() has been deprecated: DOM element creation functions are deprecated ( Ignorable by Annotation )

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

33
        /** @scrutinizer ignore-deprecated */ $this->response->create('parent', 'div', 'child');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
34
        // Insert a DOM node before an other
35
        $this->response->insert('sibling', 'div', 'new');
0 ignored issues
show
Deprecated Code introduced by
The function Jaxon\Response\Response::insert() has been deprecated: DOM element creation functions are deprecated ( Ignorable by Annotation )

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

35
        /** @scrutinizer ignore-deprecated */ $this->response->insert('sibling', 'div', 'new');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
36
        $this->response->insertBefore('sibling', 'div', 'new');
0 ignored issues
show
Deprecated Code introduced by
The function Jaxon\Response\Response::insertBefore() has been deprecated: DOM element creation functions are deprecated ( Ignorable by Annotation )

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

36
        /** @scrutinizer ignore-deprecated */ $this->response->insertBefore('sibling', 'div', 'new');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
37
        // Insert a DOM node after an other
38
        $this->response->insertAfter('sibling', 'div', 'new');
0 ignored issues
show
Deprecated Code introduced by
The function Jaxon\Response\Response::insertAfter() has been deprecated: DOM element creation functions are deprecated ( Ignorable by Annotation )

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

38
        /** @scrutinizer ignore-deprecated */ $this->response->insertAfter('sibling', 'div', 'new');

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
39
        // Add an event handler on the target node
40
        $this->response->addEventHandler('target', 'click', jo('console')->log('Clicked!!'));
0 ignored issues
show
Bug introduced by
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

40
        $this->response->addEventHandler('target', 'click', jo('console')->/** @scrutinizer ignore-call */ log('Clicked!!'));
Loading history...
Deprecated Code introduced by
The function Jaxon\Response\Response::addEventHandler() has been deprecated: Event handler functions are deprecated ( Ignorable by Annotation )

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

40
        /** @scrutinizer ignore-deprecated */ $this->response->addEventHandler('target', 'click', jo('console')->log('Clicked!!'));

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
41
        // Bind the target to a component
42
        $this->response->bind('target', $this->rq('TestComponent'));
43
        // Bind the target to a component with item
44
        $this->response->bind('target', $this->rq('TestComponent'), 'item');
45
    }
46
47
    public function jsCommands()
48
    {
49
        $this->response->jo('console')->log('Debug message');
50
        $this->response->jo()->console->log('Debug message');
0 ignored issues
show
Bug Best Practice introduced by
The property console does not exist on Jaxon\Script\Call\JsObjectCall. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug introduced by
The method log() does not exist on Jaxon\Script\JsExpr. 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

50
        $this->response->jo()->console->/** @scrutinizer ignore-call */ 
51
                                        log('Debug message');
Loading history...
51
        $this->response->exec(jo('console')->log('Debug message'));
52
        $this->response->exec(jo()->console->log('Debug message'));
53
    }
54
55
    public function paginate(int $page = 0)
56
    {
57
        $this->response->paginator($page, 10, 25)
58
            ->render($this->rq()->paginate(), 'pagination');
0 ignored issues
show
Bug introduced by
The method paginate() does not exist on Jaxon\Script\Call\JxnCall. 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

58
            ->render($this->rq()->/** @scrutinizer ignore-call */ paginate(), 'pagination');
Loading history...
59
    }
60
}
61