Completed
Push — master ( 44f7c9...971f99 )
by Peter
25:14
created

ConfigInit::getConnectionId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * To change this license header, choose License Headers in Project Properties.
5
 * To change this template file, choose Tools | Templates
6
 * and open the template in the editor.
7
 */
8
9
namespace Maslosoft\Mangan\Signals;
10
11
use Maslosoft\Mangan\Mangan;
12
use Maslosoft\Signals\Interfaces\SignalInterface;
13
14
/**
15
 * ConfigInit
16
 *
17
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
18
 */
19
class ConfigInit implements SignalInterface
20
{
21
22
	private $config = [];
23
	private $connectionId = '';
24
25
	public function __construct(&$config, $connectionId = Mangan::DefaultConnectionId)
26
	{
27
		$this->config = &$config;
28
		$this->connectionId = $connectionId;
29
	}
30
31
	/**
32
	 * Get connection id for which current signal is emitted
33
	 * @return string
34
	 */
35
	public function getConnectionId()
36
	{
37
		return $this->connectionId;
38
	}
39
40
	/**
41
	 * Merge supplied configuration with Mangan configuration.
42
	 * @param array $configuration
43
	 * @return
44
	 */
45
	public function apply($configuration)
46
	{
47
		$this->config = array_replace_recursive($this->config, $configuration);
48
		return $this;
49
	}
50
51
}
52