Subversion Repositories Applications.framework

Compare Revisions

Ignore whitespace Rev 83 → Rev 84

/trunk/framework/Controleur.php
120,11 → 120,11
}
// on récupère le buffer et on le vide
$buffer = ob_get_contents();
$tampon = ob_get_contents();
@ob_end_clean();
// enfin on renvoie le contenu
$this->$nom_squelette = $buffer;
$this->$nom_squelette = $tampon;
}
}
?>
/trunk/framework/Registre.php
8,7 → 8,7
/**
* Tableau associatif stockant les variables
*/
private $aso_stock = array();
private $stockage = array();
/**
* La classe registre se contient elle-même, (pour le pattern singleton)
*/
17,8 → 17,7
/**
* Constructeur par défaut, privé, car on accède à la classe par le getInstance
*/
private function __construct()
{
private function __construct() {
$registre = $this;
}
26,8 → 25,7
* Fonction qui renvoie l'instance de classe en assurant son unicité, c'est l'unique méthode qui doit être
* utilisé pour récupérer l'objet Registre
*/
public static function getInstance()
{
public static function getInstance() {
if (self::$registre instanceof Registre) {
return self::$registre;
}
40,14 → 38,13
* @param string l'intitulé sous lequel l'objet sera conservé
* @param mixed l'objet à conserver
*/
function set($intitule, $objet)
{
if (is_array($objet) && isset($this->aso_stock[$intitule])) {
$this->aso_stock[$intitule] = array_merge((array)$this->aso_stock[$intitule], (array)$objet);
public function set($intitule, $objet) {
if (is_array($objet) && isset($this->stockage[$intitule])) {
$this->stockage[$intitule] = array_merge((array) $this->stockage[$intitule], (array) $objet);
$message = "Le tableau $intitule présent dans le registre a été fusionné avec un nouveau tableau de même intitulé !";
trigger_error($message, E_USER_WARNING);
} else {
$this->aso_stock[$intitule] = $objet;
$this->stockage[$intitule] = $objet;
}
}
 
55,10 → 52,9
* Renvoie l'objet associé à l'intitulé donné en paramètre
* @return mixed l'objet associé à l'intitulé ou null s'il n'est pas présent
*/
function get($intitule)
{
if (isset($this->aso_stock[$intitule])) {
return $this->aso_stock[$intitule];
public function get($intitule) {
if (isset($this->stockage[$intitule])) {
return $this->stockage[$intitule];
}
return null;
}
66,10 → 62,9
/**
* Détruit l'objet associé à l'intitulé, n'a pas d'effet si il n'y a pas d'objet associé
*/
function detruire($intitule)
{
if (isset($this->aso_stock[$intitule])) {
unset($this->aso_stock[$intitule]);
public function detruire($intitule) {
if (isset($this->stockage[$intitule])) {
unset($this->stockage[$intitule]);
}
}
77,9 → 72,8
* Teste si un objet est présent sous un intitulé donné
* @return boolean true si un objet associé à cet intitulé est présent, false sinon
*/
public function etrePresent($intitule)
{
if(isset($this->aso_stock[$intitule])){
public function existe($intitule) {
if(isset($this->stockage[$intitule])){
return true;
}
return false;
/trunk/framework/Chronometre.php
1,5 → 1,4
<?php
 
/** Fichier de la classe Chronometre
*
* PHP Version 5
33,19 → 32,13
* @version Release: <package_version>
* @link /doc/framework/
*/
class Chronometre
{
class Chronometre {
/*** Attributs : ***/
private $_temps = array ();
private $_temps = array();
 
/** Constructeur : **/
public function __construct()
{
$this->setTemps(
array (
'depart' => microtime()
)
);
public function __construct() {
$this->setTemps(array('depart' => microtime()));
}
 
/** Accesseurs :
54,13 → 47,14
*
* @return int le temps écoulé
*/
public function getTemps($cle = null)
{
if (!is_null($cle)) {
return $this->_temps[$cle];
public function getTemps($cle = null) {
$temps = '';
if (!is_null($cle)) {
$temps = $this->_temps[$cle];
} else {
return $this->_temps;
$temps = $this->_temps;
}
return $temps;
}
 
/** Setteur pour la variable temps
69,8 → 63,7
*
* @return null
*/
public function setTemps($moment = array ())
{
public function setTemps($moment = array ()) {
array_push($this->_temps, $moment);
}
 
98,7 → 91,7
* @param int $indentation le pas d'indentation.
* @return string la chaine XHTML de mesure des temps.
*/
function afficherChrono($indentation_origine = 8, $indentation = 4) {
public function afficherChrono($indentation_origine = 8, $indentation = 4) {
// Création du chrono de fin
$GLOBALS['_SCRIPT_']['chrono']->setTemps(array (
'fin' => microtime()
167,6 → 160,5
 
return $sortie;
}
 
}
?>