ILIAS  release_7 Revision v7.30-3-g800a261c036
ClientId.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4namespace ILIAS\Data;
5
12{
16 private $clientId = '';
17
22 public function __construct(string $clientId)
23 {
24 if ($clientId === '') {
25 throw new \InvalidArgumentException('Empty $clientId');
26 }
27
28 if (preg_match('/[^A-Za-z0-9#_\.\-]/', $clientId)) {
29 throw new \InvalidArgumentException('Invalid value for $clientId');
30 }
31
32 $this->clientId = $clientId;
33 }
34
38 public function toString() : string
39 {
40 return $this->clientId;
41 }
42
46 public function __toString() : string
47 {
48 return $this->toString();
49 }
50}
An exception for terminatinating execution or to throw for unit testing.
__construct(string $clientId)
ClientId constructor.
Definition: ClientId.php:22