commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-new / civicrm / vendor / civicrm / civicrm-cxn-rpc / src / Message / GarbledMessage.php
1 <?php
2
3 /*
4 * This file is part of the civicrm-cxn-rpc package.
5 *
6 * Copyright (c) CiviCRM LLC <info@civicrm.org>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this package.
10 */
11
12 namespace Civi\Cxn\Rpc\Message;
13
14 use Civi\Cxn\Rpc\Exception\InvalidMessageException;
15 use Civi\Cxn\Rpc\Message;
16
17 /**
18 * Class GarbledMessage
19 *
20 * A garbled message is one that lacks a proper prefix.
21 *
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.
24 *
25 * It may actually be possible to disregard PHP's error output by
26 * searching for prefix+delimiter... another day...
27 *
28 * @package Civi\Cxn\Rpc\Message
29 */
30 class GarbledMessage extends Message {
31 const NAME = 'CXN-0.2-GARBLED';
32
33 public function encode() {
34 throw new \RuntimeException("Why would you intentionally encode a garbled message this way?");
35 }
36
37 /**
38 * @param string $message
39 * @return InsecureMessage
40 * @throws InvalidMessageException
41 */
42 public static function decode($message) {
43 return new GarbledMessage($message);
44 }
45
46 }