Class it:

/**
 * Print message to stderr and exit with error code
 */
static function bail($message = "Bailed.")
{
    fputs(STDERR, rtrim($message, "\n") . "\n");
    exit(1);
}