19declare(strict_types=1);
39 protected string $id =
"";
64 $this->ilias_root = dirname(__FILE__, self::DEPTH_FROM_REPOSITORY_ROOT);
65 $this->
assert()->isIndex(
'id', $entry_data);
66 $this->
setId($entry_data[
'id']);
67 $this->
assert()->isIndex(
'title', $entry_data);
68 $this->
setTitle($entry_data[
'title']);
69 $this->
assert()->isIndex(
'namespace', $entry_data);
74 if (array_key_exists(
'description', $entry_data)) {
77 if (array_key_exists(
'rules', $entry_data) && is_array($entry_data[
'rules'])) {
81 $this->
assert()->isIndex(
'path', $entry_data);
82 $this->
setPath($entry_data[
'path']);
84 if (array_key_exists(
'background', $entry_data)) {
87 if (array_key_exists(
'context', $entry_data)) {
90 if (array_key_exists(
'featurewiki', $entry_data)) {
93 if (array_key_exists(
'parent', $entry_data)) {
94 $this->
setParent((
string) $entry_data[
'parent']);
96 if (array_key_exists(
'children', $entry_data)) {
99 if (array_key_exists(
'examples_path', $entry_data)) {
100 $this->examples_path = $entry_data[
'examples_path'];
102 if (array_key_exists(
'examples_namespace', $entry_data)) {
103 $this->examples_namespace = $entry_data[
'examples_namespace'];
105 if (array_key_exists(
'examples', $entry_data)) {
106 $this->examples = $entry_data[
'examples'];
119 $this->
assert()->isString($id,
false);
130 $this->
assert()->isString($title,
false);
151 $this->
assert()->isString($status_entry);
162 $this->
assert()->isString($status_implementation);
174 return $this->description->getDescription();
182 $this->
assert()->isTypeOf($description, ComponentEntryDescription::class);
193 $this->
assert()->isString($background);
204 $this->
assert()->isArray($context);
215 $this->
assert()->isArray($feature_wiki_references);
227 return $this->rules->getRules();
235 $this->
assert()->isTypeOf($rules, ComponentEntryRules::class);
246 $this->
assert()->isString($selector);
252 $this->
assert()->isArray($less_variables);
268 $this->
assert()->isString($path);
300 $this->children[] = $child;
318 $this->examples = array();
320 if (is_dir($case_insensitive_path)) {
321 foreach (scandir($case_insensitive_path) as $file_name) {
323 if (is_file($example_path) && pathinfo($example_path)[
"extension"] ==
"php") {
324 $example_name = str_replace(
".php",
"", $file_name);
338 $parent_folder = $this->ilias_root .
'/' . dirname($this->
getExamplesPath());
340 if (is_dir($parent_folder)) {
341 foreach (scandir($parent_folder) as $folder_name) {
342 if (strtolower($folder_name) == strtolower(basename($this->
getExamplesPath()))) {
343 return $parent_folder .
"/" . $folder_name;
353 if (!$this->examples_path) {
354 $path_components = str_replace(
357 str_replace(
"Component",
"examples", $this->
getPath())
359 .
"/" . str_replace(
" ",
"", $this->
getTitle());
361 if ($path_array[4] !==
"examples") {
362 array_splice($path_array, 4, 0,
'examples');
364 $this->examples_path = implode(
"/", $path_array);
371 if (!$this->examples_namespace) {
373 $this->examples_namespace = str_replace(
376 str_replace(
"components/",
"",
$path)
394 return array_intersect_key(
396 array_unique(array_map(
"StrToLower", $array))
406 $description_serialized =
"";
413 $rules_serialized =
"";
417 'id' => $this->
getId(),
422 'description' => $description_serialized,
427 'rules' => $rules_serialized,
441 return str_replace($this->ilias_root .
'/',
'',
$path);
446 return "$this->ilias_root/$path";
Abstract Entry Part to share some common entry functionality.
Container to hold description of UI Components.
Container to hold rules of UI Components.
Stores Information of UI Components parsed from YAML, examples and less files.
setLessVariables(array $less_variables)
ComponentEntryDescription $description
getStatusImplementation()
array $feature_wiki_references
setChildren(array $children)
setFeatureWikiReferences(array $feature_wiki_references)
setIsAbstract(bool $is_abstract)
setStatusEntry(string $status_entry)
setContext(array $context)
setStatusImplementation(string $status_implementation)
setBackground(string $background)
setDescription(ComponentEntryDescription $description)
trimRootDirectory(string $path)
getFeatureWikiReferences()
getCaseInsensitiveExampleFolder()
Note case handling of is dir is different from OS to OS, therefore while reading the examples from th...
ComponentEntryRules $rules
static array_iunique(array $array)
string $status_implementation
string $examples_namespace
setNamespace(string $namespace)
prependRootDirectory(string $path)
const DEPTH_FROM_REPOSITORY_ROOT
array $status_list_implementation
setSelector(string $selector)
addChildren(array $children)
setRules(ComponentEntryRules $rules)
setParent(string $parent)
if($err=$client->getError()) $namespace
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc