original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Add task to the list of known tasks
  
  @param string $name
  @param AbstractTask $object
  @return TaskDaemon
docstring_tokens: Add task to the list of known tasks