BeforeActionEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 6
loc 6
rs 9.4285
1
<?php
2
3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ICanBoogie\Routing\Controller;
13
14
use ICanBoogie\Event;
15
use ICanBoogie\Routing\Controller;
16
17
/**
18
 * Event class for the `ICanBoogie\Routing\Controller::action:before` event.
19
 *
20
 * Event hooks may use this event to alter the controller before the action is invoked, or provide
21
 * a result and thus cancel the action.
22
 */
23 View Code Duplication
class BeforeActionEvent extends Event
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
{
25
	const TYPE = 'action:before';
26
27
	/**
28
	 * Reference to the result.
29
	 *
30
	 * @var mixed
31
	 */
32
	public $result;
33
34
	/**
35
	 * The event is constructed with the type {@link self::TYPE}.
36
	 *
37
	 * @param Controller $target
38
	 * @param string $result
39
	 */
40
	public function __construct(Controller $target, &$result)
41
	{
42
		$this->result = &$result;
43
44
		parent::__construct($target, self::TYPE);
45
	}
46
}
47