mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-01 12:40:11 +02:00
PHP7 Builder
This commit is contained in:
19
Creational/Pool/StringReverseWorker.php
Normal file
19
Creational/Pool/StringReverseWorker.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Creational\Pool;
|
||||
|
||||
class Worker
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
// let's say that constuctor does really expensive work...
|
||||
// for example creates "thread"
|
||||
}
|
||||
|
||||
public function run($image, array $callback)
|
||||
{
|
||||
// do something with $image...
|
||||
// and when it's done, execute callback
|
||||
call_user_func($callback, $this);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user