예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function addClient($identifier, $user)
 {
     $serializedUser = serialize($user);
     $context = ['user' => $serializedUser];
     if ($user instanceof UserInterface) {
         $context['username'] = $user->getUsername();
     }
     $this->logger->debug(sprintf('INSERT CLIENT ' . $identifier), $context);
     if (false === ($result = $this->driver->save($identifier, $serializedUser, 60 * 15))) {
         throw new StorageException('Unable add client');
     }
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function addClient($identifier, $user)
 {
     $serializedUser = serialize($user);
     $context = ['user' => $serializedUser];
     if ($user instanceof UserInterface) {
         $context['username'] = $user->getUsername();
     }
     $this->logger->debug(sprintf('INSERT CLIENT ' . $identifier), $context);
     try {
         $result = $this->driver->save($identifier, $serializedUser, $this->ttl);
     } catch (\Exception $e) {
         throw new StorageException(sprintf('Driver %s failed', get_class($this)), $e->getCode(), $e);
     }
     if (false === $result) {
         throw new StorageException('Unable add client');
     }
 }