Passed
Push — master ( 22ccfd...5bc476 )
by Aimeos
12:34
created

Standard::__toString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
/**
4
 * @license LGPLv3, https://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2016-2024
6
 * @package Base
7
 * @subpackage MQueue
8
 */
9
10
11
namespace Aimeos\Base\MQueue\Message;
12
13
14
/**
15
 * Default message implementation
16
 *
17
 * @package Base
18
 * @subpackage MQueue
19
 */
20
class Standard implements Iface
21
{
22
	private array $values;
23
24
25
	/**
26
	 * Initializes the message object
27
	 *
28
	 * @param array $values Associative list of key/value pairs
29
	 */
30
	public function __construct( array $values )
31
	{
32
		$this->values = $values;
33
	}
34
35
36
	/**
37
	 * Returns the message body
38
	 *
39
	 * @return string Message body
40
	 */
41
	public function getBody() : string
42
	{
43
		return ( isset( $this->values['message'] ) ? $this->values['message'] : '' );
44
	}
45
46
47
	/**
48
	 * Returns the message ID
49
	 *
50
	 * @return integer|null Message ID
51
	 */
52
	public function getId() : ?string
53
	{
54
		return ( isset( $this->values['id'] ) ? $this->values['id'] : null );
55
	}
56
57
58
	/**
59
	 * Returns the message body
60
	 *
61
	 * @return string Message body
62
	 */
63
	public function __toString() : string
64
	{
65
		return ( isset( $this->values['message'] ) ? $this->values['message'] : '' );
66
	}
67
}
68