original_string: public static function get_behat_dir($runprocess = 0) {
          global $CFG;
  
          // If not set then return empty string.
          if (!isset($CFG->behat_dataroot)) {
              return "";
          }
  
          // If $CFG->behat_parallel_run starts with index 0 and $runprocess for parallel run starts with 1.
          if (!empty($runprocess) && isset($CFG->behat_parallel_run[$runprocess - 1]['behat_dataroot'])) {
              $behatdir = $CFG->behat_parallel_run[$runprocess - 1]['behat_dataroot'] . '/behat';;
          } else {
              $behatdir = $CFG->behat_dataroot . '/behat';
          }
  
          if (!is_dir($behatdir)) {
              if (!mkdir($behatdir, $CFG->directorypermissions, true)) {
                  behat_error(BEHAT_EXITCODE_PERMISSIONS, 'Directory ' . $behatdir . ' can not be created');
              }
          }
  
          if (!is_writable($behatdir)) {
              behat_error(BEHAT_EXITCODE_PERMISSIONS, 'Directory ' . $behatdir . ' is not writable');
          }
  
          return $behatdir;
      }
code: public static function get_behat_dir($runprocess = 0) {
          global $CFG;
  
          // If not set then return empty string.
          if (!isset($CFG->behat_dataroot)) {
              return "";
          }
  
          // If $CFG->behat_parallel_run starts with index 0 and $runprocess for parallel run starts with 1.
          if (!empty($runprocess) && isset($CFG->behat_parallel_run[$runprocess - 1]['behat_dataroot'])) {
              $behatdir = $CFG->behat_parallel_run[$runprocess - 1]['behat_dataroot'] . '/behat';;
          } else {
              $behatdir = $CFG->behat_dataroot . '/behat';
          }
  
          if (!is_dir($behatdir)) {
              if (!mkdir($behatdir, $CFG->directorypermissions, true)) {
                  behat_error(BEHAT_EXITCODE_PERMISSIONS, 'Directory ' . $behatdir . ' can not be created');
              }
          }
  
          if (!is_writable($behatdir)) {
              behat_error(BEHAT_EXITCODE_PERMISSIONS, 'Directory ' . $behatdir . ' is not writable');
          }
  
          return $behatdir;
      }
code_tokens: public static function get_behat_dir ( $ runprocess = 0 ) { global $ CFG ; // If not set then return empty string. if ( ! isset ( $ CFG -> behat_dataroot ) ) { return "" ; } // If $CFG->behat_parallel_run starts with index 0 and $runprocess for parallel run starts with 1. if ( ! empty ( $ runprocess ) && isset ( $ CFG -> behat_parallel_run [ $ runprocess - 1 ] [ 'behat_dataroot' ] ) ) { $ behatdir = $ CFG -> behat_parallel_run [ $ runprocess - 1 ] [ 'behat_dataroot' ] . '/behat' ; ; } else { $ behatdir = $ CFG -> behat_dataroot . '/behat' ; } if ( ! is_dir ( $ behatdir ) ) { if ( ! mkdir ( $ behatdir , $ CFG -> directorypermissions , true ) ) { behat_error ( BEHAT_EXITCODE_PERMISSIONS , 'Directory ' . $ behatdir . ' can not be created' ) ; } } if ( ! is_writable ( $ behatdir ) ) { behat_error ( BEHAT_EXITCODE_PERMISSIONS , 'Directory ' . $ behatdir . ' is not writable' ) ; } return $ behatdir ; }
docstring: Ensures the behat dir exists in moodledata
  @param int $runprocess run process for which behat dir is returned.
  @return string Full path
docstring_tokens: Ensures the behat dir exists in moodledata