Skip to content
This repository was archived by the owner on Feb 6, 2020. It is now read-only.

Commit 458086b

Browse files
committed
Microoptimization
1 parent e932c8a commit 458086b

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/ServiceManager.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -241,16 +241,29 @@ public function has($name, $checkAbstractFactories = false)
241241
*/
242242
protected function configure(array $config)
243243
{
244-
$this->services = (isset($config['services']) ? $config['services'] : []) + $this->services;
245-
$this->factories = (isset($config['factories']) ? $config['factories'] : []) + $this->factories;
246-
$this->delegators = array_merge_recursive($this->delegators, isset($config['delegators'])
247-
? $config['delegators']
248-
: []);
249-
$this->shared = (isset($config['shared']) ? $config['shared'] : []) + $this->shared;
250-
$this->aliases = (isset($config['aliases']) ? $config['aliases'] : []) + $this->aliases;
251-
$this->sharedByDefault = isset($config['shared_by_default'])
252-
? $config['shared_by_default']
253-
: $this->sharedByDefault;
244+
if (isset($config['services'])) {
245+
$this->services = $config['services'] + $this->services;
246+
}
247+
248+
if (isset($config['factories'])) {
249+
$this->factories = $config['factories'] + $this->factories;
250+
}
251+
252+
if (isset($config['delegators'])) {
253+
$this->delegators = array_merge_recursive($this->delegators, $config['delegators']);
254+
}
255+
256+
if (isset($config['shared'])) {
257+
$this->shared = $config['shared'] + $this->shared;
258+
}
259+
260+
if (isset($config['aliases'])) {
261+
$this->aliases = $config['aliases'] + $this->aliases;
262+
}
263+
264+
if (isset($config['shared_by_default'])) {
265+
$this->sharedByDefault = $config['shared_by_default'];
266+
}
254267

255268
// If lazy service configuration was provided, reset the lazy services
256269
// delegator factory.

0 commit comments

Comments
 (0)