value = 0; $this->client = new Client([ 'base_uri' => 'http://otomoto.pl/', 'timeout' => 5.0, ]); } public function add($value) { $this->value += $value; } public function random(){ $this->random[] = rand(1,100); } public $client; protected $value; public $random = array(); } class Work extends Threaded { public function __construct(Shared $shared, Atomic $atomic) { $this->shared = $shared; $this->atomic = $atomic; } public function run() { $client->request('GET', 'osobowe/toyota/', [ 'query' => [ 'page' => '2' ], ]); } protected $shared; protected $atomic; } $shared = new Shared(); $atomic = new Atomic(); $pool = new Pool($threads); for ($i = 0; $i < $threads; $i++) $pool->submit(new Work($shared, $atomic)); $pool->shutdown();