Subversion Repositories Applications.papyrus

Rev

Rev 2014 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
<?php
2
 
3
class Registre {
4
 
5
	private $aso_stock = array();
6
	private static $registre;
7
 
8
	public function __construct()
9
	{
10
 
11
	}
12
 
13
	public static function getInstance()
14
	{
15
		if (self::$registre instanceof Registre) {
16
			return self::$registre;
17
		}
18
		self::$registre = new Registre;
19
	    return self::$registre;
20
	}
21
 
22
	function set($intitule, $objet)
23
	{
24
		if (is_array($objet) && isset($this->aso_stock[$intitule])) {
25
			$this->aso_stock[$intitule] = array_merge((array)$this->aso_stock[$intitule], (array)$objet);
26
			$message = "Le tableau $intitule présent dans le registre a été fusionné avec un nouveau tableau de même intitulé !";
27
			trigger_error($message, E_USER_WARNING);
28
		} else {
29
			$this->aso_stock[$intitule] = $objet;
30
		}
31
	}
32
 
33
	function get($intitule)
34
	{
35
		if (isset($this->aso_stock[$intitule])) {
36
			return $this->aso_stock[$intitule];
37
		}
38
		return null;
39
	}
40
 
41
	function detruire($intitule)
42
	{
43
		if (isset($this->aso_stock[$intitule])) {
44
			unset($this->aso_stock[$intitule]);
45
		}
46
	}
47
 
48
	public function etrePresent($intitule)
49
	{
50
		if(isset($this->aso_stock[$intitule])){
51
			return true;
52
		}
53
		return false;
54
	}
55
}
2014 aurelien 56
?>