function _apachesolr_drush_variable_format in Apache Solr Search 6.3        
                          
                  
                        Same name and namespace in other branches
- 8 drush/apachesolr.drush.inc \_apachesolr_drush_variable_format()
- 7 drush/apachesolr.drush.inc \_apachesolr_drush_variable_format()
1 call to _apachesolr_drush_variable_format()
  - drush_apachesolr_solr_variable_set in drush/apachesolr.drush.inc
- Command callback.
Set a variable.
File
 
   - drush/apachesolr.drush.inc, line 445
- drush integration for apachesolr.
Code
function _apachesolr_drush_variable_format($value, $format) {
  if ($format == 'auto') {
    if (is_numeric($value)) {
      $format = 'integer';
    }
    elseif ($value == 'TRUE' || $value == 'FALSE') {
      $format = 'bool';
    }
  }
  
  switch ($format) {
    case 'integer':
      $value = (int) $value;
      break;
    case 'bool':
    case 'boolean':
      if ($value == 'TRUE') {
        $value = TRUE;
      }
      elseif ($value == 'FALSE') {
        $value = FALSE;
      }
      else {
        $value = (bool) $value;
      }
      break;
    case 'json':
      $value = drush_json_decode($value);
      break;
  }
  return $value;
}