Issues (686)

jaxon-examples/examples/synchronous/code.php (3 issues)

1
<?php
2
3
use Jaxon\Jaxon;
4
use Jaxon\App\FuncComponent;
5
6
class HelloWorld extends FuncComponent
7
{
8
    public function sleep($iDuration)
9
    {
10
        sleep(intval($iDuration));
11
        $this->response->append('div2', 'innerHTML', "<br/>I slept for $iDuration second(s)");
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...
12
    }
13
14
    public function ssleep($iDuration)
15
    {
16
        sleep(intval($iDuration));
17
        $this->response->append('div2', 'innerHTML', "<br/>I slept for $iDuration second(s)");
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...
18
    }
19
20
    public function nodup($iDuration)
21
    {
22
        sleep(intval($iDuration));
23
        $this->response->append('div2', 'innerHTML', "<br/>I slept for $iDuration second(s)");
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...
24
    }
25
}
26
27
// Register object
28
$jaxon = jaxon();
29
30
$jaxon->app()->setup(configFile('class.php'));
31
32
// Js options
33
$jaxon->setOption('js.lib.uri', '/js');
34
$jaxon->setOption('js.app.minify', false);
35
36
$jaxon->register(Jaxon::CALLABLE_CLASS, HelloWorld::class, [
37
    'sleep' => ['mode' => "'asynchronous'"],
38
    'ssleep' => ['mode' => "'synchronous'"],
39
    'nodup' => ['callback' => "nodupCallbacks"],
40
]);
41