‪TYPO3CMS  ‪main
RequestId.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 namespace ‪TYPO3\CMS\Core\Core;
19 
21 
25 final class ‪RequestId
26 {
27  public readonly string ‪$long;
28  public readonly string ‪$short;
29  public readonly int ‪$microtime;
30  public readonly ‪ConsumableNonce ‪$nonce;
31 
32  public function ‪__construct()
33  {
34  $this->long = bin2hex(random_bytes(20));
35  $this->short = substr($this->long, 0, 13);
36  $this->microtime = (int)(microtime(true) * 1000000);
37  $this->nonce = new ‪ConsumableNonce();
38  }
39 
40  public function ‪__toString(): string
41  {
42  return ‪$this->short;
43  }
44 }
‪TYPO3\CMS\Core\Core\RequestId\__toString
‪__toString()
Definition: RequestId.php:40
‪TYPO3\CMS\Core\Security\ContentSecurityPolicy\ConsumableNonce
Definition: ConsumableNonce.php:24
‪TYPO3\CMS\Core\Core\RequestId\$nonce
‪readonly ConsumableNonce $nonce
Definition: RequestId.php:30
‪TYPO3\CMS\Core\Core\RequestId\$short
‪readonly string $short
Definition: RequestId.php:28
‪TYPO3\CMS\Core\Core\RequestId
Definition: RequestId.php:26
‪TYPO3\CMS\Core\Core\RequestId\$microtime
‪readonly int $microtime
Definition: RequestId.php:29
‪TYPO3\CMS\Core\Core
Definition: ApplicationContext.php:16
‪TYPO3\CMS\Core\Core\RequestId\$long
‪readonly string $long
Definition: RequestId.php:27
‪TYPO3\CMS\Core\Core\RequestId\__construct
‪__construct()
Definition: RequestId.php:32