original_string: protected function submitTask(Task $task)
      {
          switch ($task->type) {
          case Task::JOB_LOW:
              $type = 'submit_job_low';
              break;
          case Task::JOB_LOW_BACKGROUND:
              $type = 'submit_job_low_bg';
              break;
          case Task::JOB_HIGH_BACKGROUND:
              $type = 'submit_job_high_bg';
              break;
          case Task::JOB_BACKGROUND:
              $type = 'submit_job_bg';
              break;
              case Task::JOB_EPOCH:
              $type = 'submit_job_epoch';
              break;
          case Task::JOB_HIGH:
              $type = 'submit_job_high';
              break;
          default:
              $type = 'submit_job';
              break;
          }
  
          $arg = $task->arg;
  
          $params = array(
              'func' => $task->func,
              'uniq' => $task->uniq,
              'arg' => $arg,
          );
  
          if ($task->type == Task::JOB_EPOCH) {
              $params['epoch'] = $task->epoch;
          }
  
          $s = $this->getConnection();
          Connection::send($s, $type, $params);
  
          if (!is_array(Connection::$waiting[(int) $s])) {
              Connection::$waiting[(int) $s] = array();
          }
  
          array_push(Connection::$waiting[(int) $s], $task);
      }
code: protected function submitTask(Task $task)
      {
          switch ($task->type) {
          case Task::JOB_LOW:
              $type = 'submit_job_low';
              break;
          case Task::JOB_LOW_BACKGROUND:
              $type = 'submit_job_low_bg';
              break;
          case Task::JOB_HIGH_BACKGROUND:
              $type = 'submit_job_high_bg';
              break;
          case Task::JOB_BACKGROUND:
              $type = 'submit_job_bg';
              break;
              case Task::JOB_EPOCH:
              $type = 'submit_job_epoch';
              break;
          case Task::JOB_HIGH:
              $type = 'submit_job_high';
              break;
          default:
              $type = 'submit_job';
              break;
          }
  
          $arg = $task->arg;
  
          $params = array(
              'func' => $task->func,
              'uniq' => $task->uniq,
              'arg' => $arg,
          );
  
          if ($task->type == Task::JOB_EPOCH) {
              $params['epoch'] = $task->epoch;
          }
  
          $s = $this->getConnection();
          Connection::send($s, $type, $params);
  
          if (!is_array(Connection::$waiting[(int) $s])) {
              Connection::$waiting[(int) $s] = array();
          }
  
          array_push(Connection::$waiting[(int) $s], $task);
      }
code_tokens: protected function submitTask ( Task $ task ) { switch ( $ task -> type ) { case Task :: JOB_LOW : $ type = 'submit_job_low' ; break ; case Task :: JOB_LOW_BACKGROUND : $ type = 'submit_job_low_bg' ; break ; case Task :: JOB_HIGH_BACKGROUND : $ type = 'submit_job_high_bg' ; break ; case Task :: JOB_BACKGROUND : $ type = 'submit_job_bg' ; break ; case Task :: JOB_EPOCH : $ type = 'submit_job_epoch' ; break ; case Task :: JOB_HIGH : $ type = 'submit_job_high' ; break ; default : $ type = 'submit_job' ; break ; } $ arg = $ task -> arg ; $ params = array ( 'func' => $ task -> func , 'uniq' => $ task -> uniq , 'arg' => $ arg , ) ; if ( $ task -> type == Task :: JOB_EPOCH ) { $ params [ 'epoch' ] = $ task -> epoch ; } $ s = $ this -> getConnection ( ) ; Connection :: send ( $ s , $ type , $ params ) ; if ( ! is_array ( Connection :: $ waiting [ ( int ) $ s ] ) ) { Connection :: $ waiting [ ( int ) $ s ] = array ( ) ; } array_push ( Connection :: $ waiting [ ( int ) $ s ] , $ task ) ; }
docstring: Submit a task to Gearman.
  
  @param Task $task Task to submit to Gearman
  
  @see         \MHlavac\Gearman\Task, \MHlavac\Gearman\Client::runSet()
docstring_tokens: Submit a task to Gearman .