Phalcon\Build\Generator_File_PhalconC::limitVisibilityOfPhalconFuncs PHP Method

limitVisibilityOfPhalconFuncs() protected method

Go through the generated file and put 'static' to all declarations of Phalcon-related functions
    protected function limitVisibilityOfPhalconFuncs()
    {
        $resContent = '';
        $prefixes = array('zephir', 'phalcon', 'phannot', 'phvolt', 'phql');
        foreach (file($this->outputFile) as $line) {
            $modified = true;
            foreach ($prefixes as $prefix) {
                if (preg_match('/^int ' . $prefix . '_/i', $line)) {
                    $line = 'static ' . $line;
                    break;
                }
                if (preg_match('/^void ' . $prefix . '_/i', $line)) {
                    $line = 'static ' . $line;
                    break;
                }
                if (preg_match('/^zend_class_entry *' . $prefix . '_/i', $line)) {
                    $line = 'static ' . $line;
                    break;
                }
                $modified = false;
            }
            if (!$modified) {
                if (preg_match('/^PHP_METHOD\\(([a-zA-Z0-9\\_]+), ([a-zA-Z0-9\\_]+)\\)/', $line, $matches)) {
                    $line = str_replace($matches[0], 'static PHP_METHOD(' . $matches[1] . ', ' . $matches[2] . ')', $line);
                }
            }
            $resContent .= $line;
        }
        file_put_contents($this->outputFile, $resContent);
    }