ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
Name.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
23class Name
24{
25 private const PROPER_NAME_REGEXP = "/\w+([\\\\]\w+){2,}/";
26
27 public function __construct(
28 protected string $name
29 ) {
30 if (!preg_match(self::PROPER_NAME_REGEXP, $this->name)) {
31 throw new \InvalidArgumentException(
32 "{$this->name} is not a proper name for a dependency."
33 );
34 }
35 }
36
37 public function __toString(): string
38 {
39 return $this->name;
40 }
41}
__construct(protected string $name)
Definition: Name.php:27