| Conditions | 1 |
| Paths | 1 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function init() |
||
| 13 | { |
||
| 14 | $req = $this; |
||
| 15 | |||
| 16 | $job = $this->job = new \PHPDaemon\Core\ComplexJob(function () use ($req) { // called when job is done |
||
|
|
|||
| 17 | |||
| 18 | $req->wakeup(); // wake up the request immediately |
||
| 19 | |||
| 20 | }); |
||
| 21 | |||
| 22 | $job('pingjob', function ($name, $job) use ($req) { // registering job named 'pingjob' |
||
| 23 | |||
| 24 | \PHPDaemon\Clients\ICMP\Pool::getInstance()->sendPing('8.8.8.8', function ($latency) use ($name, $job) { |
||
| 25 | $job->setResult($name, $latency); |
||
| 26 | }); |
||
| 27 | }); |
||
| 28 | |||
| 29 | $job(); // let the fun begin |
||
| 30 | |||
| 31 | $this->sleep(5, true); // setting timeout |
||
| 32 | } |
||
| 33 | |||
| 57 |
Since your code implements the magic setter
_set, this function will be called for any write access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.