Exemplo n.º 1
0
 public function init()
 {
     if (!$this->isInitialized) {
         $this->reload();
     }
     if (!$this->di->isStored($this)) {
         $this->di->store($this);
     }
 }
Exemplo n.º 2
0
 public function init()
 {
     $this->_di->store($this);
 }
Exemplo n.º 3
0
 /**
  * Add annotations namespace.
  * Every added namespace will be included in annotation name resolving for current instance.
  *
  * @param string $ns
  * @renturn Addendum
  */
 public function addNamespace($ns)
 {
     NameNormalizer::normalize($ns, false);
     if (!in_array($ns, $this->namespaces)) {
         $before = count($this->namespaces);
         $this->namespaces[] = $ns;
         $this->namespaces = array_unique($this->namespaces);
         $after = count($this->namespaces);
         if ($after !== $before) {
             $this->nameKeys = array_flip($this->namespaces);
             Cache\NsCache::$addeNs = true;
         }
         $this->di->store($this, [], true);
         // Reconfigure flyweight instances if present
         if (!empty(self::$addendums[$this->instanceId])) {
             self::$addendums[$this->instanceId]->di->configure(self::$addendums[$this->instanceId]);
         }
     }
     return $this;
 }