Completed
Push — master ( fa66ff...b613b3 )
by Peter
10:20
created

ParentChildTrashHandler::setupHandlers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: peter
5
 * Date: 08.02.18
6
 * Time: 10:28
7
 */
8
9
namespace Maslosoft\Mangan\Events\Handlers;
10
11
12
use Maslosoft\Addendum\Utilities\ClassChecker;
13
use Maslosoft\Mangan\Helpers\ParentChildTrashHandlers;
14
use Maslosoft\Mangan\Interfaces\EventHandlersInterface;
15
16
class ParentChildTrashHandler implements EventHandlersInterface
17
{
18
	public $parentClass = '';
19
20
	public $childClass = '';
21
22
	/**
23
	 * This method will be called only once, and should setup event handlers.
24
	 */
25
	public function setupHandlers()
26
	{
27
		assert(!empty($this->parentClass));
28
		assert(!empty($this->childClass));
29
		assert(ClassChecker::exists($this->parentClass));
30
		assert(ClassChecker::exists($this->childClass));
31
		$handler = new ParentChildTrashHandlers;
32
		$handler->registerParent($this->parentClass, $this->childClass);
33
		$handler->registerChild($this->childClass, $this->parentClass);
34
	}
35
}