| Conditions | 1 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function init() |
||
| 16 | { |
||
| 17 | $req = $this; |
||
| 18 | |||
| 19 | $job = $this->job = new \PHPDaemon\Core\ComplexJob(function () use ($req) { // called when job is done |
||
| 20 | $req->wakeup(); // wake up the request immediately |
||
| 21 | |||
| 22 | }); |
||
| 23 | |||
| 24 | $job('query', function ($name, $job) { // registering job named 'showvar' |
||
| 25 | \PHPDaemon\Clients\DNS\Pool::getInstance()->get('phpdaemon.net', function ($response) use ($name, $job) { |
||
| 26 | $job->setResult($name, $response); |
||
| 27 | }); |
||
| 28 | }); |
||
| 29 | |||
| 30 | $job('resolve', function ($name, $job) { // registering job named 'showvar' |
||
| 31 | \PHPDaemon\Clients\DNS\Pool::getInstance()->resolve('phpdaemon.net', function ($ip) use ($name, $job) { |
||
| 32 | $job->setResult($name, ['phpdaemon.net resolved to' => $ip]); |
||
| 33 | }); |
||
| 34 | }); |
||
| 35 | |||
| 36 | $job(); // let the fun begin |
||
| 37 | |||
| 38 | $this->sleep(5, true); // setting timeout |
||
| 39 | } |
||
| 40 | |||
| 55 |
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.