You are here

function _coder_severity in Coder 5.2

Same name and namespace in other branches
  1. 5 coder.module \_coder_severity()
  2. 6.2 coder.module \_coder_severity()
  3. 6 coder.module \_coder_severity()

Return the integer severity magic number for a string severity.

Parameters

$severity_name: String severity name 'minor', 'normal', or 'critical'.

$default_value: Integer to use if severity string is not recognized.

Return value

Integer.

2 calls to _coder_severity()
coder_drush_review in ./coder.drush.inc
do_coder_review in ./coder.module
Perform code review for a review array.

File

./coder.module, line 1130
Developer Module that assists with code review and version upgrade that supports a plug-in extensible hook system so contributed modules can define additional review standards.

Code

function _coder_severity($severity_name, $default_value = 5) {

  // NOTE: Implemented this way in hopes that it is faster than a php switch.
  if (!isset($severity_names)) {
    $severity_names = array(
      'minor' => 1,
      'normal' => 5,
      'critical' => 9,
    );
  }
  if (isset($severity_names[$severity_name])) {
    return $severity_names[$severity_name];
  }
  return $default_value;
}