alexia\mar\tests\critical::_oldClassConstructors PHP Method

_oldClassConstructors() public method

public _oldClassConstructors ( $line )
    public function _oldClassConstructors($line)
    {
        static $lastClassName = false;
        // reset the name of the class that we've seen
        if ($line === '<?php') {
            $lastClassName = false;
        }
        // find the start of PHP class declaration
        if (preg_match('#^\\s?(abstract\\s+)?class (\\w+)#', $line, $matches)) {
            $lastClassName = $matches[2];
        }
        // is the class name used as the function name?
        if ($lastClassName !== false && strpos($line, 'function') !== false) {
            if (preg_match("#function {$lastClassName}\\s?\\(#", $line)) {
                return true;
            }
        }
        return false;
    }