Skip to content

Commit 8746036

Browse files
committed
Allow to merge with other configs
1 parent e8ce49d commit 8746036

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

src/Component.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,21 @@ public function id(): string
6060
*
6161
* @return $this
6262
*/
63-
public function logger(LoggerInterface $logger): self
63+
public function setLogger(LoggerInterface $logger): self
6464
{
6565
$this->logger = $logger;
6666

6767
return $this;
6868
}
6969

70+
/**
71+
* @return LoggerInterface|NullLogger
72+
*/
73+
public function getLogger()
74+
{
75+
return $this->logger;
76+
}
77+
7078
/**
7179
* @return void
7280
*/

src/ElasticTool.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,40 @@ public function __construct($config = [], LoggerInterface $logger = null)
3838
$this->logger->debug(\vsprintf('Instance of "%s" has been created', [self::class]));
3939
}
4040

41+
/**
42+
* @return array
43+
*/
44+
public function getConfig(): array
45+
{
46+
return $this->config;
47+
}
48+
49+
/**
50+
* @param array $config
51+
*
52+
* @return $this
53+
*/
54+
public function setConfig(array $config): self
55+
{
56+
$this->config = $config;
57+
$this->container = null;
58+
59+
return $this;
60+
}
61+
62+
/**
63+
* @param array $config
64+
*
65+
* @return $this
66+
*/
67+
public function mergeWithConfig(array $config): self
68+
{
69+
$this->config = Config::make($this->config)->merge($config)->all();
70+
$this->container = null;
71+
72+
return $this;
73+
}
74+
4175
/**
4276
* @return Container
4377
*/

0 commit comments

Comments
 (0)