Elgg  Version 2.3
ClassMap.php
Go to the documentation of this file.
1 <?php
2 namespace Elgg;
11 class ClassMap {
12 
16  protected $map = array();
17 
21  protected $altered = false;
22 
29  public function getPath($class) {
30  if ('\\' === $class[0]) {
31  $class = substr($class, 1);
32  }
33  return isset($this->map[$class]) ? $this->map[$class] : "";
34  }
35 
43  public function setPath($class, $path) {
44  if ('\\' === $class[0]) {
45  $class = substr($class, 1);
46  }
47  if (!isset($this->map[$class]) || $this->map[$class] !== $path) {
48  $this->map[$class] = $path;
49  $this->altered = true;
50  }
51  return $this;
52  }
53 
59  public function getAltered() {
60  return $this->altered;
61  }
62 
69  public function setAltered($altered) {
70  $this->altered = (bool) $altered;
71  return $this;
72  }
73 
79  public function getMap() {
80  return $this->map;
81  }
82 
90  public function setMap(array $map) {
91  $this->map = $map;
92  return $this;
93  }
94 
102  public function mergeMap(array $map) {
103  $this->map = array_merge($this->map, $map);
104  return $this;
105  }
106 }
107 
getAltered()
Was this map altered by the class loader?
Definition: ClassMap.php:59
setMap(array $map)
Set the full map.
Definition: ClassMap.php:90
$path
Definition: details.php:88
$class
Definition: field.php:20
getMap()
Get the full map.
Definition: ClassMap.php:79
getPath($class)
Get the path for a class/interface/trait.
Definition: ClassMap.php:29
mergeMap(array $map)
Merge a class map with the current map.
Definition: ClassMap.php:102
setAltered($altered)
Set the altered flag.
Definition: ClassMap.php:69
Save menu items.
setPath($class, $path)
Set the path for a class/interface/trait, and mark map as altered.
Definition: ClassMap.php:43