@@ -35,14 +35,14 @@ All you need to have installed: _pcntl_ and _posix_ extensions.
3535
3636### How to create your Worker
3737
38- The all you need it to inherit ` Worker ` class (full name is _ wapmorgan\Threadable\Worker_ ) and redefine ` onPayload(array $data) ` public method.
38+ The all you need it to inherit ` Worker ` class (full name is _ wapmorgan\Threadable\Worker_ ) and redefine ` onPayload($data) ` public method.
3939
4040For example:
4141``` php
4242use wapmorgan\Threadable\Worker;
4343class SleepingWorker extends Worker
4444{
45- public function onPayload(array $data)
45+ public function onPayload($data)
4646 {
4747 echo 'I have started at '.date('r').PHP_EOL;
4848 sleep(3);
@@ -69,7 +69,7 @@ To use it correctly you need to understand the life-cycle of worker:
69694 . Worker stops or being killed by ` stop() ` or ` kill() ` methods respectively.
70705 . Worker manager checks if worker thread has finished and marks itself terminated. To do this call ` checkForTermination() ` .
7171
72- Background work happens in ** 2 steps** , where worker thread runs ` onPayload(array $data) ` method of class with actual payload.
72+ Background work happens in ** 2 steps** , where worker thread runs ` onPayload($data) ` method of class with actual payload.
7373
7474To summarize, this is an example of downloading file in another thread with real-time displaying of progress:
7575
@@ -78,7 +78,7 @@ To summarize, this is an example of downloading file in another thread with real
7878// Implement class-downloader
7979class DownloadWorker extends Worker
8080{
81- public function onPayload(array $data)
81+ public function onPayload($data)
8282 {
8383 echo 'Started '.$data[0].' into '.$data[2].PHP_EOL;
8484 copy($data[0], $data[2]);
0 commit comments