Blame | Last modification | View Log | RSS feed
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>File Source for GestionnaireException.php</title>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<link rel="stylesheet" href="../media/stylesheet.css" />
</head>
<body>
<h1>Source for file GestionnaireException.php</h1>
<p>Documentation is available at <a href="../Framework/_GestionnaireException.php.html">GestionnaireException.php</a></p>
<div class="src-code">
<div class="src-code"><ol><li><div class="src-line"><a name="a1"></a><span class="src-php"><?php</span></div></li>
<li><div class="src-line"><a name="a2"></a><span class="src-comm">// declare(encoding='UTF-8');</span></div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a4"></a><span class="src-doc"> * Classe de gestion des exceptions.</span></div></li>
<li><div class="src-line"><a name="a5"></a><span class="src-doc"> * C'est un Singleton.</span></div></li>
<li><div class="src-line"><a name="a6"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a7"></a><span class="src-doc"> * PHP Version 5</span></div></li>
<li><div class="src-line"><a name="a8"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a9"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@category</span><span class="src-doc"> Class</span></div></li>
<li><div class="src-line"><a name="a10"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@package</span><span class="src-doc"> Framework</span></div></li>
<li><div class="src-line"><a name="a11"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@author</span><span class="src-doc"> aurelien <aurelien@tela-botanica.org></span></div></li>
<li><div class="src-line"><a name="a12"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@copyright</span><span class="src-doc"> 2009 Tela-Botanica</span></div></li>
<li><div class="src-line"><a name="a13"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@license</span><span class="src-doc"> http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL</span></div></li>
<li><div class="src-line"><a name="a14"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@license</span><span class="src-doc"> http://www.gnu.org/licenses/gpl.html Licence GNU-GPL</span></div></li>
<li><div class="src-line"><a name="a15"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@version</span><span class="src-doc"> SVN: $$Id: GestionnaireException.php 158 2010-03-04 17:14:36Z jpm $$</span></div></li>
<li><div class="src-line"><a name="a16"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@link</span><span class="src-doc"> /doc/framework/</span></div></li>
<li><div class="src-line"><a name="a17"></a><span class="src-doc"> *</span></div></li>
<li><div class="src-line"><a name="a18"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a19"></a><span class="src-key">class </span><a href="../Framework/GestionnaireException.html">GestionnaireException</a> <span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a20"></a> </div></li>
<li><div class="src-line"><a name="a21"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a22"></a><span class="src-doc"> * Liste des exceptions enregistrées</span></div></li>
<li><div class="src-line"><a name="a23"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a24"></a> <span class="src-key">private </span><span class="src-key">static </span><span class="src-var">$exceptions </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a25"></a> </div></li>
<li><div class="src-line"><a name="a26"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a27"></a><span class="src-doc"> * Détermine si l'on affiche ou non le contexte</span></div></li>
<li><div class="src-line"><a name="a28"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a29"></a> <span class="src-key">private </span><span class="src-key">static </span><span class="src-var">$contexte </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a30"></a> </div></li>
<li><div class="src-line"><a name="a31"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a32"></a><span class="src-doc"> * Détermine si l'on loggue ou non les erreurs</span></div></li>
<li><div class="src-line"><a name="a33"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a34"></a> <span class="src-key">private </span><span class="src-key">static </span><span class="src-var">$logger </span>= <span class="src-id">false</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a35"></a> </div></li>
<li><div class="src-line"><a name="a36"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a37"></a><span class="src-doc"> * Definit si php est lancé en ligne de commande ou en mode serveur</span></div></li>
<li><div class="src-line"><a name="a38"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a39"></a> <span class="src-key">private </span><span class="src-key">static </span><span class="src-var">$mode </span>= <span class="src-id">php_sapi_name </span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a40"></a> </div></li>
<li><div class="src-line"><a name="a41"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a42"></a><span class="src-doc"> * le gestionnaire d'exception est un singleton</span></div></li>
<li><div class="src-line"><a name="a43"></a><span class="src-doc"> * et possède donc un "pointeur statique sur lui-même"</span></div></li>
<li><div class="src-line"><a name="a44"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a45"></a> <span class="src-key">private </span><span class="src-key">static </span><span class="src-var">$gestionnaireException</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a46"></a> </div></li>
<li><div class="src-line"><a name="a47"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a48"></a><span class="src-doc"> * Constructeur avec paramètres optionnel</span></div></li>
<li><div class="src-line"><a name="a49"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">bool </span><span class="src-doc">indique si l'on veut afficher ou non le contexte des exceptions (i.e. la trace)</span></div></li>
<li><div class="src-line"><a name="a50"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a51"></a> <span class="src-key">public </span><span class="src-key">function </span><a href="../Framework/GestionnaireException.html#method__construct">__construct</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a52"></a> <span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$exceptions </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a53"></a> <span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$contexte </span>= <span class="src-id">Config</span><span class="src-sym">::</span><span class="src-id">get</span><span class="src-sym">(</span><span class="src-str">'fw_debogage_contexte'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a54"></a> <span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$logger </span>= <span class="src-id">Config</span><span class="src-sym">::</span><span class="src-id">get</span><span class="src-sym">(</span><span class="src-str">'fw_log_debogage'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a55"></a> <span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$mode </span>= <span class="src-id">php_sapi_name</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a56"></a> </div></li>
<li><div class="src-line"><a name="a57"></a> <a href="http://www.php.net/set_exception_handler">set_exception_handler</a><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><a href="http://www.php.net/get_class">get_class</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-str">'gererException'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a58"></a> <a href="http://www.php.net/set_error_handler">set_error_handler</a><span class="src-sym">(</span><span class="src-key">array</span><span class="src-sym">(</span><a href="http://www.php.net/get_class">get_class</a><span class="src-sym">(</span><span class="src-var">$this</span><span class="src-sym">)</span><span class="src-sym">,</span><span class="src-str">'gererErreur'</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a59"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a60"></a> </div></li>
<li><div class="src-line"><a name="a61"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a62"></a><span class="src-doc"> * Renvoie le booleen définissant si l'on affiche le contexte ou non</span></div></li>
<li><div class="src-line"><a name="a63"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a64"></a> <span class="src-key">public </span><span class="src-key">static </span><span class="src-key">function </span><a href="../Framework/GestionnaireException.html#methodgetContexte">getContexte</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a65"></a> <span class="src-key">return </span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$contexte</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a66"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a67"></a> </div></li>
<li><div class="src-line"><a name="a68"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a69"></a><span class="src-doc"> * Definit si l'on veut afficher le contexte ou non</span></div></li>
<li><div class="src-line"><a name="a70"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">bool </span><span class="src-doc">true si on veut afficher le contexte, false sinon, par défaut vaut false</span></div></li>
<li><div class="src-line"><a name="a71"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a72"></a> <span class="src-key">public </span><span class="src-key">function </span><a href="../Framework/GestionnaireException.html#methodsetContexte">setContexte</a><span class="src-sym">(</span><span class="src-var">$contexte</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a73"></a> <span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$contexte </span>= <span class="src-var">$contexte</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a74"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a75"></a> </div></li>
<li><div class="src-line"><a name="a76"></a> <span class="src-doc">/** Fonction d'accès au singleton</span></div></li>
<li><div class="src-line"><a name="a77"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@return </span><span class="src-doc-type">GestionnaireErreur </span><span class="src-doc">le gestionnaire d'exceptions courant</span></div></li>
<li><div class="src-line"><a name="a78"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a79"></a> <span class="src-key">public </span><span class="src-key">static </span><span class="src-key">function </span><a href="../Framework/GestionnaireException.html#methodgetInstance">getInstance</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a80"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$gestionnaireException </span>instanceof <span class="src-id">GestionnaireException</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a81"></a> <span class="src-key">return </span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$gestionnaireException</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a82"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a83"></a> <span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$gestionnaireException </span>= <span class="src-key">new </span><span class="src-id">GestionnaireException</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a84"></a> </div></li>
<li><div class="src-line"><a name="a85"></a> <span class="src-key">return </span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$gestionnaireException</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a86"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a87"></a> </div></li>
<li><div class="src-line"><a name="a88"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a89"></a><span class="src-doc"> * Fonction de gestion des exceptions, remplace le handler par défaut</span></div></li>
<li><div class="src-line"><a name="a90"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">Exception </span><span class="src-doc-var">$e </span><span class="src-doc">l'exception à traiter</span></div></li>
<li><div class="src-line"><a name="a91"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a92"></a> <span class="src-key">public </span><span class="src-key">static </span><span class="src-key">function </span><a href="../Framework/GestionnaireException.html#methodgererException">gererException</a><span class="src-sym">(</span><span class="src-id">Exception </span><span class="src-var">$e</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a93"></a> <span class="src-comm">// pour le moment on se contente de l'ajouter au tableau et de les afficher</span></div></li>
<li><div class="src-line"><a name="a94"></a> <span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$exceptions</span><span class="src-sym">[</span><span class="src-sym">] </span>= <span class="src-var">$e</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a95"></a> </div></li>
<li><div class="src-line"><a name="a96"></a> <span class="src-comm">// si on doit logger on envoie l'exception au loggeur</span></div></li>
<li><div class="src-line"><a name="a97"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$logger</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a98"></a> <span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">loggerException</span><span class="src-sym">(</span><span class="src-var">$e</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a99"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a100"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a101"></a> </div></li>
<li><div class="src-line"><a name="a102"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a103"></a><span class="src-doc"> * Gère les erreurs en les convertissant en exceptions (remplace la fonction gestion d'erreurs native de php)</span></div></li>
<li><div class="src-line"><a name="a104"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc-var">$niveau </span><span class="src-doc">le niveau de l'erreur</span></div></li>
<li><div class="src-line"><a name="a105"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$message </span><span class="src-doc">le message associé à l'erreur</span></div></li>
<li><div class="src-line"><a name="a106"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$fichier </span><span class="src-doc">le nom du fichier où l'erreur s'est produite</span></div></li>
<li><div class="src-line"><a name="a107"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">int </span><span class="src-doc-var">$ligne </span><span class="src-doc">la ligne où l'erreur s'est produite</span></div></li>
<li><div class="src-line"><a name="a108"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">string </span><span class="src-doc-var">$contexte </span><span class="src-doc">le contexte associé à l'erreur</span></div></li>
<li><div class="src-line"><a name="a109"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a110"></a> <span class="src-key">public </span><span class="src-key">static </span><span class="src-key">function </span><a href="../Framework/GestionnaireException.html#methodgererErreur">gererErreur</a><span class="src-sym">(</span><span class="src-var">$niveau</span><span class="src-sym">, </span><span class="src-var">$message</span><span class="src-sym">, </span><span class="src-var">$fichier</span><span class="src-sym">, </span><span class="src-var">$ligne</span><span class="src-sym">, </span><span class="src-var">$contexte</span><span class="src-sym">)</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a111"></a> <span class="src-comm">// si aucun rapport d'erreur, on sort directement</span></div></li>
<li><div class="src-line"><a name="a112"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/error_reporting">error_reporting</a><span class="src-sym">(</span><span class="src-sym">) </span>== <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a113"></a> <span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a114"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a115"></a> </div></li>
<li><div class="src-line"><a name="a116"></a> <span class="src-comm">// sinon on crée une exception</span></div></li>
<li><div class="src-line"><a name="a117"></a> <span class="src-var">$e </span>= <span class="src-key">new </span><span class="src-id">ErrorException</span><span class="src-sym">(</span><span class="src-var">$message</span><span class="src-sym">, </span><span class="src-num">0</span><span class="src-sym">, </span><span class="src-var">$niveau</span><span class="src-sym">, </span><span class="src-var">$fichier</span><span class="src-sym">, </span><span class="src-var">$ligne</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a118"></a> <span class="src-comm">// que l'on donne au tableau d'exceptions</span></div></li>
<li><div class="src-line"><a name="a119"></a> <span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$exceptions</span><span class="src-sym">[</span><span class="src-sym">] </span>= <span class="src-var">$e</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a120"></a> <span class="src-comm">// on la logge si nécéssaire</span></div></li>
<li><div class="src-line"><a name="a121"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$logger</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a122"></a> <span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">loggerException</span><span class="src-sym">(</span><span class="src-var">$e</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a123"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a124"></a> <span class="src-key">return</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a125"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a126"></a> </div></li>
<li><div class="src-line"><a name="a127"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a128"></a><span class="src-doc"> * Renvoie les exceptions au format (X)HTML</span></div></li>
<li><div class="src-line"><a name="a129"></a><span class="src-doc"> * ou bien au format texte suivant le mode d'utilisation de PHP</span></div></li>
<li><div class="src-line"><a name="a130"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a131"></a> <span class="src-key">public </span><span class="src-key">static </span><span class="src-key">function </span><a href="../Framework/GestionnaireException.html#methodgetExceptions">getExceptions</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a132"></a> <span class="src-var">$retour </span>= <span class="src-str">''</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a133"></a> <span class="src-key">foreach </span><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$exceptions </span><span class="src-key">as </span><span class="src-var">$cle </span>=> <span class="src-var">$e</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a134"></a> <span class="src-key">switch </span><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$mode</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a135"></a> <span class="src-key">case </span><span class="src-str">'cli' </span>:</div></li>
<li><div class="src-line"><a name="a136"></a> <span class="src-var">$retour </span>.= <span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getMessage</span><span class="src-sym">(</span><span class="src-sym">)</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a137"></a> <span class="src-var">$retour </span>.= <span class="src-str">'Fichier : '</span>.<span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getFile</span><span class="src-sym">(</span><span class="src-sym">)</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a138"></a> <span class="src-var">$retour </span>.= <span class="src-str">'Ligne : '</span>.<span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getLine</span><span class="src-sym">(</span><span class="src-sym">)</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a139"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">getContexte</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a140"></a> <span class="src-var">$retour </span>.= <span class="src-str">'Contexte : '</span>.<span class="src-str">"\n"</span>.<a href="http://www.php.net/print_r">print_r</a><span class="src-sym">(</span><span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getTraceAsString</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">)</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a141"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a142"></a> <span class="src-key">break</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a143"></a> <span class="src-key">default</span>:</div></li>
<li><div class="src-line"><a name="a144"></a> <span class="src-var">$retour </span>.= <span class="src-str">'<pre class="debogage">'</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a145"></a> <span class="src-var">$retour </span>.= <span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getMessage</span><span class="src-sym">(</span><span class="src-sym">)</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a146"></a> <span class="src-var">$retour </span>.= <span class="src-str">'<span class="debogage_fichier">'</span>.<span class="src-str">'Fichier : '</span>.<span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getFile</span><span class="src-sym">(</span><span class="src-sym">)</span>.<span class="src-str">'</span>'</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a147"></a> <span class="src-var">$retour </span>.= <span class="src-str">'<span class="debogage_ligne">'</span>.<span class="src-str">'Ligne : '</span>.<span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getLine</span><span class="src-sym">(</span><span class="src-sym">)</span>.<span class="src-str">'</span>'</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a148"></a> <span class="src-var">$retour </span>.= <span class="src-str">'</pre>'</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a149"></a> </div></li>
<li><div class="src-line"><a name="a150"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">getContexte</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a151"></a> <span class="src-var">$retour </span>.= <span class="src-str">'<pre>'</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a152"></a> <span class="src-var">$retour </span>.= <span class="src-str">'<strong>Contexte : </strong>'</span>.<span class="src-str">"\n"</span>.<a href="http://www.php.net/print_r">print_r</a><span class="src-sym">(</span><span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getTraceAsString</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">)</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a153"></a> <span class="src-var">$retour </span>.= <span class="src-str">'</pre>'</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a154"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a155"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a156"></a> <span class="src-comm">// Nous vidons le tableau des exceptions au fur et à mesure</span></div></li>
<li><div class="src-line"><a name="a157"></a> unset<span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$exceptions</span><span class="src-sym">[</span><span class="src-var">$cle</span><span class="src-sym">]</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a158"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a159"></a> <span class="src-key">return </span><span class="src-var">$retour</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a160"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a161"></a> </div></li>
<li><div class="src-line"><a name="a162"></a> <span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a163"></a><span class="src-doc"> * logge une exception donnée sous une forme lisible</span></div></li>
<li><div class="src-line"><a name="a164"></a><span class="src-doc"> * </span><span class="src-doc-coretag">@param </span><span class="src-doc-type">Exception </span><span class="src-doc"> </span><span class="src-doc-var">$e </span><span class="src-doc">l'exception à logger</span></div></li>
<li><div class="src-line"><a name="a165"></a><span class="src-doc"> */</span></div></li>
<li><div class="src-line"><a name="a166"></a> <span class="src-key">private </span><span class="src-key">static </span><span class="src-key">function </span><span class="src-id">loggerException</span><span class="src-sym">(</span><span class="src-var">$e</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a167"></a> <span class="src-var">$erreur </span>= <span class="src-str">''</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a168"></a> <span class="src-var">$erreur </span>.= <span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getMessage</span><span class="src-sym">(</span><span class="src-sym">)</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a169"></a> <span class="src-var">$erreur </span>.= <span class="src-str">'Fichier : '</span>.<span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getFile</span><span class="src-sym">(</span><span class="src-sym">)</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a170"></a> <span class="src-var">$erreur </span>.= <span class="src-str">'Ligne : '</span>.<span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getLine</span><span class="src-sym">(</span><span class="src-sym">)</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a171"></a> <span class="src-key">if </span><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">getContexte</span><span class="src-sym">(</span><span class="src-sym">)) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a172"></a> <span class="src-var">$erreur </span>.= <span class="src-str">'Contexte : '</span>.<span class="src-str">"\n"</span>.<a href="http://www.php.net/print_r">print_r</a><span class="src-sym">(</span><span class="src-var">$e</span><span class="src-sym">-></span><span class="src-id">getTraceAsString</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">, </span><span class="src-id">true</span><span class="src-sym">)</span>.<span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a173"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a174"></a> <span class="src-var">$erreur </span>.= <span class="src-str">"\n"</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a175"></a> <span class="src-id"><a href="../Framework/Log.html">Log</a></span><span class="src-sym">::</span><a href="../Framework/Log.html#methodajouterEntree">ajouterEntree</a><span class="src-sym">(</span><span class="src-str">'erreurs'</span><span class="src-sym">,</span><span class="src-var">$erreur</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a176"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a177"></a> </div></li>
<li><div class="src-line"><a name="a178"></a> <span class="src-key">public </span><span class="src-key">function </span><a href="../Framework/GestionnaireException.html#method__destruct">__destruct</a><span class="src-sym">(</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a179"></a> <span class="src-comm">// Si des erreurs n'ont pas été affichée nous forçons leur affichage</span></div></li>
<li><div class="src-line"><a name="a180"></a> <span class="src-key">if </span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$exceptions</span><span class="src-sym">) </span>> <span class="src-num">0</span><span class="src-sym">) </span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a181"></a> echo <span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">getExceptions</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a182"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a183"></a> <span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a184"></a> </div></li>
<li><div class="src-line"><a name="a185"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a186"></a><span class="src-php">?></span></div></li>
</ol></div>
</div>
<p class="notes" id="credit">
Documentation generated on Thu, 04 Mar 2010 19:27:23 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
</p>
</body>
</html>