19declare(strict_types=1);
39 $this->provider_class = $provider::class;
44 '/^[a-z][a-z0-9_]*$/',
45 'Subject provider name'
47 $this->
assertIdentifier($id, self::MAX_LENGTH,
'/^[a-z0-9_]+$/',
'Subject id');
55 public function id(): string
72 throw new \InvalidArgumentException($what .
' must not be empty.');
75 $length = \mb_strlen($value,
'UTF-8');
76 if ($length > $max_length) {
77 throw new \InvalidArgumentException(
78 $what .
' must not exceed ' . $max_length .
' characters, got ' . $length .
'.'
82 if (!\preg_match(
$pattern, $value)) {
83 throw new \InvalidArgumentException(
84 $what .
' must be a lowercase identifier, got "' . $value .
'".'
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Identifies a subject within the provider that names it.
__construct(SubjectProvider $provider, private string $id)
assertIdentifier(string $value, int $max_length, string $pattern, string $what)
A component that names subjects, contributed via $contribute[\ILIAS\KeyValueStorage\Subject\SubjectPr...
const int MAX_NAME_LENGTH
name()
Unique among all providers, a lowercase identifier, e.g.