original_string: public function runTask($name, $data = null, $allowDuplicates = false)
      {
          $options = static::getOptions();
          $debug = @$options['debug'] === true;
  
          if ($debug)
              echo "==> Trying to run task: $name" . PHP_EOL;
  
          $function = $options['namespace'] . '-' . $name;
          $data = json_encode($data);
          if ($allowDuplicates)
              $unique = self::generateUnique();
          else
              $unique = md5($function . '-' . $data);
  
          $gmClient = new GearmanClient();
          $gmClient->addServer($options['gearman']['host'], $options['gearman']['port']);
  
          $gmClient->doBackground($function, $data, $unique);
          $code = $gmClient->returnCode();
          if ($code != GEARMAN_SUCCESS)
              throw new \Exception("Could not run task: $name ($code)");
  
          return $this;
      }
code: public function runTask($name, $data = null, $allowDuplicates = false)
      {
          $options = static::getOptions();
          $debug = @$options['debug'] === true;
  
          if ($debug)
              echo "==> Trying to run task: $name" . PHP_EOL;
  
          $function = $options['namespace'] . '-' . $name;
          $data = json_encode($data);
          if ($allowDuplicates)
              $unique = self::generateUnique();
          else
              $unique = md5($function . '-' . $data);
  
          $gmClient = new GearmanClient();
          $gmClient->addServer($options['gearman']['host'], $options['gearman']['port']);
  
          $gmClient->doBackground($function, $data, $unique);
          $code = $gmClient->returnCode();
          if ($code != GEARMAN_SUCCESS)
              throw new \Exception("Could not run task: $name ($code)");
  
          return $this;
      }
code_tokens: public function runTask ( $ name , $ data = null , $ allowDuplicates = false ) { $ options = static :: getOptions ( ) ; $ debug = @ $ options [ 'debug' ] === true ; if ( $ debug ) echo "==> Trying to run task: $name" . PHP_EOL ; $ function = $ options [ 'namespace' ] . '-' . $ name ; $ data = json_encode ( $ data ) ; if ( $ allowDuplicates ) $ unique = self :: generateUnique ( ) ; else $ unique = md5 ( $ function . '-' . $ data ) ; $ gmClient = new GearmanClient ( ) ; $ gmClient -> addServer ( $ options [ 'gearman' ] [ 'host' ] , $ options [ 'gearman' ] [ 'port' ] ) ; $ gmClient -> doBackground ( $ function , $ data , $ unique ) ; $ code = $ gmClient -> returnCode ( ) ; if ( $ code != GEARMAN_SUCCESS ) throw new \ Exception ( "Could not run task: $name ($code)" ) ; return $ this ; }
docstring: Add known task to the run queue
  
  @param string $name
  @param mixed $data
  @param boolean $allowDuplicates
  @return TaskDaemon
docstring_tokens: Add known task to the run queue