4use InvalidArgumentException;
6use Wikimedia\Assert\Assert;
98 $this->destroyed =
true;
107 foreach ( $wiringFiles as $file ) {
109 $wiring = require $file;
111 Assert::postcondition(
113 "Wiring file $file is expected to return an array!"
145 $newInstantiators = array_diff_key(
146 $container->serviceInstantiators,
150 $this->serviceInstantiators = array_merge(
151 $this->serviceInstantiators,
165 return isset( $this->serviceInstantiators[$name] );
188 return isset( $this->services[$name] ) ? $this->services[
$name] :
null;
195 return array_keys( $this->serviceInstantiators );
213 Assert::parameterType(
'string', $name,
'$name' );
219 $this->serviceInstantiators[
$name] = $instantiator;
239 Assert::parameterType(
'string', $name,
'$name' );
245 if ( isset( $this->services[$name] ) ) {
249 $this->serviceInstantiators[
$name] = $instantiator;
250 unset( $this->disabled[$name] );
275 $this->disabled[
$name] =
true;
302 Assert::parameterType(
'string', $name,
'$name' );
307 $instance->destroy();
310 unset( $this->services[$name] );
311 unset( $this->disabled[$name] );
335 if ( $this->destroyed ) {
339 if ( isset( $this->disabled[$name] ) ) {
343 if ( !isset( $this->services[$name] ) ) {
347 return $this->services[
$name];
357 if ( isset( $this->serviceInstantiators[$name] ) ) {
358 $service = call_user_func_array(
359 $this->serviceInstantiators[$name],
360 array_merge( [ $this ], $this->extraInstantiationParams )
376 return isset( $this->disabled[$name] );
Allows to change the fields on the form that will be generated $name