Jenner\SimpleFork\Process::__construct PHP Method

__construct() public method

public __construct ( string $execution = null, null $name = null )
$execution string it can be a Runnable object, callback function or null
$name null process name,you can manager the process by it's name.
    public function __construct($execution = null, $name = null)
    {
        if (!is_null($execution) && $execution instanceof Runnable) {
            $this->runnable = $execution;
        } elseif (!is_null($execution) && is_callable($execution)) {
            $this->runnable = $execution;
        } elseif (!is_null($execution)) {
            throw new \InvalidArgumentException('param execution is not a object of Runnable or callable');
        } else {
            Utils::checkOverwriteRunMethod(get_class($this));
        }
        if (!is_null($name)) {
            $this->name = $name;
        }
        $this->initStatus();
    }

Usage Example

Beispiel #1
0
 /**
  * @param ReaderInterface $reader
  * @param FilterInterface $filter
  * @param NotificationInterface $notify
  */
 public function __construct(ReaderInterface $reader, FilterInterface $filter, NotificationInterface $notify)
 {
     parent::__construct();
     $this->reader = $reader;
     $this->filter = $filter;
     $this->notify = $notify;
     $this->registerSignalHandler(SIGTERM, array($this, 'signalHandler'));
 }
All Usage Examples Of Jenner\SimpleFork\Process::__construct