SqlParser\Tools\ContextGenerator::build PHP Метод

build() публичный статический Метод

Reads the input file, generates the data and writes it back.
public static build ( string $input, string $output ) : void
$input string The input file.
$output string The output directory.
Результат void
    public static function build($input, $output)
    {
        /**
         * The directory that contains the input file.
         *
         * Used to include common files.
         *
         * @var string
         */
        $directory = dirname($input) . '/';
        /**
         * The name of the file that contains the context.
         *
         * @var string
         */
        $file = basename($input);
        /**
         * The name of the context.
         *
         * @var string
         */
        $name = substr($file, 0, -4);
        /**
         * The name of the class that defines this context.
         *
         * @var string
         */
        $class = 'Context' . $name;
        /**
         * The formatted name of this context.
         *
         * @var string
         */
        $formattedName = str_replace(array('Context', 'MySql', '00', '0'), array('', 'MySQL ', '', '.'), $class);
        file_put_contents($output . '/' . $class . '.php', static::generate(array('name' => $formattedName, 'class' => $class, 'link' => static::$LINKS[$name], 'keywords' => static::readWords(array($directory . '_common.txt', $directory . '_functions' . $file, $directory . $file)))));
    }