1: <?php
2:
3: namespace Himedia\Padocc\Properties;
4:
5: /**
6: * Gestionnaire de propriétés (table de hashage).
7: * Le nom des propriétés est insensible à la casse.
8: * Sait charger les fichiers de configuration PHP au format INI.
9: * Sait également charger les fichiers de configuration shell (qui acceptent la factorisation) au format suivant :
10: * PROPRIETE_1="chaîne"
11: * PROPRIETE_2="chaîne $PROPRIETE_1 chaîne"
12: *
13: * @author Geoffroy AUBRY <gaubry@hi-media.com>
14: */
15: interface PropertiesInterface
16: {
17:
18: /**
19: * Retourne la valeur de la propriété spécifiée (insensible à la casse).
20: *
21: * @param string $sPropertyName propriété dont on recherche la valeur
22: * @return string valeur de la propriété spécifiée.
23: * @throws \UnexpectedValueException si propriété inconnue
24: */
25: public function getProperty($sPropertyName);
26:
27: /**
28: * Initialise ou met à jour la valeur de la propriété spécifiée (insensible à la casse).
29: *
30: * @param string $sPropertyName propriété
31: * @param string $sValue
32: * @return PropertiesInterface $this
33: */
34: public function setProperty($sPropertyName, $sValue);
35:
36: /**
37: * Charge le fichier INI spécifié en ajoutant ou écrasant ses définitions aux propriétés existantes.
38: * Le nom des propriétés sont insensibles à la casse.
39: *
40: * @param string $sIniPath path du fichier INI à charger
41: * @return PropertiesInterface cette instance
42: * @throws \RuntimeException si erreur de chargement du fichier INI
43: * @throws \UnexpectedValueException si fichier INI introuvable
44: */
45: public function loadConfigIniFile($sIniPath);
46:
47: /**
48: * Charge le fichier shell spécifié en ajoutant ou écrasant ses définitions aux propriétés existantes.
49: * Le nom des propriétés sont insensibles à la casse.
50: *
51: * Format du fichier :
52: * PROPRIETE_1="chaîne"
53: * PROPRIETE_2="chaîne $PROPRIETE_1 chaîne"
54: * ...
55: *
56: * @param string $sConfigShellPath path du fichier shell à charger
57: * @return PropertiesInterface cette instance
58: * @throws \RuntimeException si erreur de chargement du fichier
59: * @throws \UnexpectedValueException si fichier shell introuvable
60: */
61: public function loadConfigShellFile($sConfigShellPath);
62: }
63: