Inheritance: implements Swarrot\Processor\ConfigurableInterface, implements Swarrot\Processor\SleepyInterface
 public function test_it_should_throw_an_exception_after_consecutive_failed()
 {
     $processor = $this->prophesize('Swarrot\\Processor\\ProcessorInterface');
     $logger = $this->prophesize('Psr\\Log\\LoggerInterface');
     $message = new Message('body', array(), 1);
     $processor->process(Argument::exact($message), Argument::exact(array()))->willThrow('\\BadMethodCallException');
     $processor = new SignalHandlerProcessor($processor->reveal(), $logger->reveal());
     $this->setExpectedException('\\BadMethodCallException');
     $processor->process($message, array());
 }
 /**
  * {@inheritdoc}
  */
 public function initialize(array $options)
 {
     if (!extension_loaded('pcntl')) {
         $this->logger and $this->logger->warning('[SignalHandler] The SignalHandlerProcessor needs the pcntl extension to work', ['swarrot_processor' => 'signal_handler']);
         return;
     }
     $signals = isset($options['signal_handler_signals']) ? $options['signal_handler_signals'] : array();
     foreach ($signals as $signal) {
         pcntl_signal($signal, function () {
             SignalHandlerProcessor::$shouldExit = true;
         });
     }
 }
 /**
  * {@inheritDoc}
  */
 public function process(Message $message, array $options)
 {
     if (!extension_loaded('pcntl')) {
         $this->logger and $this->logger->warning('[SignalHandler] The SignalHandlerProcessor needs the pcntl extension to work', ['swarrot_processor' => 'signal_handler']);
         return $this->processor->process($message, $options);
     }
     $signals = isset($options['signal_handler_signals']) ? $options['signal_handler_signals'] : array();
     foreach ($signals as $signal) {
         pcntl_signal($signal, function () {
             SignalHandlerProcessor::$shouldExit = true;
         });
     }
     $return = $this->processor->process($message, $options);
     if ($this->shouldStop()) {
         return false;
     }
     return $return;
 }