BeforeActionEvent   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 1
c 3
b 0
f 0
lcom 0
cbo 1
dl 24
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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