Subversion Repositories eFlore/Projets.eflore-projets

Rev

Rev 441 | Rev 478 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 441 Rev 475
1
<?php
1
<?php
2
class Conteneur {
2
class Conteneur {
3
	protected $parametres = array();
3
	protected $parametres = array();
4
	protected $partages = array();
4
	protected $partages = array();
5
 
5
 
6
	public function __construct(array $parametres = null) {
6
	public function __construct(array $parametres = null) {
7
		$this->parametres = is_null($parametres) ? array() : $parametres;
7
		$this->parametres = is_null($parametres) ? array() : $parametres;
8
	}
8
	}
9
 
9
 
10
	public function getParametre($cle) {
10
	public function getParametre($cle) {
11
		$valeur = isset($this->parametres[$cle]) ? $this->parametres[$cle] : Config::get($cle);
11
		$valeur = isset($this->parametres[$cle]) ? $this->parametres[$cle] : Config::get($cle);
12
		return $valeur;
12
		return $valeur;
13
	}
13
	}
14
 
14
 
15
	public function getParametreTableau($cle) {
15
	public function getParametreTableau($cle) {
16
		$tableau = array();
16
		$tableau = array();
17
		$parametre = $this->getParametre($cle);
17
		$parametre = $this->getParametre($cle);
18
		if (empty($parametre) === false) {
18
		if (empty($parametre) === false) {
19
			$tableauPartiel = explode(',', $parametre);
19
			$tableauPartiel = explode(',', $parametre);
20
			$tableauPartiel = array_map('trim', $tableauPartiel);
20
			$tableauPartiel = array_map('trim', $tableauPartiel);
21
			foreach ($tableauPartiel as $champ) {
21
			foreach ($tableauPartiel as $champ) {
22
				if (strpos($champ, '=') === false) {
22
				if (strpos($champ, '=') === false) {
23
					$tableau[] = trim($champ);
23
					$tableau[] = trim($champ);
24
				} else {
24
				} else {
25
					list($cle, $val) = explode('=', $champ);
25
					list($cle, $val) = explode('=', $champ);
26
					$tableau[trim($cle)] = trim($val);
26
					$tableau[trim($cle)] = trim($val);
27
				}
27
				}
28
			}
28
			}
29
		}
29
		}
30
		return $tableau;
30
		return $tableau;
31
	}
31
	}
32
 
32
 
33
	public function setParametre($cle, $valeur) {
33
	public function setParametre($cle, $valeur) {
34
		$this->parametres[$cle] = $valeur;
34
		$this->parametres[$cle] = $valeur;
35
	}
35
	}
36
 
36
 
37
	public function getOutils() {
37
	public function getOutils() {
38
		if (!isset($this->partages['Outils'])){
38
		if (!isset($this->partages['Outils'])){
39
			$this->partages['Outils'] = new Outils();
39
			$this->partages['Outils'] = new Outils();
40
		}
40
		}
41
		return $this->partages['Outils'];
41
		return $this->partages['Outils'];
42
	}
42
	}
43
	
43
 
44
	public function getEfloreCommun() {
44
	public function getEfloreCommun() {
45
		if (!isset($this->partages['EfloreCommun'])){
45
		if (!isset($this->partages['EfloreCommun'])){
46
			$this->partages['EfloreCommun'] = new EfloreCommun();
46
			$this->partages['EfloreCommun'] = new EfloreCommun();
47
		}
47
		}
48
		return $this->partages['EfloreCommun'];
48
		return $this->partages['EfloreCommun'];
49
	}
49
	}
50
	
-
 
51
 
-
 
52
 
50
 
53
	public function getMessages() {
51
	public function getMessages() {
54
		if (!isset($this->partages['Messages'])){
52
		if (!isset($this->partages['Messages'])){
55
			$this->partages['Messages'] = new Messages($this->getParametre('-v'));
53
			$this->partages['Messages'] = new Messages($this->getParametre('-v'));
56
		}
54
		}
57
		return $this->partages['Messages'];
55
		return $this->partages['Messages'];
58
	}
56
	}
-
 
57
 
-
 
58
	public function getRestClient() {
-
 
59
		if (!isset($this->partages['RestClient'])){
-
 
60
			$this->partages['RestClient'] = new RestClient();
-
 
61
		}
-
 
62
		return $this->partages['RestClient'];
-
 
63
	}
59
}
64
}
60
?>
65
?>