Elgg  Version 4.3
ClassMap.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg;
4 
10 class ClassMap {
11 
15  protected $map = [];
16 
20  protected $altered = false;
21 
28  public function getPath($class) {
29  if ('\\' === $class[0]) {
30  $class = substr($class, 1);
31  }
32  return isset($this->map[$class]) ? $this->map[$class] : "";
33  }
34 
42  public function setPath($class, $path) {
43  if ('\\' === $class[0]) {
44  $class = substr($class, 1);
45  }
46  if (!isset($this->map[$class]) || $this->map[$class] !== $path) {
47  $this->map[$class] = $path;
48  $this->altered = true;
49  }
50  return $this;
51  }
52 
58  public function getAltered() {
59  return $this->altered;
60  }
61 
68  public function setAltered($altered) {
69  $this->altered = (bool) $altered;
70  return $this;
71  }
72 
78  public function getMap() {
79  return $this->map;
80  }
81 
89  public function setMap(array $map) {
90  $this->map = $map;
91  return $this;
92  }
93 
101  public function mergeMap(array $map) {
102  $this->map = array_merge($this->map, $map);
103  return $this;
104  }
105 }
getAltered()
Was this map altered by the class loader?
Definition: ClassMap.php:58
setMap(array $map)
Set the full map.
Definition: ClassMap.php:89
getMap()
Get the full map.
Definition: ClassMap.php:78
getPath($class)
Get the path for a class/interface/trait.
Definition: ClassMap.php:28
mergeMap(array $map)
Merge a class map with the current map.
Definition: ClassMap.php:101
setAltered($altered)
Set the altered flag.
Definition: ClassMap.php:68
$class
Definition: summary.php:44
A map of class names to absolute file paths.
Definition: ClassMap.php:10
$path
Definition: details.php:68
setPath($class, $path)
Set the path for a class/interface/trait, and mark map as altered.
Definition: ClassMap.php:42