You are here

function do_coder_review_callback in Coder 7.2

Same name and namespace in other branches
  1. 5.2 coder.module \do_coder_review_callback()
  2. 5 coder.module \do_coder_review_callback()
  3. 6.2 coder.module \do_coder_review_callback()
  4. 6 coder.module \do_coder_review_callback()
  5. 7 coder_review/coder_review.module \do_coder_review_callback()

Performs a 'callback' type of coder_review.

This type of do_coder_review_* allows for an arbitrary callback function to perform a review.

Parameters

array $coder_args: A Coder settings array, passed by reference. See do_coder_review() for format.

array $review: Review array the current rule belongs to, used by _coder_review_severity_name().

array $rule: Rule array being checked.

array $lines: Pertinent source file lines according to rule's '#source' value.

array $results: Results array variable to save errors to, passed by reference.

See also

do_coder_review()

_coder_review_severity_name()

1 call to do_coder_review_callback()
do_coder_review in coder_review/coder_review.common.inc
Performs a code review for a review array.

File

coder_review/coder_review.common.inc, line 1237
Common functions used by both the drush and form interfaces.

Code

function do_coder_review_callback(array &$coder_args, array $review, array $rule, array $lines, array &$results) {
  $function = $rule['#value'];
  if ($function) {
    if (function_exists($function)) {
      call_user_func_array($function, array(
        &$coder_args,
        $review,
        $rule,
        $lines,
        &$results,
      ));
    }
    else {
      static $bad;
      if (!isset($bad[$function])) {
        $bad[$function] = 1;
        _message(_t('Invalid rule callback @function', array(
          '@function' => $function,
        )), 'error');
      }
    }
  }
}