| 1 | <?php |
||
| 9 | class Id |
||
|
|
|||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var int |
||
| 13 | */ |
||
| 14 | private $id; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Id constructor. |
||
| 18 | * |
||
| 19 | * @param int $id |
||
| 20 | */ |
||
| 21 | 8 | private function __construct(int $id) |
|
| 25 | |||
| 26 | /** |
||
| 27 | * Creates Id from ordinary, 10 base number [0-9]. |
||
| 28 | * |
||
| 29 | * @param int $id |
||
| 30 | * |
||
| 31 | * @return Id |
||
| 32 | */ |
||
| 33 | 7 | public static function createFromBase10(int $id): Id |
|
| 37 | |||
| 38 | /** |
||
| 39 | * Creates Id from base 62 number [0-9a-zA-Z]. |
||
| 40 | * |
||
| 41 | * @param string $id |
||
| 42 | * |
||
| 43 | * @return Id |
||
| 44 | */ |
||
| 45 | 1 | public static function createFromBase62(string $id): Id |
|
| 49 | |||
| 50 | /** |
||
| 51 | * @return int |
||
| 52 | */ |
||
| 53 | 4 | public function getBase10Id(): int |
|
| 57 | |||
| 58 | /** |
||
| 59 | * @return string |
||
| 60 | */ |
||
| 61 | 2 | public function getBase62Id(): string |
|
| 65 | } |
||
| 66 |