"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/lib/Drupal/Core/DependencyInjection/Container.php" (26 Nov 2020, 777 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Container.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 namespace Drupal\Core\DependencyInjection;
    4 
    5 use Drupal\Component\DependencyInjection\Container as DrupalContainer;
    6 
    7 /**
    8  * Extends the Drupal container to set the service ID on the created object.
    9  */
   10 class Container extends DrupalContainer {
   11 
   12   /**
   13    * {@inheritdoc}
   14    */
   15   public function set($id, $service) {
   16     parent::set($id, $service);
   17 
   18     // Ensure that the _serviceId property is set on synthetic services as well.
   19     if (isset($this->services[$id]) && is_object($this->services[$id]) && !isset($this->services[$id]->_serviceId)) {
   20       $this->services[$id]->_serviceId = $id;
   21     }
   22   }
   23 
   24   /**
   25    * {@inheritdoc}
   26    */
   27   public function __sleep() {
   28     assert(FALSE, 'The container was serialized.');
   29     return array_keys(get_object_vars($this));
   30   }
   31 
   32 }