Example #1
0
 /**
  * Session handler class constructor.
  *
  * @param App $app
  * @param array $config
  */
 protected function __construct(App $app, array $config = [])
 {
     $this->app = $app;
     $this->config = array_merge($this->config, $config);
     // get the crypt instance if 'encrypt' set as true
     if ($this->getConfig('encrypt')) {
         $this->crypt = $this->app->crypt();
     }
 }
Example #2
0
 /**
  * Cookie class constructor.
  *
  * @param App $app
  * @param array $config
  */
 public function __construct(App $app, array $config = [])
 {
     $this->app = $app;
     $this->config = array_merge($this->config, $config);
     $this->secret = $this->app->getSecret();
     // get the crypt instance if 'encrypt' set as true
     if ($this->getConfig('encrypt')) {
         $this->crypt = $this->app->crypt();
     }
     // check if secret key is empty
     if (empty(trim($this->secret))) {
         throw new \InvalidArgumentException('Secret must not be empty!');
     }
 }
Example #3
0
 public function testSingletonCryptClassInstanceViaStaticMethod()
 {
     $this->assertEquals($this->app->crypt(), App::crypt());
 }