Skip to content

Commit

Permalink
Compiler: parseServices() and parseService() renamed to loadDefinitio…
Browse files Browse the repository at this point in the history
…n() and loadDefinitions() (#112)
  • Loading branch information
dg authored Jun 17, 2016
1 parent aa65657 commit 34f8df4
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions src/DI/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ public function processExtensions()
/** @internal */
public function processServices()
{
$this->parseServices($this->builder, $this->config);
if (isset($this->config['services'])) {
self::loadDefinitions($this->builder, $this->config['services']);
}
}


Expand Down Expand Up @@ -246,12 +248,11 @@ public function generateCode()


/**
* Parses section 'services' from (unexpanded) configuration file.
* Adds service definitions from configuration.
* @return void
*/
public static function parseServices(ContainerBuilder $builder, array $config, $namespace = NULL)
public static function loadDefinitions(ContainerBuilder $builder, array $services, $namespace = NULL)
{
$services = isset($config['services']) ? $config['services'] : [];
$depths = [];
foreach ($services as $name => $def) {
$path = [];
Expand Down Expand Up @@ -305,7 +306,7 @@ public static function parseServices(ContainerBuilder $builder, array $config, $
}

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


/**
* Parses single service from configuration file.
* Parses single service definition from configuration.
* @return void
*/
public static function parseService(ServiceDefinition $definition, $config)
public static function loadDefinition(ServiceDefinition $definition, $config)
{
if ($config === NULL) {
return;
Expand Down Expand Up @@ -435,12 +436,24 @@ public static function parseService(ServiceDefinition $definition, $config)
}


/**
* Use Helpers::filterArguments()
*/
/** @deprecated */
public static function filterArguments(array $args)
{
return Helpers::filterArguments($args);
}


/** @deprecated */
public static function parseServices(ContainerBuilder $builder, array $config, $namespace = NULL)
{
self::loadDefinitions($builder, isset($config['services']) ? $config['services'] : [], $namespace);
}


/** @deprecated */
public static function parseService(ServiceDefinition $definition, $config)
{
self::loadDefinition($definition, $config);
}

}

0 comments on commit 34f8df4

Please sign in to comment.