original_string: public function restart()
      {
          if (count($this->tasks) == 0)
              throw new \Exception("There are no tasks defined - can not restart");
  
          $this->stop();
  
          do {
              sleep(1);
          } while ($this->getPid() !== false);
  
          $this->start();
      }
code: public function restart()
      {
          if (count($this->tasks) == 0)
              throw new \Exception("There are no tasks defined - can not restart");
  
          $this->stop();
  
          do {
              sleep(1);
          } while ($this->getPid() !== false);
  
          $this->start();
      }
code_tokens: public function restart ( ) { if ( count ( $ this -> tasks ) == 0 ) throw new \ Exception ( "There are no tasks defined - can not restart" ) ; $ this -> stop ( ) ; do { sleep ( 1 ) ; } while ( $ this -> getPid ( ) !== false ) ; $ this -> start ( ) ; }
docstring: Restart the daemon
  
  @return TaskDaemon
docstring_tokens: Restart the daemon