Skip to content

Commit 34f8df4

Browse files
authored
Compiler: parseServices() and parseService() renamed to loadDefinition() and loadDefinitions() (#112)
1 parent aa65657 commit 34f8df4

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/DI/Compiler.php

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ public function processExtensions()
211211
/** @internal */
212212
public function processServices()
213213
{
214-
$this->parseServices($this->builder, $this->config);
214+
if (isset($this->config['services'])) {
215+
self::loadDefinitions($this->builder, $this->config['services']);
216+
}
215217
}
216218

217219

@@ -246,12 +248,11 @@ public function generateCode()
246248

247249

248250
/**
249-
* Parses section 'services' from (unexpanded) configuration file.
251+
* Adds service definitions from configuration.
250252
* @return void
251253
*/
252-
public static function parseServices(ContainerBuilder $builder, array $config, $namespace = NULL)
254+
public static function loadDefinitions(ContainerBuilder $builder, array $services, $namespace = NULL)
253255
{
254-
$services = isset($config['services']) ? $config['services'] : [];
255256
$depths = [];
256257
foreach ($services as $name => $def) {
257258
$path = [];
@@ -305,7 +306,7 @@ public static function parseServices(ContainerBuilder $builder, array $config, $
305306
}
306307

307308
try {
308-
static::parseService($definition, $def);
309+
static::loadDefinition($definition, $def);
309310
} catch (\Exception $e) {
310311
throw new ServiceCreationException("Service '$name': " . $e->getMessage(), 0, $e);
311312
}
@@ -314,10 +315,10 @@ public static function parseServices(ContainerBuilder $builder, array $config, $
314315

315316

316317
/**
317-
* Parses single service from configuration file.
318+
* Parses single service definition from configuration.
318319
* @return void
319320
*/
320-
public static function parseService(ServiceDefinition $definition, $config)
321+
public static function loadDefinition(ServiceDefinition $definition, $config)
321322
{
322323
if ($config === NULL) {
323324
return;
@@ -435,12 +436,24 @@ public static function parseService(ServiceDefinition $definition, $config)
435436
}
436437

437438

438-
/**
439-
* Use Helpers::filterArguments()
440-
*/
439+
/** @deprecated */
441440
public static function filterArguments(array $args)
442441
{
443442
return Helpers::filterArguments($args);
444443
}
445444

445+
446+
/** @deprecated */
447+
public static function parseServices(ContainerBuilder $builder, array $config, $namespace = NULL)
448+
{
449+
self::loadDefinitions($builder, isset($config['services']) ? $config['services'] : [], $namespace);
450+
}
451+
452+
453+
/** @deprecated */
454+
public static function parseService(ServiceDefinition $definition, $config)
455+
{
456+
self::loadDefinition($definition, $config);
457+
}
458+
446459
}

0 commit comments

Comments
 (0)