original_string: protected function get_features_for_the_run($features, $parallelruns, $currentrun) {
  
          // If no features are passed then just return.
          if (empty($features)) {
              return $features;
          }
  
          $allocatedfeatures = $features;
  
          // If parallel run, then only divide features.
          if (!empty($currentrun) && !empty($parallelruns)) {
  
              $featurestodivide['withtags'] = $features;
              $allocatedfeatures = array();
  
              // If tags are set then split features with tags first.
              if (!empty($this->tags)) {
                  $featurestodivide['withtags'] = $this->filtered_features_with_tags($features);
                  $featurestodivide['withouttags'] = $this->remove_blacklisted_features_from_list($features,
                      $featurestodivide['withtags']);
              }
  
              // Attempt to split into weighted buckets using timing information, if available.
              foreach ($featurestodivide as $tagfeatures) {
                  if ($alloc = $this->profile_guided_allocate($tagfeatures, max(1, $parallelruns), $currentrun)) {
                      $allocatedfeatures = array_merge($allocatedfeatures, $alloc);
                  } else {
                      // Divide the list of feature files amongst the parallel runners.
                      // Pull out the features for just this worker.
                      if (count($tagfeatures)) {
                          $splitfeatures = array_chunk($tagfeatures, ceil(count($tagfeatures) / max(1, $parallelruns)));
  
                          // Check if there is any feature file for this process.
                          if (!empty($splitfeatures[$currentrun - 1])) {
                              $allocatedfeatures = array_merge($allocatedfeatures, $splitfeatures[$currentrun - 1]);
                          }
                      }
                  }
              }
          }
  
          return $allocatedfeatures;
      }
code: protected function get_features_for_the_run($features, $parallelruns, $currentrun) {
  
          // If no features are passed then just return.
          if (empty($features)) {
              return $features;
          }
  
          $allocatedfeatures = $features;
  
          // If parallel run, then only divide features.
          if (!empty($currentrun) && !empty($parallelruns)) {
  
              $featurestodivide['withtags'] = $features;
              $allocatedfeatures = array();
  
              // If tags are set then split features with tags first.
              if (!empty($this->tags)) {
                  $featurestodivide['withtags'] = $this->filtered_features_with_tags($features);
                  $featurestodivide['withouttags'] = $this->remove_blacklisted_features_from_list($features,
                      $featurestodivide['withtags']);
              }
  
              // Attempt to split into weighted buckets using timing information, if available.
              foreach ($featurestodivide as $tagfeatures) {
                  if ($alloc = $this->profile_guided_allocate($tagfeatures, max(1, $parallelruns), $currentrun)) {
                      $allocatedfeatures = array_merge($allocatedfeatures, $alloc);
                  } else {
                      // Divide the list of feature files amongst the parallel runners.
                      // Pull out the features for just this worker.
                      if (count($tagfeatures)) {
                          $splitfeatures = array_chunk($tagfeatures, ceil(count($tagfeatures) / max(1, $parallelruns)));
  
                          // Check if there is any feature file for this process.
                          if (!empty($splitfeatures[$currentrun - 1])) {
                              $allocatedfeatures = array_merge($allocatedfeatures, $splitfeatures[$currentrun - 1]);
                          }
                      }
                  }
              }
          }
  
          return $allocatedfeatures;
      }
code_tokens: protected function get_features_for_the_run ( $ features , $ parallelruns , $ currentrun ) { // If no features are passed then just return. if ( empty ( $ features ) ) { return $ features ; } $ allocatedfeatures = $ features ; // If parallel run, then only divide features. if ( ! empty ( $ currentrun ) && ! empty ( $ parallelruns ) ) { $ featurestodivide [ 'withtags' ] = $ features ; $ allocatedfeatures = array ( ) ; // If tags are set then split features with tags first. if ( ! empty ( $ this -> tags ) ) { $ featurestodivide [ 'withtags' ] = $ this -> filtered_features_with_tags ( $ features ) ; $ featurestodivide [ 'withouttags' ] = $ this -> remove_blacklisted_features_from_list ( $ features , $ featurestodivide [ 'withtags' ] ) ; } // Attempt to split into weighted buckets using timing information, if available. foreach ( $ featurestodivide as $ tagfeatures ) { if ( $ alloc = $ this -> profile_guided_allocate ( $ tagfeatures , max ( 1 , $ parallelruns ) , $ currentrun ) ) { $ allocatedfeatures = array_merge ( $ allocatedfeatures , $ alloc ) ; } else { // Divide the list of feature files amongst the parallel runners. // Pull out the features for just this worker. if ( count ( $ tagfeatures ) ) { $ splitfeatures = array_chunk ( $ tagfeatures , ceil ( count ( $ tagfeatures ) / max ( 1 , $ parallelruns ) ) ) ; // Check if there is any feature file for this process. if ( ! empty ( $ splitfeatures [ $ currentrun - 1 ] ) ) { $ allocatedfeatures = array_merge ( $ allocatedfeatures , $ splitfeatures [ $ currentrun - 1 ] ) ; } } } } } return $ allocatedfeatures ; }
docstring: Divide features between the runs and return list.
  
  @param array $features list of features to be divided.
  @param int $parallelruns how many parallel runs feature needs to be divided.
  @param int $currentrun current run for which features should be returned.
  @return array
docstring_tokens: Divide features between the runs and return list .