Elgg  Version 3.0
ClassMap.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg;
4 
13 class ClassMap {
14 
18  protected $map = [];
19 
23  protected $altered = false;
24 
31  public function getPath($class) {
32  if ('\\' === $class[0]) {
33  $class = substr($class, 1);
34  }
35  return isset($this->map[$class]) ? $this->map[$class] : "";
36  }
37 
45  public function setPath($class, $path) {
46  if ('\\' === $class[0]) {
47  $class = substr($class, 1);
48  }
49  if (!isset($this->map[$class]) || $this->map[$class] !== $path) {
50  $this->map[$class] = $path;
51  $this->altered = true;
52  }
53  return $this;
54  }
55 
61  public function getAltered() {
62  return $this->altered;
63  }
64 
71  public function setAltered($altered) {
72  $this->altered = (bool) $altered;
73  return $this;
74  }
75 
81  public function getMap() {
82  return $this->map;
83  }
84 
92  public function setMap(array $map) {
93  $this->map = $map;
94  return $this;
95  }
96 
104  public function mergeMap(array $map) {
105  $this->map = array_merge($this->map, $map);
106  return $this;
107  }
108 }
getAltered()
Was this map altered by the class loader?
Definition: ClassMap.php:61
setMap(array $map)
Set the full map.
Definition: ClassMap.php:92
$path
Definition: details.php:89
getMap()
Get the full map.
Definition: ClassMap.php:81
getPath($class)
Get the path for a class/interface/trait.
Definition: ClassMap.php:31
mergeMap(array $map)
Merge a class map with the current map.
Definition: ClassMap.php:104
setAltered($altered)
Set the altered flag.
Definition: ClassMap.php:71
A map of class names to absolute file paths.
Definition: ClassMap.php:13
Configuration exception.
$class
Definition: field.php:29
setPath($class, $path)
Set the path for a class/interface/trait, and mark map as altered.
Definition: ClassMap.php:45