<reponame>barracudanetworks/constantsgen
class PHPWriter:
    def __init__(self, constants):
        self.constants = constants

    def write(self, out):
        out.write("<?php\n")
        out.write("/* This file was generated by generate_constants. */\n\n")

        for enum in self.constants.enum_values.values():
            out.write("\n")
            for name, value in enum.items():
                out.write("define('{}',        {});\n".format(name, value))

        for name, value in self.constants.constant_values.items():
            out.write("define('{}',        {});\n".format(name, value))

class PHPWriter:
    def __init__(self, constants):
        self.constants = constants

    def write(self, out):
        out.write("<?php\n")
        out.write("/* This file was generated by generate_constants. */\n\n")

        for enum in self.constants.enum_values.values():
            out.write("\n")
            for name, value in enum.items():
                out.write("define('{}',        {});\n".format(name, value))

        for name, value in self.constants.constant_values.items():
            out.write("define('{}',        {});\n".format(name, value))