instantiation = $instantiation; } /** * Do the actual service instantiation and return the real service. * * @throws InvalidService If the service could not be properly instantiated. * * @return Service Properly instantiated service. */ public function instantiate() { $instantiation = $this->instantiation; // Because uniform variable syntax not supported in PHP 5.6. $service = $instantiation(); if ( ! $service instanceof Service ) { throw InvalidService::from_service( $service ); } return $service; } }