AlterEvent::get_instance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 4
loc 4
rs 10
c 0
b 0
f 0
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\Render\TemplateResolver;
13
14
use ICanBoogie\Event;
15
use ICanBoogie\Render\TemplateResolver;
16
17
/**
18
 * Event class for the `ICanBoogie\Render\BasicTemplateResolver::alter` event.
19
 *
20
 * Event hooks may use this event to alter the engine collection, or replace it.
21
 *
22
 * @property TemplateResolver $instance
23
 */
24 View Code Duplication
class AlterEvent 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...
25
{
26
	/**
27
	 * Reference to the target instance.
28
	 *
29
	 * @var TemplateResolver
30
	 */
31
	private $instance;
32
33
	/**
34
	 * @return TemplateResolver
35
	 */
36
	protected function get_instance()
37
	{
38
		return $this->instance;
39
	}
40
41
	/**
42
	 * @param TemplateResolver $template_resolver
43
	 */
44
	protected function set_instance(TemplateResolver $template_resolver)
45
	{
46
		$this->instance = $template_resolver;
47
	}
48
49
	/**
50
	 * Initializes the {@link $instance} property.
51
	 *
52
	 * @param TemplateResolver $target
53
	 */
54
	public function __construct(TemplateResolver &$target)
55
	{
56
		$this->instance = &$target;
57
58
		parent::__construct($target, 'alter');
59
	}
60
}
61