public function syntax($error = "Please specify valid options")
    {
        $ostr = (!$error) ? STDOUT : STDERR;
        if (is_string($error))
            fprintf($ostr, "Error: %s\n", $error);
        fprintf($ostr, "Syntax: php " . $_SERVER['argv'][0] . " <options> <action>\n\n");
        fprintf($ostr, "Options: \n");
        $max_opt_length = 0;
        $max_arg_length = 0;

        // Sort the parameters alphabetically
        $params = $this->parameters;
        usort($params, function ($a, $b) {
            $lo = !empty($a[0]) ? $a[0] : $a[1];
            $ro = !empty($b[0]) ? $b[0] : $b[1];
            return strcmp($lo, $ro);
        });

        foreach ($params as $param)
        {
            $max_opt_length = max(strlen($param[1]) + 3, $max_opt_length);
            $max_arg_length = max(strlen($param[2]) + 3, $max_arg_length);
        }

        foreach ($this->parameters as $param)
        {
            fprintf($ostr, "    ");
            $so = $param[0] ? "-" . $param[0] : "";
            $lo = $param[1] ? "--" . $param[1] : "";
            $arg = $param[2] ? '<' . $param[2] . '>' : "";

            $pstr = sprintf("%-2s %-" . $max_opt_length . "s %-" . $max_arg_length . "s ", $so, $lo, $arg);
            $indent = strlen($pstr) + 4;
            fprintf($ostr, $pstr);

            self::formatText($indent, self::MAX_LINE_LENGTH, $param[3], $ostr);
        }
        exit($error === false ? 0 : 1);
    }