ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
TableNameBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 public function __construct(
26 private readonly string $component_name_space,
27 private readonly ?TableSubNameSpace $table_sub_name_space
28 ) {
29
30 }
31
32 public function getTableNameFor(
33 TableTypes $table,
34 string $specifier = ''
35 ): string {
36 if ($table->value === '' && $specifier === '') {
37 throw \InvalidArgumentException(
38 'Identifier cannot be empty if Type->value is empty.'
39 );
40 }
41
42 $base_name = "{$this->component_name_space}";
43 if ($table->value !== '') {
44 $base_name .= "_{$table->value}";
45 }
46
47 $additions = '';
48
49 if ($this->table_sub_name_space !== null) {
50 $additions = $this->table_sub_name_space->get();
51 }
52
53 if ($specifier !== '') {
54 $additions .= "_{$specifier}";
55 }
56
57 if ($additions === '') {
58 return $base_name;
59 }
60
61 return "{$base_name}_{$additions}";
62 }
63}
getTableNameFor(TableTypes $table, string $specifier='')
__construct(private readonly string $component_name_space, private readonly ?TableSubNameSpace $table_sub_name_space)
if(!file_exists('../ilias.ini.php'))