20 declare(strict_types=1);
32 $this->processors = $processor;
41 foreach ($this->processors as $p) {
54 foreach ($this->processors as $processor) {
55 $processor->beginComponent($component, $type);
58 foreach ($this->processors as $processor) {
59 $processor->endComponent($component, $type);
66 if (!file_exists($path)) {
67 throw new \InvalidArgumentException(
68 "Cannot find file $path." 71 return file_get_contents($path);
78 $xml_parser = xml_parser_create(
"UTF-8");
79 xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING,
false);
80 xml_set_object($xml_parser, $this);
81 xml_set_element_handler($xml_parser,
'beginTag',
'endTag');
82 if (!xml_parse($xml_parser, $xml)) {
83 $code = xml_get_error_code($xml_parser);
84 $line = xml_get_current_line_number($xml_parser);
85 $col = xml_get_current_column_number($xml_parser);
86 $msg = xml_error_string($code);
87 throw new \InvalidArgumentException(
88 "Error $code component xml of $type/$component, on line $line in column $col: $msg" 93 xml_parser_free($xml_parser);
98 public function beginTag($_,
string $name, array $attributes): void
100 foreach ($this->processors as $processor) {
101 $processor->beginTag($name, $attributes);
105 public function endTag($_,
string $name): void
107 foreach ($this->processors as $processor) {
108 $processor->endTag($name);
120 foreach ($this->
getComponentInfo(
"components/ILIAS",
"service.xml") as $i) {
130 $dir = __DIR__ .
"/../../../../" . $type;
135 realpath($dir .
"/" . $c .
"/" . $name)
145 $dir = opendir($root);
146 while ($sub = readdir($dir)) {
147 if ($sub ===
"." || $sub ===
"..") {
150 if (!is_dir($root .
"/" . $sub)) {
153 if (!is_file($root .
"/" . $sub .
"/" . $name)) {
An ilComponentDefinitionProcessor processes some attributes from a component.xml (i.e.
purge()
This methods is supposed to purge existing data in the registered processor.
parseComponentXML(string $type, string $component, string $xml)
getComponentInfo(string $type, string $name)
getComponentPaths(string $root, string $name)
readComponentDefinitions()
This reads the component.xml of all components in the core and processes them with the provided proce...
beginTag($_, string $name, array $attributes)
__construct(ilComponentDefinitionProcessor ... $processor)