You are here

function coder_drush_review in Coder 5.2

Same name and namespace in other branches
  1. 6.2 coder.drush.inc \coder_drush_review()
  2. 6 coder.drush.inc \coder_drush_review()
1 string reference to 'coder_drush_review'
coder_drush_command in ./coder.drush.inc
Implementation of hook_drush_command().

File

./coder.drush.inc, line 24

Code

function coder_drush_review() {
  _coder_drush_set_option('drush');

  // process command line arguments
  $args = func_get_args();
  $reviews = array();
  $modules = array();
  $settings = _coder_get_default_settings();
  if (count($args)) {
    $avail_reviews = _coder_reviews();
    foreach ($args as $arg) {
      switch ($arg) {
        case 'summary':
        case 'no-empty':
          _coder_drush_set_option($arg);
          break;
        case 'active':
        case 'core':
        case 'all':
        case 'default':
          $settings = _coder_get_default_settings($arg);
          $settings['coder_includes'] = TRUE;
          break;
        case 'major':
        case 'minor':
        case 'critical':
          $severity_name = $arg;
          break;
        default:
          if (isset($avail_reviews[$arg])) {
            $reviews[$arg] = $arg;
          }
          elseif (substr($arg, 0, 3) == 'no-') {
            _coder_set_form_modules($settings);
            unset($settings['coder_modules-' . substr($arg, 3)]);
          }
          else {
            unset($settings['coder_active_modules']);
            unset($settings['coder_core']);
            unset($settings['coder_all']);
            unset($settings['coder_modules']);
            $settings['coder_modules-' . $arg] = 1;
            $settings['coder_includes'] = TRUE;
          }
          break;
      }
    }
    $output = array();
    if (isset($severity_name)) {
      $output[] = dt('Severity @severity_name', array(
        '@severity_name' => $severity_name,
      ));
      $settings['coder_severity'] = _coder_severity($severity_name);
    }
    if (count($reviews)) {
      foreach ($reviews as $review) {
        $output[] = $avail_reviews[$review]['#title'];
      }
      $settings['coder_reviews'] = $reviews;
    }
    if (count($output) && !_coder_drush_is_option('summary')) {
      drush_print(implode(', ', $output) . "\n");
    }
  }
  _coder_set_form_modules($settings);
  $settings['op'] = 'drush';
  coder_page_form($settings);
}