class Container in Service Container 7
Same name in this branch
- 7 src/DependencyInjection/Container.php \Drupal\service_container\DependencyInjection\Container
- 7 lib/Drupal/Core/DependencyInjection/Container.php \Drupal\Core\DependencyInjection\Container
- 7 lib/Drupal/Component/DependencyInjection/Container.php \Drupal\Component\DependencyInjection\Container
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Container.php \Symfony\Component\DependencyInjection\Container
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php \Symfony\Component\DependencyInjection\Container
Same name and namespace in other branches
- 7.2 src/DependencyInjection/Container.php \Drupal\service_container\DependencyInjection\Container
Container is a DI container that provides services to users of the class.
Hierarchy
- class \Drupal\Component\DependencyInjection\Container implements \Symfony\Component\DependencyInjection\IntrospectableContainerInterface
- class \Drupal\Component\DependencyInjection\PhpArrayContainer
- class \Drupal\service_container\DependencyInjection\Container implements ContainerInterface
- class \Drupal\Component\DependencyInjection\PhpArrayContainer
Expanded class hierarchy of Container
4 files declare their use of Container
- ContainerAwarePluginManagerTest.php in tests/
src/ Plugin/ ContainerAwarePluginManagerTest.php - Contains \Drupal\Tests\service_container\Plugin\ContainerAwarePluginManagerTest
- ContainerTest.php in tests/
src/ DependencyInjection/ ContainerTest.php - Contains \Drupal\Tests\service_container\DependencyInjection\ContainerTest
- ServiceContainerCToolsIntegrationTest.php in lib/
Drupal/ service_container/ Tests/ ServiceContainerCToolsIntegrationTest.php - Contains \Drupal\service_container\Tests\ServiceContainerCToolsIntegrationTest.
- ServiceContainerServiceProvider.php in src/
ServiceContainer/ ServiceProvider/ ServiceContainerServiceProvider.php - Contains \Drupal\service_container\ServiceContainer\ServiceProvider\ServiceContainerServiceProvider
2 string references to 'Container'
- PhpDumper::dump in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Dumper/ PhpDumper.php - Dumps the service container as a PHP class.
- PhpDumperTest::testDump in modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Dumper/ PhpDumperTest.php
File
- src/
DependencyInjection/ Container.php, line 19 - Contains \Drupal\service_container\DependencyInjection\Container
Namespace
Drupal\service_container\DependencyInjectionView source
class Container extends PhpArrayContainer implements ContainerInterface {
/**
* {@inheritdoc}
*/
public function createInstance($plugin_id, $service_definition) {
$temporary_name = 'plugin_' . $plugin_id;
$this->serviceDefinitions[$temporary_name] = $service_definition;
$plugin = $this
->get($temporary_name);
unset($this->serviceDefinitions[$temporary_name]);
unset($this->services[$temporary_name]);
return $plugin;
}
/**
* {@inheritdoc}
*/
public function getDefinition($plugin_id, $exception_on_invalid = TRUE) {
$definition = isset($this->serviceDefinitions[$plugin_id]) ? $this->serviceDefinitions[$plugin_id] : NULL;
if (!$definition && $exception_on_invalid) {
throw new RuntimeException(sprintf('The "%s" service definition does not exist.', $plugin_id));
}
return $definition;
}
/**
* {@inheritdoc}
*/
public function getDefinitions() {
return $this->serviceDefinitions;
}
/**
* {@inheritdoc}
*/
public function hasDefinition($plugin_id) {
return isset($this->serviceDefinitions[$plugin_id]);
}
/**
* Camelizes a string.
*
* @param $name
* The string to camelize.
*
* @return string
* The camelized string.
*
*/
public static function camelize($name) {
return strtr(ucwords(strtr($name, array(
'_' => ' ',
'\\' => '_ ',
))), array(
' ' => '',
));
}
/**
* Un-camelizes a string.
*
* @param $name
* The string to underscore.
*
* @return string
* The underscored string.
*
*/
public static function underscore($name) {
return strtolower(preg_replace(array(
'/([A-Z]+)([A-Z][a-z])/',
'/([a-z\\d])([A-Z])/',
), array(
'\\1_\\2',
'\\1_\\2',
), $name));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Container:: |
protected | property | The aliases of the container. | |
Container:: |
protected | property | Whether the container parameters can still be changed. | |
Container:: |
protected | property | The currently loading services. | |
Container:: |
protected | property | The parameters of the container. | |
Container:: |
protected | property | The instantiated private services. | |
Container:: |
protected | property | The service definitions of the container. | |
Container:: |
protected | property | The instantiated services. | |
Container:: |
public | function | ||
Container:: |
public static | function | Camelizes a string. | |
Container:: |
public | function | ||
Container:: |
public | function | ||
Container:: |
public | function | ||
Container:: |
protected | function | Provides alternatives for a given array and key. | |
Container:: |
public | function |
Gets a specific plugin definition. Overrides DiscoveryInterface:: |
|
Container:: |
public | function |
Gets the definition of all plugins for this type. Overrides DiscoveryInterface:: |
|
Container:: |
public | function | ||
Container:: |
protected | function | Provides alternatives in case a parameter was not found. | |
Container:: |
protected | function | Provides alternatives in case a service was not found. | |
Container:: |
public | function | Gets all defined service IDs. | |
Container:: |
public | function | ||
Container:: |
public | function |
Indicates if a specific plugin definition exists. Overrides DiscoveryInterface:: |
|
Container:: |
public | function | ||
Container:: |
public | function | ||
Container:: |
public | function | ||
Container:: |
public | function | ||
Container:: |
public | function | ||
Container:: |
public | function | ||
Container:: |
public | function | ||
Container:: |
public static | function | Un-camelizes a string. | |
PhpArrayContainer:: |
protected | function |
Creates a service from a service definition. Overrides Container:: |
|
PhpArrayContainer:: |
protected | function |
Resolves arguments that represent services or variables to the real values. Overrides Container:: |
|
PhpArrayContainer:: |
public | function |
Constructs a new Container instance. Overrides Container:: |