Skip to content

Commit

Permalink
Compiler: parseServices() and parseService() renamed to ??? [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed May 23, 2016
1 parent fb70434 commit 617d88d
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::addDefinitions($this->builder, $this->config['services']);
}
}


Expand Down Expand Up @@ -245,12 +247,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 addDefinitions(ContainerBuilder $builder, array $services, $namespace = NULL)
{
$services = isset($config['services']) ? $config['services'] : [];
$depths = [];
foreach ($services as $name => $def) {
$path = [];
Expand Down Expand Up @@ -304,7 +305,7 @@ public static function parseServices(ContainerBuilder $builder, array $config, $
}

try {
static::parseService($definition, $def);
static::addDefinition($definition, $def);
} catch (\Exception $e) {
throw new ServiceCreationException("Service '$name': " . $e->getMessage(), 0, $e);
}
Expand All @@ -313,10 +314,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 addDefinition(ServiceDefinition $definition, $config)
{
if ($config === NULL) {
return;
Expand Down Expand Up @@ -433,12 +434,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::addDefinitions($builder, $config, $namespace);
}


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

}

0 comments on commit 617d88d

Please sign in to comment.