Subversion Repositories Applications.framework

Rev

Rev 80 | Rev 105 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80 Rev 84
Line 1... Line 1...
1
<?php
1
<?php
2
 
-
 
3
/** Fichier de la classe Chronometre
2
/** Fichier de la classe Chronometre
4
* 
3
* 
5
* PHP Version 5 
4
* PHP Version 5 
6
* 
5
* 
7
* @category  PHP
6
* @category  PHP
Line 31... Line 30...
31
* @copyright 2009 Tela-Botanica
30
* @copyright 2009 Tela-Botanica
32
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL  
31
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL  
33
* @version   Release: <package_version> 
32
* @version   Release: <package_version> 
34
* @link      /doc/framework/ 
33
* @link      /doc/framework/ 
35
*/
34
*/
36
class Chronometre
35
class Chronometre {
37
{
-
 
38
    /*** Attributs : ***/
36
    /*** Attributs : ***/
39
    private $_temps = array ();
37
    private $_temps = array();
Line 40... Line 38...
40
 
38
 
41
    /** Constructeur : **/
39
    /** Constructeur : **/
42
    public function __construct() 
-
 
43
    {
-
 
44
        $this->setTemps(
-
 
45
            array (
40
    public function __construct() {
46
                'depart' => microtime()
-
 
47
                )
-
 
48
        );
41
        $this->setTemps(array('depart' => microtime()));
Line 49... Line 42...
49
    }
42
    }
50
 
43
 
51
    /** Accesseurs : 
44
    /** Accesseurs : 
52
     * 
45
     * 
53
     * @param string $cle la cle associée à un chronomètre particulier
46
     * @param string $cle la cle associée à un chronomètre particulier
54
     * 
47
     * 
55
     * @return int le temps écoulé
48
     * @return int le temps écoulé
56
     */
49
     */
57
    public function getTemps($cle = null) 
50
    public function getTemps($cle = null) {
58
    {
51
        $temps = '';
59
        if (!is_null($cle)) {
52
    	if (!is_null($cle)) {
60
            return $this->_temps[$cle];
53
            $temps = $this->_temps[$cle];
61
        } else {
54
        } else {
-
 
55
            $temps = $this->_temps;
62
            return $this->_temps;
56
        }
Line 63... Line 57...
63
        }
57
        return $temps;
64
    }
58
    }
65
 
59
 
66
    /** Setteur pour la variable temps 
60
    /** Setteur pour la variable temps 
67
     *
61
     *
68
     * @param array() $moment ajoute des points de chronométrage au tableau _temps
62
     * @param array() $moment ajoute des points de chronométrage au tableau _temps
69
     * 
63
     * 
70
     * @return null 
-
 
71
     */
64
     * @return null 
72
    public function setTemps($moment = array ()) 
65
     */
Line 73... Line 66...
73
    {
66
    public function setTemps($moment = array ()) {
Line 96... Line 89...
96
    * 
89
    * 
97
    * @param    int     $indentation_origine l'indentation de base.
90
    * @param    int     $indentation_origine l'indentation de base.
98
    * @param    int     $indentation le pas d'indentation.
91
    * @param    int     $indentation le pas d'indentation.
99
    * @return   string  la chaine XHTML de mesure des temps.
92
    * @return   string  la chaine XHTML de mesure des temps.
100
    */
93
    */
101
    function afficherChrono($indentation_origine = 8, $indentation = 4) {
94
    public function afficherChrono($indentation_origine = 8, $indentation = 4) {
102
        // Création du chrono de fin
95
        // Création du chrono de fin
103
        $GLOBALS['_SCRIPT_']['chrono']->setTemps(array (
96
        $GLOBALS['_SCRIPT_']['chrono']->setTemps(array (
104
            'fin' => microtime()
97
            'fin' => microtime()
105
        ));
98
        ));
Line 165... Line 158...
165
        $sortie .= str_repeat(' ', $indentation_origine) .
158
        $sortie .= str_repeat(' ', $indentation_origine) .
166
        '</table>' . "\n";
159
        '</table>' . "\n";
Line 167... Line 160...
167
 
160
 
168
        return $sortie;
161
        return $sortie;
169
    }
-
 
170
 
162
    }
171
}
163
}
172
?>
164
?>