4 * This file is part of the civicrm-cxn-rpc package.
6 * Copyright (c) CiviCRM LLC <info@civicrm.org>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this package.
12 namespace Civi\Cxn\Rpc\Message
;
14 use Civi\Cxn\Rpc\Exception\InvalidMessageException
;
15 use Civi\Cxn\Rpc\Message
;
18 * Class GarbledMessage
20 * A garbled message is one that lacks a proper prefix.
22 * This is common if the other end is using PHP and encounters a PHP error;
23 * PHP's debug output gets plopped into our pretty data stream.
25 * It may actually be possible to disregard PHP's error output by
26 * searching for prefix+delimiter... another day...
28 * @package Civi\Cxn\Rpc\Message
30 class GarbledMessage
extends Message
{
31 const NAME
= 'CXN-0.2-GARBLED';
33 public function encode() {
34 throw new \
RuntimeException("Why would you intentionally encode a garbled message this way?");
38 * @param string $message
39 * @return InsecureMessage
40 * @throws InvalidMessageException
42 public static function decode($message) {
43 return new GarbledMessage($message);