setDependencyInjector() public method

Sets the dependency injector
public setDependencyInjector ( ManaPHP\DiInterface $dependencyInjector ) : static
$dependencyInjector ManaPHP\DiInterface
return static
コード例 #1
0
ファイル: Redis.php プロジェクト: manaphp/manaphp
 /**
  * @param \ManaPHP\DiInterface $dependencyInjector
  *
  * @return static
  */
 public function setDependencyInjector($dependencyInjector)
 {
     parent::setDependencyInjector($dependencyInjector);
     if (isset($this->redisDi)) {
         $this->redis = $this->redisDi->getShared($this->_service, ['key' => $this->_key]);
     }
     return $this;
 }
コード例 #2
0
ファイル: Redis.php プロジェクト: manaphp/manaphp
 /**
  * @param \ManaPHP\DiInterface $dependencyInjector
  *
  * @return static
  */
 public function setDependencyInjector($dependencyInjector)
 {
     parent::setDependencyInjector($dependencyInjector);
     if (isset($this->redisDi)) {
         $this->redis = $this->redisDi->getShared('task', ['prefix' => $this->_prefix]);
     }
     return $this;
 }
コード例 #3
0
ファイル: Logger.php プロジェクト: manaphp/manaphp
 /**
  * @param \ManaPHP\DiInterface $dependencyInjector
  *
  * @return static
  */
 public function setDependencyInjector($dependencyInjector)
 {
     parent::setDependencyInjector($dependencyInjector);
     if (!is_object($this->adapter)) {
         $this->adapter = $this->_dependencyInjector->getShared($this->adapter);
     }
     return $this;
 }
コード例 #4
0
ファイル: Session.php プロジェクト: manaphp/manaphp
 /**
  * @param \ManaPHP\DiInterface $dependencyInjector
  *
  * @return static
  * @throws \ManaPHP\Http\Session\Exception
  */
 public function setDependencyInjector($dependencyInjector)
 {
     parent::setDependencyInjector($dependencyInjector);
     if (!is_object($this->adapter)) {
         $this->adapter = $this->_dependencyInjector->getShared($this->adapter);
     }
     $open = [$this->adapter, 'open'];
     $close = [$this->adapter, 'close'];
     $read = [$this->adapter, 'read'];
     $write = [$this->adapter, 'write'];
     $destroy = [$this->adapter, 'destroy'];
     $gc = [$this->adapter, 'gc'];
     session_set_save_handler($open, $close, $read, $write, $destroy, $gc);
     if (!session_start()) {
         throw new SessionException('session start failed: :last_error_message');
     }
     return $this;
 }