forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClientId.php
44 lines (35 loc) · 894 Bytes
/
ClientId.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
declare(strict_types=1);
/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
namespace ILIAS\Data;
/**
* Class ClientId
* @package ILIAS\Data
* @author Michael Jansen <[email protected]>
*/
class ClientId
{
private string $clientId;
/**
* ClientId constructor.
* @param string $clientId
*/
public function __construct(string $clientId)
{
if ($clientId === '') {
throw new \InvalidArgumentException('Empty $clientId');
}
if (preg_match('/[^A-Za-z0-9#_\.\-]/', $clientId)) {
throw new \InvalidArgumentException('Invalid value for $clientId');
}
$this->clientId = $clientId;
}
public function toString(): string
{
return $this->clientId;
}
public function __toString(): string
{
return $this->toString();
}
}