-
-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathMap.php
More file actions
executable file
·50 lines (45 loc) · 1.15 KB
/
Copy pathMap.php
File metadata and controls
executable file
·50 lines (45 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/*
* This file is part of the Stomp package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Stomp\Transport;
/**
* Message that contains a set of name-value pairs
*
* @package Stomp
*/
class Map extends Message
{
public $map;
/**
* Constructor
*
* @param array|object|string $body string will get decoded (receive), otherwise the body will be encoded (send)
* @param array $headers
* @param string $command
*/
public function __construct($body, array $headers = [], $command = 'SEND')
{
if (is_string($body)) {
parent::__construct($body, $headers);
$this->command = $command;
$this->map = json_decode($body, true);
} else {
parent::__construct(json_encode($body), $headers + ['transformation' => 'jms-map-json']);
$this->command = $command;
$this->map = $body;
}
}
/**
* Returns the received decoded json.
*
* @return mixed
*/
public function getMap()
{
return $this->map;
}
}