Differences Between: [Versions 310 and 402] [Versions 310 and 403]
1 <?php 2 3 namespace IMSGlobal\LTI\ToolProvider; 4 5 /** 6 * Class to represent a tool consumer nonce 7 * 8 * @author Stephen P Vickers <svickers@imsglobal.org> 9 * @copyright IMS Global Learning Consortium Inc 10 * @date 2016 11 * @version 3.0.2 12 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0 13 */ 14 class ConsumerNonce 15 { 16 17 /** 18 * Maximum age nonce values will be retained for (in minutes). 19 */ 20 const MAX_NONCE_AGE = 30; // in minutes 21 22 /** 23 * Date/time when the nonce value expires. 24 * 25 * @var int $expires 26 */ 27 public $expires = null; 28 29 /** 30 * Tool Consumer to which this nonce applies. 31 * 32 * @var ToolConsumer $consumer 33 */ 34 private $consumer = null; 35 /** 36 * Nonce value. 37 * 38 * @var string $value 39 */ 40 private $value = null; 41 42 /** 43 * Class constructor. 44 * 45 * @param ToolConsumer $consumer Consumer object 46 * @param string $value Nonce value (optional, default is null) 47 */ 48 public function __construct($consumer, $value = null) 49 { 50 51 $this->consumer = $consumer; 52 $this->value = $value; 53 $this->expires = time() + (self::MAX_NONCE_AGE * 60); 54 55 } 56 57 /** 58 * Load a nonce value from the database. 59 * 60 * @return boolean True if the nonce value was successfully loaded 61 */ 62 public function load() 63 { 64 65 return $this->consumer->getDataConnector()->loadConsumerNonce($this); 66 67 } 68 69 /** 70 * Save a nonce value in the database. 71 * 72 * @return boolean True if the nonce value was successfully saved 73 */ 74 public function save() 75 { 76 77 return $this->consumer->getDataConnector()->saveConsumerNonce($this); 78 79 } 80 81 /** 82 * Get tool consumer. 83 * 84 * @return ToolConsumer Consumer for this nonce 85 */ 86 public function getConsumer() 87 { 88 89 return $this->consumer; 90 91 } 92 93 /** 94 * Get outcome value. 95 * 96 * @return string Outcome value 97 */ 98 public function getValue() 99 { 100 101 return $this->value; 102 103 } 104 105 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body