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

TEventParameter   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 50
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getEventName() 0 3 1
A getParameter() 0 3 1
A __construct() 0 4 1
A setParameter() 0 3 1
A setEventName() 0 3 1
1
<?php
2
/**
3
 * TComponent, TPropertyValue classes
4
 *
5
 * @author Qiang Xue <[email protected]>
6
 *
7
 * Global Events, intra-object events, Class behaviors, expanded behaviors
8
 * @author Brad Anderson <[email protected]>
9
 *
10
 * @link https://github.com/pradosoft/prado
11
 * @license https://github.com/pradosoft/prado/blob/master/LICENSE
12
 */
13
14
namespace Prado;
15
16
/**
17
 * TEventParameter class.
18
 *
19
 * TEventParameter is the base class for all event parameter classes.
20
 * When raising an event, this class captures the event name being raised by being
21
 * an {@link IEventParameter}. TEventParameter encapsulates the parameter data for
22
 * events. The event parameter is set via {@link setParameter Parameter} property
23
 * or by constructor parameter.
24
 *
25
 * @author Qiang Xue <[email protected]>
26
 * @since 3.0
27
 */
28
class TEventParameter extends \Prado\TComponent implements IEventParameter
29
{
30
	private string $_eventName = '';
31
	private mixed $_param;
32
33
	/**
34
	 * Constructor.
35
	 * @param null|mixed $parameter parameter of the event
36
	 * @since 4.2.3
37
	 */
38
	public function __construct(mixed $parameter = null)
39
	{
40
		$this->setParameter($parameter);
41
		parent::__construct();
42
	}
43
44
	/**
45
	 * @return string name of the event
46
	 * @since 4.2.3
47
	 */
48
	public function getEventName(): string
49
	{
50
		return $this->_eventName;
51
	}
52
53
	/**
54
	 * @param string $value name of the event
55
	 * @since 4.2.3
56
	 */
57
	public function setEventName(string $value)
58
	{
59
		$this->_eventName = $value;
60
	}
61
62
	/**
63
	 * @return mixed parameter of the event
64
	 * @since 4.2.3
65
	 */
66
	public function getParameter(): mixed
67
	{
68
		return $this->_param;
69
	}
70
71
	/**
72
	 * @param mixed $value parameter of the event
73
	 * @since 4.2.3
74
	 */
75
	public function setParameter(mixed $value)
76
	{
77
		$this->_param = $value;
78
	}
79
}
80