Passed
Push — master ( 30451f...036a09 )
by Fabio
07:34 queued 02:23
created

TBroadcastEventParameter::setParameter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
/**
3
 * TControl, TControlCollection, TEventParameter and INamingContainer class file
4
 *
5
 * @author Qiang Xue <[email protected]>
6
 * @link https://github.com/pradosoft/prado
7
 * @license https://github.com/pradosoft/prado/blob/master/LICENSE
8
 */
9
10
namespace Prado\Web\UI;
11
12
/**
13
 * TBroadcastEventParameter class
14
 *
15
 * TBroadcastEventParameter encapsulates the parameter data for
16
 * events that are broadcasted. The name of of the event is specified via
17
 * {@link setName Name} property while the event parameter is via
18
 * {@link setParameter Parameter} property.
19
 *
20
 * @author Qiang Xue <[email protected]>
21
 * @since 3.0
22
 */
23
class TBroadcastEventParameter extends \Prado\TEventParameter
24
{
25
	/**
26
	 * Constructor.
27
	 * @param string $name name of the broadcast event
28
	 * @param null|mixed $parameter parameter of the broadcast event
29
	 */
30
	public function __construct(string $name = '', mixed $parameter = null)
31
	{
32
		parent::setEventName($name);
33
		parent::__construct($parameter);
34
	}
35
36
	/**
37
	 * @return string name of the broadcast event
38
	 */
39
	public function getName()
40
	{
41
		return parent::getEventName();
42
	}
43
44
	/**
45
	 * @param string $value name of the broadcast event
46
	 */
47
	public function setName($value)
48
	{
49
		parent::setEventName($value);
50
	}
51
52
	/**
53
	 * @param string $value name of the broadcast event
54
	 * @since 4.2.3
55
	 */
56
	public function setEventName(string $value)
57
	{
58
		if ($this->getEventName() === '') {
59
			parent::setEventName($value);
60
		}
61
	}
62
63
}
64