Example #1
0
 public function testRemove()
 {
     $this->assertEquals('world', $this->bag->get('hello'));
     $this->bag->remove('hello');
     $this->assertNull($this->bag->get('hello'));
     $this->assertEquals('be happy', $this->bag->get('always'));
     $this->bag->remove('always');
     $this->assertNull($this->bag->get('always'));
     $this->assertEquals('drak', $this->bag->get('user.login'));
     $this->bag->remove('user.login');
     $this->assertNull($this->bag->get('user.login'));
 }
Example #2
0
 public function getEncrypted($key)
 {
     $encryptedData = $this->bag->get($key);
     return $this->encryptor->decrypt($encryptedData);
 }
 /**
  * @param AttributeBag $params
  * @throws UserException
  */
 protected function checkParams(AttributeBag $params)
 {
     foreach (['token', 'id'] as $name) {
         if (!$params->has($name) || empty($params->get($name))) {
             throw new UserException("Missing parameter '{$name}'");
         }
     }
 }