ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 21 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 40 of file class.ilComponentInfoDefinitionProcessor.php.

References $component, and $type.

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

◆ 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 54 of file class.ilComponentInfoDefinitionProcessor.php.

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

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

◆ 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 47 of file class.ilComponentInfoDefinitionProcessor.php.

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

◆ endTag()

ilComponentInfoDefinitionProcessor::endTag ( string  $name)

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

Implements ilComponentDefinitionProcessor.

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

102  : void
103  {
104  }

◆ getData()

ilComponentInfoDefinitionProcessor::getData ( )

Definition at line 29 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 34 of file class.ilComponentInfoDefinitionProcessor.php.

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

Field Documentation

◆ $component

string ilComponentInfoDefinitionProcessor::$component
protected

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

Referenced by beginComponent(), and beginTag().

◆ $component_id

string ilComponentInfoDefinitionProcessor::$component_id
protected

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

Referenced by beginTag().

◆ $data

array ilComponentInfoDefinitionProcessor::$data = []
protected

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

Referenced by getData().

◆ $slots

array ilComponentInfoDefinitionProcessor::$slots = []
protected

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

◆ $type

string ilComponentInfoDefinitionProcessor::$type
protected

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

Referenced by beginComponent(), and beginTag().


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