Passed
Push — master ( 883d7f...cc20de )
by Fabio
05:10
created

TEventContent::getBroadcastEvent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 1
c 1
b 1
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
/**
3
 * TEventContent class file
4
 *
5
 * @author Brad Anderson <[email protected]>
6
 * @link https://github.com/pradosoft/prado
7
 * @license https://github.com/pradosoft/prado/blob/master/LICENSE
8
 * @package Prado\Web\UI
9
 */
10
11
namespace Prado\Web\UI;
12
13
use Prado\TPropertyValue;
14
15
/**
16
 * TEventContent class
17
 *
18
 * TEventContent loads child controls by raising the {@link getBroadcastEvent BroadcastEvent}
19
 * 'fx' event.  The handlers then add their own controls to the child control list in $param.
20
 *
21
 * The event {@link getBroadcastEvent} is raised with this control
22
 * as the $sender and the {@link getControls Control} List as $param.
23
 *
24
 * @author Brad Anderson <[email protected]>
25
 * @package Prado\Web\UI
26
 * @since 4.2.0
27
 */
28
29
class TEventContent extends TCompositeControl
30
{
31
	/**
32
	 * creates child controls by raising the 'fx' event BroadcastEvent
33
	 * for handlers to then add their own controls.
34
	 */
35
	public function createChildControls()
36
	{
37
		if ($event = $this->getBroadcastEvent()) {
38
			$this->raiseEvent($event, $this, $this->getControls());
0 ignored issues
show
Bug introduced by
$this->getControls() of type Prado\Web\UI\TControlCollection is incompatible with the type Prado\TEventParameter expected by parameter $param of Prado\TComponent::raiseEvent(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

38
			$this->raiseEvent($event, $this, /** @scrutinizer ignore-type */ $this->getControls());
Loading history...
39
		}
40
	}
41
42
	/**
43
	 * @return string the the event to be raised for createChildControls
44
	 */
45
	public function getBroadcastEvent()
46
	{
47
		return $this->getControlState('BroadcastEvent', '');
48
	}
49
50
	/**
51
	 * @param string $value the the event to be raised for createChildControls
52
	 */
53
	public function setBroadcastEvent($value)
54
	{
55
		$this->setControlState('BroadcastEvent', TPropertyValue::ensureString($value), '');
56
	}
57
}
58