| Line 10... |
Line 10... |
| 10 |
* @package Framework
|
10 |
* @package Framework
|
| 11 |
* @author Jean-Pascal MILCENT <jmp@tela-botanica.org>
|
11 |
* @author Jean-Pascal MILCENT <jmp@tela-botanica.org>
|
| 12 |
* @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org)
|
12 |
* @copyright Copyright (c) 2009, Tela Botanica (accueil@tela-botanica.org)
|
| 13 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
13 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
| 14 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
14 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
| 15 |
* @version $Id: Registre.php 301 2011-01-18 14:23:52Z jpm $
|
15 |
* @version $Id: Registre.php 443 2013-10-22 15:09:30Z raphael $
|
| 16 |
* @link /doc/framework/
|
16 |
* @link /doc/framework/
|
| 17 |
*
|
17 |
*
|
| 18 |
*/
|
18 |
*/
|
| 19 |
class Registre {
|
19 |
class Registre {
|
| Line 27... |
Line 27... |
| 27 |
* @param mixed l'objet à conserver
|
27 |
* @param mixed l'objet à conserver
|
| 28 |
*/
|
28 |
*/
|
| 29 |
public static function set($intitule, $objet) {
|
29 |
public static function set($intitule, $objet) {
|
| 30 |
if (is_array($objet) && isset(self::$stockage[$intitule])) {
|
30 |
if (is_array($objet) && isset(self::$stockage[$intitule])) {
|
| 31 |
self::$stockage[$intitule] = array_merge((array) self::$stockage[$intitule], (array) $objet);
|
31 |
self::$stockage[$intitule] = array_merge((array) self::$stockage[$intitule], (array) $objet);
|
| 32 |
$message = "Le tableau $intitule présent dans le registre a été fusionné avec un nouveau tableau de même intitulé !";
|
32 |
$message = "Le tableau \"$intitule\" présent dans le registre a été fusionné avec un nouveau tableau de même intitulé !";
|
| 33 |
trigger_error($message, E_USER_WARNING);
|
33 |
trigger_error($message, E_USER_WARNING);
|
| 34 |
} else {
|
34 |
} else {
|
| 35 |
self::$stockage[$intitule] = $objet;
|
35 |
self::$stockage[$intitule] = $objet;
|
| 36 |
}
|
36 |
}
|
| 37 |
}
|
37 |
}
|
| Line 39... |
Line 39... |
| 39 |
/**
|
39 |
/**
|
| 40 |
* Renvoie le contenu associé à l'intitulé donné en paramètre.
|
40 |
* Renvoie le contenu associé à l'intitulé donné en paramètre.
|
| 41 |
* @return mixed l'objet associé à l'intitulé ou null s'il n'est pas présent
|
41 |
* @return mixed l'objet associé à l'intitulé ou null s'il n'est pas présent
|
| 42 |
*/
|
42 |
*/
|
| 43 |
public static function get($intitule) {
|
43 |
public static function get($intitule) {
|
| 44 |
$retour = (isset(self::$stockage[$intitule])) ? self::$stockage[$intitule] : null;
|
44 |
return isset(self::$stockage[$intitule]) ? self::$stockage[$intitule] : null;
|
| 45 |
return $retour;
|
- |
|
| 46 |
}
|
45 |
}
|
| Line 47... |
Line 46... |
| 47 |
|
46 |
|
| 48 |
/**
|
47 |
/**
|
| 49 |
* Détruit l'objet associé à l'intitulé, n'a pas d'effet si il n'y a pas d'objet associé.
|
48 |
* Détruit l'objet associé à l'intitulé, n'a pas d'effet si il n'y a pas d'objet associé.
|
| Line 59... |
Line 58... |
| 59 |
* Teste si le registre contient une donnée pour un intitulé d'entrée donné.
|
58 |
* Teste si le registre contient une donnée pour un intitulé d'entrée donné.
|
| 60 |
* @param string l'intitulé de l'entrée du registre à tester.
|
59 |
* @param string l'intitulé de l'entrée du registre à tester.
|
| 61 |
* @return boolean true si un objet associé à cet intitulé est présent, false sinon
|
60 |
* @return boolean true si un objet associé à cet intitulé est présent, false sinon
|
| 62 |
*/
|
61 |
*/
|
| 63 |
public static function existe($intitule) {
|
62 |
public static function existe($intitule) {
|
| 64 |
$retour = (isset(self::$stockage[$intitule])) ? true : false;
|
63 |
return array_key_exists($intitule, self::$stockage);
|
| 65 |
return $retour;
|
- |
|
| 66 |
}
|
64 |
}
|
| 67 |
}
|
65 |
}
|
| 68 |
?>
|
66 |
?>
|
| 69 |
|
67 |
|