private function validate_moodle_variable_name($varname, PHP_CodeSniffer_File $phpcsfile, $stackptr) {
        if (preg_match('/[A-Z]+/', $varname) && !in_array($varname, self::$allowedglobals)) {
            $error = "Variable \"$varname\" must be all lower-case";
            $phpcsfile->addError($error, $stackptr);
        }

        if (strpos($varname, '_') !== false && !in_array($varname, self::$allowedglobals)) {
            $error = "Variable \"$varname\" must not contain underscores.";
            $phpcsfile->addError($error, $stackptr);
        }
    }
private function validate_moodle_variable_name($varname, PHP_CodeSniffer_File $phpcsfile, $stackptr) {
        if (preg_match('/[A-Z]+/', $varname) && !in_array($varname, self::$allowedglobals)) {
            $error = "Variable \"$varname\" must be all lower-case";
            $phpcsfile->addError($error, $stackptr);
        }

        if (strpos($varname, '_') !== false && !in_array($varname, self::$allowedglobals)) {
            $error = "Variable \"$varname\" must not contain underscores.";
            $phpcsfile->addError($error, $stackptr);
        }
    }
private function validate_moodle_variable_name ( $ varname , PHP_CodeSniffer_File $ phpcsfile , $ stackptr ) { if ( preg_match ( '/[A-Z]+/' , $ varname ) && ! in_array ( $ varname , self :: $ allowedglobals ) ) { $ error = "Variable \"$varname\" must be all lower-case" ; $ phpcsfile -> addError ( $ error , $ stackptr ) ; } if ( strpos ( $ varname , '_' ) !== false && ! in_array ( $ varname , self :: $ allowedglobals ) ) { $ error = "Variable \"$varname\" must not contain underscores." ; $ phpcsfile -> addError ( $ error , $ stackptr ) ; } }
Processes normal moodle variables against Moodle coding guidelines. Note this
can't be used for member variables as we allow slightly different rules there.

@param string               $varname   The name of the variable.
@param PHP_CodeSniffer_File $phpcsfile The file where this token was found.
@param int                  $stackptr  The position where the token was found.

@return void
Processes normal moodle variables against Moodle coding guidelines . Note this can t be used for member variables as we allow slightly different rules there .