HelloWorld::sleep()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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