public function process(PHP_CodeSniffer_File $file, $pointer) {
        // Special dispensation for behat files.
        if (basename(dirname($file->getFilename())) === 'behat') {
            return;
        }

        // Special dispensation for lang files.
        if (basename(dirname(dirname($file->getFilename()))) === 'lang') {
            return;
        }

        // We only want to do this once per file.
        $prevopentag = $file->findPrevious(T_OPEN_TAG, $pointer - 1);
        if ($prevopentag !== false) {
            return;
        }

        // Find where real code is and check from there.
        $pointer = $this->get_position_of_relevant_code($file, $pointer);

        // OK, we've got to the first bit of relevant code.
        if ($this->is_moodle_internal_or_die_check($file, $pointer)) {
            // There is a MOODLE_INTERNAL check. This file is good, hurrah!
            return;
        }
        if ($this->is_config_php_incluson($file, $pointer)) {
            // We are requiring config.php. This file is good, hurrah!
            return;
        }

        if ($this->is_if_not_moodle_internal_die_check($file, $pointer)) {
            // It's an old-skool MOODLE_INTERNAL check. This file is good, hurrah!
            return;
        }

        // Got here because, so something is not right.
        $file->addWarning('Expected MOODLE_INTERNAL check or config.php inclusion', $pointer);
    }
public function process(PHP_CodeSniffer_File $file, $pointer) {
        // Special dispensation for behat files.
        if (basename(dirname($file->getFilename())) === 'behat') {
            return;
        }

        // Special dispensation for lang files.
        if (basename(dirname(dirname($file->getFilename()))) === 'lang') {
            return;
        }

        // We only want to do this once per file.
        $prevopentag = $file->findPrevious(T_OPEN_TAG, $pointer - 1);
        if ($prevopentag !== false) {
            return;
        }

        // Find where real code is and check from there.
        $pointer = $this->get_position_of_relevant_code($file, $pointer);

        // OK, we've got to the first bit of relevant code.
        if ($this->is_moodle_internal_or_die_check($file, $pointer)) {
            // There is a MOODLE_INTERNAL check. This file is good, hurrah!
            return;
        }
        if ($this->is_config_php_incluson($file, $pointer)) {
            // We are requiring config.php. This file is good, hurrah!
            return;
        }

        if ($this->is_if_not_moodle_internal_die_check($file, $pointer)) {
            // It's an old-skool MOODLE_INTERNAL check. This file is good, hurrah!
            return;
        }

        // Got here because, so something is not right.
        $file->addWarning('Expected MOODLE_INTERNAL check or config.php inclusion', $pointer);
    }
public function process ( PHP_CodeSniffer_File $ file , $ pointer ) { // Special dispensation for behat files. if ( basename ( dirname ( $ file -> getFilename ( ) ) ) === 'behat' ) { return ; } // Special dispensation for lang files. if ( basename ( dirname ( dirname ( $ file -> getFilename ( ) ) ) ) === 'lang' ) { return ; } // We only want to do this once per file. $ prevopentag = $ file -> findPrevious ( T_OPEN_TAG , $ pointer - 1 ) ; if ( $ prevopentag !== false ) { return ; } // Find where real code is and check from there. $ pointer = $ this -> get_position_of_relevant_code ( $ file , $ pointer ) ; // OK, we've got to the first bit of relevant code. if ( $ this -> is_moodle_internal_or_die_check ( $ file , $ pointer ) ) { // There is a MOODLE_INTERNAL check. This file is good, hurrah! return ; } if ( $ this -> is_config_php_incluson ( $ file , $ pointer ) ) { // We are requiring config.php. This file is good, hurrah! return ; } if ( $ this -> is_if_not_moodle_internal_die_check ( $ file , $ pointer ) ) { // It's an old-skool MOODLE_INTERNAL check. This file is good, hurrah! return ; } // Got here because, so something is not right. $ file -> addWarning ( 'Expected MOODLE_INTERNAL check or config.php inclusion' , $ pointer ) ; }
Processes php files and looks for MOODLE_INTERNAL or config.php
inclusion.

@param PHP_CodeSniffer_File $file The file being scanned.
@param int $pointer The position in the stack.
Processes php files and looks for MOODLE_INTERNAL or config . php inclusion .