Passed
Pull Request — master (#132)
by
unknown
02:31
created

swoole_async_task()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 3
dl 0
loc 3
rs 10
1
<?php
2
3
use SwooleTW\Http\Task\Facades\SwooleTask;
4
5
/**
6
 * This is only for `function not exists` in config/swoole_http.php.
7
 */
8
if (! function_exists('swoole_cpu_num')) {
9
    function swoole_cpu_num()
10
    {
11
        return;
12
    }
13
}
14
15
16
if (! function_exists('swoole_async_task')) {
17
    /**
18
     * Swoole Async task helper.
19
     *
20
     * @param object  $task
21
     * @param mixed  $callback
22
     * @param int  $taskWorkerId
23
     *
24
     * @return mixed
25
     */
26
    function swoole_async_task($task, $callback = null, $taskWorkerId = 1)
27
    {
28
        return SwooleTask::async($task, $callback, $taskWorkerId);
0 ignored issues
show
Bug introduced by
The method async() does not exist on SwooleTW\Http\Task\Facades\SwooleTask. Since you implemented __callStatic, 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

28
        return SwooleTask::/** @scrutinizer ignore-call */ async($task, $callback, $taskWorkerId);
Loading history...
29
    }
30
}
31