original_string: protected function scheduleTask(TaskInterface $task)
      {
          if (null !== ($execution = $this->taskExecutionRepository->findPending($task))) {
              return;
          }
  
          if ($task->getInterval() === null && 0 < count($this->taskExecutionRepository->findByTask($task))) {
              return;
          }
  
          $scheduleTime = $task->getInterval() ? $task->getInterval()->getNextRunDate() : $task->getFirstExecution();
          $execution = $this->taskExecutionRepository->create($task, $scheduleTime);
          $execution->setStatus(TaskStatus::PLANNED);
  
          $this->eventDispatcher->dispatch(
              Events::TASK_EXECUTION_CREATE,
              new TaskExecutionEvent($task, $execution)
          );
  
          $this->taskExecutionRepository->save($execution);
      }
code: protected function scheduleTask(TaskInterface $task)
      {
          if (null !== ($execution = $this->taskExecutionRepository->findPending($task))) {
              return;
          }
  
          if ($task->getInterval() === null && 0 < count($this->taskExecutionRepository->findByTask($task))) {
              return;
          }
  
          $scheduleTime = $task->getInterval() ? $task->getInterval()->getNextRunDate() : $task->getFirstExecution();
          $execution = $this->taskExecutionRepository->create($task, $scheduleTime);
          $execution->setStatus(TaskStatus::PLANNED);
  
          $this->eventDispatcher->dispatch(
              Events::TASK_EXECUTION_CREATE,
              new TaskExecutionEvent($task, $execution)
          );
  
          $this->taskExecutionRepository->save($execution);
      }
code_tokens: protected function scheduleTask ( TaskInterface $ task ) { if ( null !== ( $ execution = $ this -> taskExecutionRepository -> findPending ( $ task ) ) ) { return ; } if ( $ task -> getInterval ( ) === null && 0 < count ( $ this -> taskExecutionRepository -> findByTask ( $ task ) ) ) { return ; } $ scheduleTime = $ task -> getInterval ( ) ? $ task -> getInterval ( ) -> getNextRunDate ( ) : $ task -> getFirstExecution ( ) ; $ execution = $ this -> taskExecutionRepository -> create ( $ task , $ scheduleTime ) ; $ execution -> setStatus ( TaskStatus :: PLANNED ) ; $ this -> eventDispatcher -> dispatch ( Events :: TASK_EXECUTION_CREATE , new TaskExecutionEvent ( $ task , $ execution ) ) ; $ this -> taskExecutionRepository -> save ( $ execution ) ; }
docstring: Schedule execution for given task.
  
  @param TaskInterface $task
docstring_tokens: Schedule execution for given task .