Example #1
0
 /**
  * Return the app's secret as configured.
  *
  * @return mixed
  */
 public function getAppSecret()
 {
     $secret = $this->app->getSecret();
     if (empty(trim($secret))) {
         throw new \InvalidArgumentException('Secret must not be empty!');
     }
     return $secret;
 }
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!');
     }
 }