ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ComponentHelper.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2016 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
6 
8 
12 trait ComponentHelper
13 {
17  private $canonical_name = null;
18 
25  public function getCanonicalName()
26  {
27  if ($this->canonical_name === null) {
28  $this->canonical_name = $this->getCanonicalNameByFullyQualifiedName();
29  }
30  return $this->canonical_name;
31  }
32 
39  {
40  $cls = explode("\\", get_class($this));
41  $name = [];
42  $cur = array_pop($cls);
43  while ($cur !== "Component" && count($cls) > 0) {
44  $name[] = preg_replace("%([a-z])([A-Z])%", "$1 $2", $cur);
45  $cur = array_pop($cls);
46  }
47  return implode(" ", $name);
48  }
49 
61 
79 
92 
243 
getCanonicalNameByFullyQualifiedName()
Does the calculation required for getCanonicalName.
getCanonicalName()
Get the canonical name of the component.