LTI Integration Library 4.10.3
PHP class library for building LTI integrations
 
Loading...
Searching...
No Matches
PlatformNonce.php
1<?php
2
3namespace ceLTIc\LTI;
4
13{
14
18 const MAX_NONCE_AGE = 30; // in minutes
19
27 public static $maximumLength = 50;
28
34 public $expires = null;
35
41 private $platform = null;
42
48 private $value = null;
49
56 public function __construct($platform, $value = null)
57 {
58 $this->platform = $platform;
59 $this->value = substr($value, -self::$maximumLength);
60 $this->expires = time() + (self::MAX_NONCE_AGE * 60);
61 }
62
68 public function load()
69 {
70 return $this->platform->getDataConnector()->loadPlatformNonce($this);
71 }
72
78 public function save()
79 {
80 return $this->platform->getDataConnector()->savePlatformNonce($this);
81 }
82
88 public function delete()
89 {
90 return $this->platform->getDataConnector()->deletePlatformNonce($this);
91 }
92
98 public function getPlatform()
99 {
100 return $this->platform;
101 }
102
108 public function getValue()
109 {
110 return $this->value;
111 }
112
113}
Class to represent a platform nonce.
static $maximumLength
Maximum length which can be stored.
__construct($platform, $value=null)
Class constructor.
$expires
Timestamp for when the nonce value expires.
load()
Load a nonce value from the database.
const MAX_NONCE_AGE
Maximum age nonce values will be retained for (in minutes).
getValue()
Get nonce value.
save()
Save a nonce value in the database.