library/TaskDaemon/TaskDaemon.php
public function defineTask($name, $object)
    {
        $options = static::getOptions();
        $debug = @$options['debug'] === true;

        if ($this->started)
            throw new \Exception("Define tasks before start()ing the daemon not after");

        if (! $object instanceof AbstractTask)
            throw new \Exception("Task must implement AbstractTask");

        $object->setDaemon($this);
        $this->tasks[$name] = $object;

        if ($debug)
            echo "==> Task defined: $name" . PHP_EOL;

        return $this;
    }
public function defineTask($name, $object)
    {
        $options = static::getOptions();
        $debug = @$options['debug'] === true;

        if ($this->started)
            throw new \Exception("Define tasks before start()ing the daemon not after");

        if (! $object instanceof AbstractTask)
            throw new \Exception("Task must implement AbstractTask");

        $object->setDaemon($this);
        $this->tasks[$name] = $object;

        if ($debug)
            echo "==> Task defined: $name" . PHP_EOL;

        return $this;
    }
public function defineTask ( $ name , $ object ) { $ options = static :: getOptions ( ) ; $ debug = @ $ options [ 'debug' ] === true ; if ( $ this -> started ) throw new \ Exception ( "Define tasks before start()ing the daemon not after" ) ; if ( ! $ object instanceof AbstractTask ) throw new \ Exception ( "Task must implement AbstractTask" ) ; $ object -> setDaemon ( $ this ) ; $ this -> tasks [ $ name ] = $ object ; if ( $ debug ) echo "==> Task defined: $name" . PHP_EOL ; return $ this ; }
Add task to the list of known tasks

@param string $name
@param AbstractTask $object
@return TaskDaemon
Add task to the list of known tasks