/**
  * @return ForkManager
  */
 public function create()
 {
     $event = new ForkManagerEvent();
     $eventDispatcher = new EventDispatcher();
     $memoryLimitManager = new MemoryLimitManager();
     $taskManager = new TaskManager();
     $timeLimitManager = new TimeLimitManager();
     //set default values for optional properties
     $memoryLimitManager->setLimitInMegaBytes(128);
     $memoryLimitManager->setBufferInMegaBytes(8);
     $timeLimitManager->setLimitInHours(1);
     $timeLimitManager->setBufferInMinutes(4);
     $manager = new ForkManager();
     $manager->injectEvent($event);
     $manager->injectEventDispatcher($eventDispatcher);
     $manager->injectMemoryLimitManager($memoryLimitManager);
     $manager->injectTimeLimitManager($timeLimitManager);
     $manager->injectTaskManager($taskManager);
     $manager->setMaximumNumberOfThreads(16);
     $manager->setNumberOfMicrosecondsToCheckThreadStatus(100000);
     //1000000 microseconds = 1 second
     return $manager;
 }
 /**
  * @return ForkManager
  */
 private function getNewManager()
 {
     $manager = new ForkManager();
     $manager->injectEvent($this->getMockOfForkManagerEvent());
     $manager->injectEventDispatcher($this->getMockOfEventDispatcher());
     $manager->injectMemoryLimitManager($this->getMockOfMemoryLimitManager());
     $manager->injectTaskManager($this->getMockOfTaskManager());
     $manager->injectTimeLimitManager($this->getMockOfTimeLimitManager());
     return $manager;
 }