public static function PersistentToken::createFromArray in Persistent Login 8
Initialize a new object from an array of values.
Parameters
$values: An array of values to set object properties.
1 call to PersistentToken::createFromArray()
- TokenManager::getTokensForUser in src/
TokenManager.php - Get all active tokens for a user.
File
- src/
PersistentToken.php, line 101
Class
- PersistentToken
- Class PersistentToken.
Namespace
Drupal\persistent_loginCode
public static function createFromArray(array $values) {
if (empty($values['series'])) {
throw new \Exception("Required property 'series' not set.");
}
if (empty($values['instance'])) {
throw new \Exception("Required property 'instance' not set.");
}
$token = new static($values['series'], $values['instance'], $values['uid']);
$token = $token
->setCreated(new \DateTime('@' . $values['created']))
->setRefreshed(new \DateTime('@' . $values['refreshed']))
->setExpiry(new \DateTime('@' . $values['expires']));
return $token;
}