private function parseMessage($message)
    {
        $parsedMessage = null;

        /**
         * According to PSR-3 we can accept string-like values (eg stuff we can parse easily into a string, such as obviously
         * strings and numbers, and objects that can be cast to strings).
         */
        switch (gettype($message)) {
            case 'boolean':
            case 'integer':
            case 'double':
            case 'string':
            case 'NULL':
                $parsedMessage = (string) $message;
                break;

            case 'object':
                if (method_exists($message, '__toString') !== false) {
                    $parsedMessage = (string) $message;
                    break;
                }
                // Otherwise, go on to default below

            default:
                throw new InvalidArgumentException('Message can only be a string, number or an object which can be cast to a string');
        }

        return $parsedMessage;
    }