Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
token.php
1<?php
2
4
10final class Token
11{
13 private $token;
14
16 private $expiry;
17
23 public function __construct(string $token, int $expiry)
24 {
25 $this->token = $token;
26 $this->expiry = $expiry;
27 }
28
32 public function getToken(): string
33 {
34 return $this->token;
35 }
36
40 public function getExpiry(): int
41 {
42 return $this->expiry;
43 }
44
48 public function convertToArray(): array
49 {
50 return [
51 'token' => $this->token,
52 'expire' => $this->expiry,
53 ];
54 }
55
60 public static function makeFromArray(array $token): ?Token
61 {
62 if(empty($token['token']) || empty($token['expire']))
63 {
64 return null;
65 }
66
67 return new Token(
68 $token['token'],
69 $token['expire']
70 );
71 }
72}
static makeFromArray(array $token)
Definition token.php:60
__construct(string $token, int $expiry)
Definition token.php:23