Example #1
0
function global_method_names($json_spec)
{
    $ret = array();
    foreach ($json_spec['classes'] as $c) {
        foreach ($c['methods'] as $m) {
            $ret[$c['id'] . "," . $m['id']] = ucfirst($c['name']) . '.' . to_snake_case($m['name']);
        }
    }
    return export_property($ret);
}
$properties = '';
$properties .= 'public static $AMQP_PROTOCOL_HEADER = ' . protocol_header($json_spec) . ";\n\n";
$properties .= 'public static $FRAME_TYPES = ' . frame_types($json_spec) . ";\n\n";
$properties .= 'public static $CONTENT_METHODS = ' . content_methods($json_spec) . ";\n\n";
$properties .= 'public static $CLOSE_METHODS = ' . close_methods($json_spec) . ";\n\n";
$properties .= 'public static $GLOBAL_METHOD_NAMES = ' . global_method_names($json_spec) . ";\n";
$out = '<?php' . "\n\n";
$out .= '/* This file was autogenerated by spec/parser.php - Do not modify */' . "\n\n";
$out .= 'namespace PhpAmqpLib\\Wire;' . "\n\n";
$out .= "class Constants" . protocol_version($json_spec) . "\n";
$out .= "{\n\n";
$out .= indent($properties) . "\n";
$out .= "}\n";
file_put_contents(__DIR__ . '/../PhpAmqpLib/Wire/Constants' . protocol_version($json_spec) . '.php', $out);
function method_waits($json_spec)
{
    $ret = array();
    foreach ($json_spec['classes'] as $c) {
        foreach ($c['methods'] as $m) {
            $ret[$c['name'] . '.' . to_snake_case($m['name'])] = $c['id'] . "," . $m['id'];
        }
Example #2
0
        foreach ($c['methods'] as $m) {
            $ret[$c['id'] . "," . $m['id']] = ucfirst($c['name']) . '.' . to_snake_case($m['name']);
        }
    }
    return var_export($ret, true);
}
$out = "<?php\n\n";
$out .= "/* This file was autogenerated by spec/parser.php - Do not modify */\n\n";
$out .= "namespace PhpAmqpLib\\Wire;\n\n";
$out .= "class Constants" . protocol_version($json_spec) . "\n";
$out .= "{\n";
$out .= "\tpublic static \$AMQP_PROTOCOL_HEADER = \"" . protocol_header($json_spec) . "\";\n\n";
$out .= "\tpublic static \$FRAME_TYPES = " . frame_types($json_spec) . ";\n\n";
$out .= "\tpublic static \$CONTENT_METHODS = " . content_methods($json_spec) . ";\n\n";
$out .= "\tpublic static \$CLOSE_METHODS = " . close_methods($json_spec) . ";\n\n";
$out .= "\tpublic static \$GLOBAL_METHOD_NAMES = " . global_method_names($json_spec) . ";\n";
$out .= "}\n";
file_put_contents(__DIR__ . '/../PhpAmqpLib/Wire/Constants' . protocol_version($json_spec) . '.php', $out);
function method_waits($json_spec)
{
    $ret = array();
    foreach ($json_spec['classes'] as $c) {
        foreach ($c['methods'] as $m) {
            $ret[$c['name'] . '.' . to_snake_case($m['name'])] = $c['id'] . "," . $m['id'];
        }
    }
    return var_export($ret, true);
}
$out = "<?php\n\n";
$out .= "/* This file was autogenerated by spec/parser.php - Do not modify */\n\n";
$out .= "namespace PhpAmqpLib\\Helper\\Protocol;\n\n";