ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilComponentInfoDefinitionProcessor Class Reference
+ Inheritance diagram for ilComponentInfoDefinitionProcessor:
+ Collaboration diagram for ilComponentInfoDefinitionProcessor:

Public Member Functions

 getData ()
 
 purge ()
 This methods is supposed to purge existing data in the provider of the component, so new components can be added to a clean slate. More...
 
 beginComponent (string $component, string $type)
 This method is called when parsing of component.xml for the given component starts. More...
 
 endComponent (string $component, string $type)
 This method is called when parsing of component.xml for the given component ends. More...
 
 beginTag (string $name, array $attributes)
 This is called when a tag starts in the context of the given component. More...
 
 endTag (string $name)
 This is called when a tag ends in the context of the given component. More...
 

Protected Attributes

array $data = []
 
array $slots = []
 
string $component_id
 
string $component
 
string $type
 

Detailed Description

Definition at line 22 of file class.ilComponentInfoDefinitionProcessor.php.

Member Function Documentation

◆ beginComponent()

ilComponentInfoDefinitionProcessor::beginComponent ( string  $component,
string  $type 
)

This method is called when parsing of component.xml for the given component starts.

This is supposed to reset any internal parsing state.

Implements ilComponentDefinitionProcessor.

Definition at line 41 of file class.ilComponentInfoDefinitionProcessor.php.

References $component, and $type.

41  : void
42  {
43  $this->component_id = null;
44  $this->component = $component;
45  $this->type = $type;
46  }

◆ beginTag()

ilComponentInfoDefinitionProcessor::beginTag ( string  $name,
array  $attributes 
)

This is called when a tag starts in the context of the given component.

Parameters
string[]$attributes

Implements ilComponentDefinitionProcessor.

Definition at line 55 of file class.ilComponentInfoDefinitionProcessor.php.

References $component, $component_id, $id, and $type.

55  : void
56  {
57  if ($name === "module") {
58  $type = "components/ILIAS";
59  } elseif ($name === "service") {
60  $type = "components/ILIAS";
61  } elseif ($name === "pluginslot") {
62  $type = null;
63  } else {
64  return;
65  }
66 
67  if (!isset($attributes["id"])) {
68  throw new \InvalidArgumentException(
69  "Expected attribute 'id' for tag '$name' in $this->component"
70  );
71  }
72 
73  $id = $attributes["id"];
74  if (!is_null($type)) {
75  if ($type !== $this->type) {
76  throw new \InvalidArgumentException(
77  "Type $this->type and tag don't match for component $this->component"
78  );
79  }
80  if (isset($this->data[$id])) {
81  throw new \LogicException(
82  "In $this->type/$this->component: Id '$id' for component is used twice. First occurence was in {$this->data[$id][0]}/{$this->data[$id][1]}."
83  );
84  }
85  $this->component_id = $id;
86  $this->data[$id] = [$this->type, $this->component, []];
87  } else {
88  if (!isset($attributes["name"])) {
89  throw new \InvalidArgumentException(
90  "Expected attribute 'name' for tag '$name' in $this->component"
91  );
92  }
93  if (isset($this->slots[$id])) {
94  throw new \LogicException(
95  "In $this->type/$this->component: Id '$id' for plugin slot is used twice. First occurence was in {$this->slots[$id][0]}/{$this->slots[$id][1]}."
96  );
97  }
98  $this->slots[$id] = [$this->type, $this->component];
99  $this->data[$this->component_id][2][] = [$id, $attributes["name"]];
100  }
101  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24

◆ endComponent()

ilComponentInfoDefinitionProcessor::endComponent ( string  $component,
string  $type 
)

This method is called when parsing of component.xml for the given component ends.

Implements ilComponentDefinitionProcessor.

Definition at line 48 of file class.ilComponentInfoDefinitionProcessor.php.

48  : void
49  {
50  $this->component_id = null;
51  $this->component = null;
52  $this->type = null;
53  }

◆ endTag()

ilComponentInfoDefinitionProcessor::endTag ( string  $name)

This is called when a tag ends in the context of the given component.

Implements ilComponentDefinitionProcessor.

Definition at line 103 of file class.ilComponentInfoDefinitionProcessor.php.

103  : void
104  {
105  }

◆ getData()

ilComponentInfoDefinitionProcessor::getData ( )

Definition at line 30 of file class.ilComponentInfoDefinitionProcessor.php.

References $data.

◆ purge()

ilComponentInfoDefinitionProcessor::purge ( )

This methods is supposed to purge existing data in the provider of the component, so new components can be added to a clean slate.

Implements ilComponentDefinitionProcessor.

Definition at line 35 of file class.ilComponentInfoDefinitionProcessor.php.

35  : void
36  {
37  $this->data = [];
38  $this->slots = [];
39  }

Field Documentation

◆ $component

string ilComponentInfoDefinitionProcessor::$component
protected

Definition at line 27 of file class.ilComponentInfoDefinitionProcessor.php.

Referenced by beginComponent(), and beginTag().

◆ $component_id

string ilComponentInfoDefinitionProcessor::$component_id
protected

Definition at line 26 of file class.ilComponentInfoDefinitionProcessor.php.

Referenced by beginTag().

◆ $data

array ilComponentInfoDefinitionProcessor::$data = []
protected

Definition at line 24 of file class.ilComponentInfoDefinitionProcessor.php.

Referenced by getData().

◆ $slots

array ilComponentInfoDefinitionProcessor::$slots = []
protected

Definition at line 25 of file class.ilComponentInfoDefinitionProcessor.php.

◆ $type

string ilComponentInfoDefinitionProcessor::$type
protected

Definition at line 28 of file class.ilComponentInfoDefinitionProcessor.php.

Referenced by beginComponent(), and beginTag().


The documentation for this class was generated from the following file: