ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
10 trait ComponentHelper
11 {
15  private $canonical_name = null;
16 
23  public function getCanonicalName()
24  {
25  if ($this->canonical_name === null) {
26  $this->canonical_name = $this->getCanonicalNameByFullyQualifiedName();
27  }
28  return $this->canonical_name;
29  }
30 
37  {
38  $cls = explode("\\", get_class($this));
39  $name = [];
40  $cur = array_pop($cls);
41  while ($cur !== "Component" && count($cls) > 0) {
42  $name[] = preg_replace("%([a-z])([A-Z])%", "$1 $2", $cur);
43  $cur = array_pop($cls);
44  }
45  return implode(" ", $name);
46  }
47 
59 
77 
90 
211 
getCanonicalNameByFullyQualifiedName()
Does the calculation required for getCanonicalName.
if($format !==null) $name
Definition: metadata.php:146
getCanonicalName()
Get the canonical name of the component.