Subversion Repositories Applications.framework

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
297 jpm 1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
  <html xmlns="http://www.w3.org/1999/xhtml">
4
		<head>
5
			<!-- template designed by Marco Von Ballmoos  -->
6
			<title>File Source for Cli.php</title>
7
			<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
8
			<link rel="stylesheet" href="../media/stylesheet.css" />
9
											</head>
10
		<body>
11
						<h1>Source for file Cli.php</h1>
12
<p>Documentation is available at <a href="../Framework/_Cli.php.html">Cli.php</a></p>
13
<div class="src-code">
14
<div class="src-code"><ol><li><div class="src-line"><a name="a1"></a><span class="src-php">&lt;?php</span></div></li>
15
<li><div class="src-line"><a name="a2"></a><span class="src-comm">//&nbsp;declare(encoding='UTF-8');</span></div></li>
16
<li><div class="src-line"><a name="a3"></a><span class="src-doc">/**</span></div></li>
17
<li><div class="src-line"><a name="a4"></a><span class="src-doc">&nbsp;*&nbsp;CLI&nbsp;permet&nbsp;de&nbsp;récupérer&nbsp;les&nbsp;paramètres&nbsp;passés&nbsp;en&nbsp;ligne&nbsp;de&nbsp;commande&nbsp;pour&nbsp;instancier&nbsp;une&nbsp;classe&nbsp;héritant&nbsp;de&nbsp;la&nbsp;classe&nbsp;abstraite</span></div></li>
18
<li><div class="src-line"><a name="a5"></a><span class="src-doc">&nbsp;*&nbsp;Script.</span></div></li>
19
<li><div class="src-line"><a name="a6"></a><span class="src-doc">&nbsp;*&nbsp;Elle&nbsp;va&nbsp;déclencher&nbsp;l'éxecution&nbsp;du&nbsp;script&nbsp;via&nbsp;l'appel&nbsp;de&nbsp;la&nbsp;méthode&nbsp;executer().</span></div></li>
20
<li><div class="src-line"><a name="a7"></a><span class="src-doc">&nbsp;*&nbsp;C'est&nbsp;une&nbsp;Singleton.</span></div></li>
21
<li><div class="src-line"><a name="a8"></a><span class="src-doc">&nbsp;*</span></div></li>
22
<li><div class="src-line"><a name="a9"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@category</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;PHP&nbsp;5.2</span></div></li>
23
<li><div class="src-line"><a name="a10"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@package</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;Framework</span></div></li>
24
<li><div class="src-line"><a name="a11"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@author</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Jean-Pascal&nbsp;MILCENT&nbsp;&lt;jpm@tela-botanica.org&gt;</span></div></li>
25
<li><div class="src-line"><a name="a12"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@author</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Delphine&nbsp;CAUQUIL&nbsp;&lt;delphine@tela-botanica.org&gt;</span></div></li>
26
<li><div class="src-line"><a name="a13"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@copyright</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;Copyright&nbsp;(c)&nbsp;2010,&nbsp;Tela&nbsp;Botanica&nbsp;(accueil@tela-botanica.org)</span></div></li>
27
<li><div class="src-line"><a name="a14"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@license</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;http://www.gnu.org/licenses/gpl.html&nbsp;Licence&nbsp;GNU-GPL-v3</span></div></li>
28
<li><div class="src-line"><a name="a15"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@license</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt&nbsp;Licence&nbsp;CECILL-v2</span></div></li>
29
<li><div class="src-line"><a name="a16"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@since</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0.3</span></div></li>
300 jpm 30
<li><div class="src-line"><a name="a17"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@version</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;$Id:&nbsp;Cli.php&nbsp;299&nbsp;2011-01-18&nbsp;14:03:46Z&nbsp;jpm&nbsp;$</span></div></li>
297 jpm 31
<li><div class="src-line"><a name="a18"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@link</span><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/doc/framework/</span></div></li>
32
<li><div class="src-line"><a name="a19"></a><span class="src-doc">&nbsp;*/</span></div></li>
33
<li><div class="src-line"><a name="a20"></a>&nbsp;</div></li>
34
<li><div class="src-line"><a name="a21"></a><span class="src-key">class&nbsp;</span><a href="../Framework/Cli.html">Cli</a>&nbsp;<span class="src-sym">{</span></div></li>
35
<li><div class="src-line"><a name="a22"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
36
<li><div class="src-line"><a name="a23"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**&nbsp;Tableau&nbsp;des&nbsp;noms&nbsp;des&nbsp;paramètres&nbsp;à&nbsp;définir&nbsp;dans&nbsp;le&nbsp;fichier&nbsp;de&nbsp;config&nbsp;car&nbsp;obligatoirement&nbsp;nécessaire&nbsp;à&nbsp;cette&nbsp;classe.*/</span></div></li>
37
<li><div class="src-line"><a name="a24"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><span class="src-key">static&nbsp;</span><span class="src-var">$parametres_obligatoires&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'chemin_modules'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
38
<li><div class="src-line"><a name="a25"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
39
<li><div class="src-line"><a name="a26"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
40
<li><div class="src-line"><a name="a27"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-doc">/**</span></div></li>
41
<li><div class="src-line"><a name="a28"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Execute&nbsp;la&nbsp;ligne&nbsp;de&nbsp;commande&nbsp;en&nbsp;récupérant&nbsp;le&nbsp;nom&nbsp;du&nbsp;script&nbsp;à&nbsp;lancer&nbsp;et&nbsp;ses&nbsp;paramètres.</span></div></li>
42
<li><div class="src-line"><a name="a29"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;Instancie&nbsp;la&nbsp;classe&nbsp;du&nbsp;script&nbsp;à&nbsp;lancer&nbsp;et&nbsp;appelle&nbsp;la&nbsp;méthode&nbsp;executer().</span></div></li>
43
<li><div class="src-line"><a name="a30"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;</span><span class="src-doc-coretag">@return&nbsp;</span><span class="src-doc-type">void&nbsp;</span></div></li>
44
<li><div class="src-line"><a name="a31"></a><span class="src-doc">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span></div></li>
45
<li><div class="src-line"><a name="a32"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">public&nbsp;</span><span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><a href="../Framework/Cli.html#methodexecuter">executer</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
46
<li><div class="src-line"><a name="a33"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'argc'</span><span class="src-sym">]&nbsp;</span>&lt;&nbsp;<span class="src-num">2</span><span class="src-sym">)</span><span class="src-sym">{</span></div></li>
47
<li><div class="src-line"><a name="a34"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;Erreur:&nbsp;vous&nbsp;n'avez&nbsp;pas&nbsp;indiqué&nbsp;le&nbsp;nom&nbsp;du&nbsp;script.&nbsp;Voir&nbsp;'&quot;</span>.<span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'argv'</span><span class="src-sym">]</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span>.<span class="src-str">&quot;&nbsp;help'.\n&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_ERROR</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
48
<li><div class="src-line"><a name="a35"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
49
<li><div class="src-line"><a name="a36"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
50
<li><div class="src-line"><a name="a37"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Récupération&nbsp;de&nbsp;la&nbsp;ligne&nbsp;de&nbsp;commande</span></div></li>
51
<li><div class="src-line"><a name="a38"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$argv&nbsp;</span>=&nbsp;<span class="src-var">$_SERVER</span><span class="src-sym">[</span><span class="src-str">'argv'</span><span class="src-sym">]</span><span class="src-sym">;</span></div></li>
52
<li><div class="src-line"><a name="a39"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Nous&nbsp;dépilons&nbsp;le&nbsp;nom&nbsp;du&nbsp;fichier&nbsp;qui&nbsp;initialise&nbsp;le&nbsp;framework&nbsp;et&nbsp;appele&nbsp;cette&nbsp;méthode.</span></div></li>
53
<li><div class="src-line"><a name="a40"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/array_shift">array_shift</a><span class="src-sym">(</span><span class="src-var">$argv</span><span class="src-sym">)</span><span class="src-sym">;&nbsp;</span></div></li>
54
<li><div class="src-line"><a name="a41"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Nous&nbsp;dépilons&nbsp;le&nbsp;nom&nbsp;du&nbsp;script&nbsp;à&nbsp;lancer</span></div></li>
55
<li><div class="src-line"><a name="a42"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$script&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_shift">array_shift</a><span class="src-sym">(</span><span class="src-var">$argv</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
56
<li><div class="src-line"><a name="a43"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Récupération&nbsp;des&nbsp;paramètres&nbsp;d'execution&nbsp;du&nbsp;script</span></div></li>
57
<li><div class="src-line"><a name="a44"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parametres&nbsp;</span>=&nbsp;<span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">getParametres</span><span class="src-sym">(</span><span class="src-var">$argv</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
58
<li><div class="src-line"><a name="a45"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
59
<li><div class="src-line"><a name="a46"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Chargement&nbsp;du&nbsp;script&nbsp;à&nbsp;lancer</span></div></li>
60
<li><div class="src-line"><a name="a47"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Script&nbsp;</span>=&nbsp;<span class="src-id"><a href="../Framework/Cli.html">Cli</a></span><span class="src-sym">::</span><span class="src-id">charger</span><span class="src-sym">(</span><span class="src-var">$script</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parametres</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
61
<li><div class="src-line"><a name="a48"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/is_null">is_null</a><span class="src-sym">(</span><span class="src-var">$Script</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
62
<li><div class="src-line"><a name="a49"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Script</span><span class="src-sym">-&gt;</span><span class="src-id">executer</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
63
<li><div class="src-line"><a name="a50"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
64
<li><div class="src-line"><a name="a51"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
65
<li><div class="src-line"><a name="a52"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Affichage&nbsp;des&nbsp;exceptions&nbsp;et&nbsp;erreurs&nbsp;générées&nbsp;par&nbsp;le&nbsp;script</span></div></li>
66
<li><div class="src-line"><a name="a53"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-id"><a href="../Framework/GestionnaireException.html">GestionnaireException</a></span><span class="src-sym">::</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>
67
<li><div class="src-line"><a name="a54"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
68
<li><div class="src-line"><a name="a55"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Fin&nbsp;d'execution</span></div></li>
69
<li><div class="src-line"><a name="a56"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">exit</span><span class="src-sym">(</span><span class="src-num">0</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
70
<li><div class="src-line"><a name="a57"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
71
<li><div class="src-line"><a name="a58"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
72
<li><div class="src-line"><a name="a59"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><span class="src-id">charger</span><span class="src-sym">(</span><span class="src-var">$script_nom</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parametres</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
73
<li><div class="src-line"><a name="a60"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Script&nbsp;</span>=&nbsp;<span class="src-id">null</span><span class="src-sym">;</span></div></li>
74
<li><div class="src-line"><a name="a61"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-id"><a href="../Framework/Config.html">Config</a></span><span class="src-sym">::</span><a href="../Framework/Config.html#methodverifierPresenceParametres">verifierPresenceParametres</a><span class="src-sym">(</span><span class="src-id">self</span><span class="src-sym">::</span><span class="src-var">$parametres_obligatoires</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
75
<li><div class="src-line"><a name="a62"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
76
<li><div class="src-line"><a name="a63"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$classe_nom&nbsp;</span>=&nbsp;<span class="src-id">self</span><span class="src-sym">::</span><span class="src-id">obtenirNomClasse</span><span class="src-sym">(</span><span class="src-var">$script_nom</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
77
<li><div class="src-line"><a name="a64"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$dossier_nom&nbsp;</span>=&nbsp;<a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$script_nom</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
78
<li><div class="src-line"><a name="a65"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$fichier_script&nbsp;</span>=&nbsp;<span class="src-id"><a href="../Framework/Config.html">Config</a></span><span class="src-sym">::</span><a href="../Framework/Config.html#methodget">get</a><span class="src-sym">(</span><span class="src-str">'chemin_modules'</span><span class="src-sym">)</span>.<span class="src-var">$dossier_nom</span>.<span class="src-id">DS</span>.<span class="src-var">$classe_nom</span>.<span class="src-str">'.php'</span><span class="src-sym">;</span></div></li>
79
<li><div class="src-line"><a name="a66"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
80
<li><div class="src-line"><a name="a67"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/file_exists">file_exists</a><span class="src-sym">(</span><span class="src-var">$fichier_script</span><span class="src-sym">))</span><span class="src-sym">{</span></div></li>
81
<li><div class="src-line"><a name="a68"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">Erreur&nbsp;:&nbsp;script&nbsp;'<span class="src-var">$fichier_script</span>'&nbsp;inconnu!\n</span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_ERROR</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
82
<li><div class="src-line"><a name="a69"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
83
<li><div class="src-line"><a name="a70"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-inc">require_once&nbsp;</span><span class="src-var">$fichier_script</span><span class="src-sym">;</span></div></li>
84
<li><div class="src-line"><a name="a71"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span><a href="http://www.php.net/class_exists">class_exists</a><span class="src-sym">(&nbsp;</span><span class="src-var">$classe_nom</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
85
<li><div class="src-line"><a name="a72"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;</span><span class="src-str">Erreur:&nbsp;impossible&nbsp;de&nbsp;trouver&nbsp;la&nbsp;classe&nbsp;de&nbsp;la&nbsp;commande&nbsp;:&nbsp;<span class="src-var">$classe_nom</span>\n</span><span class="src-str">&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_ERROR</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
86
<li><div class="src-line"><a name="a73"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
87
<li><div class="src-line"><a name="a74"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$Script&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-var">$classe_nom</span><span class="src-sym">(</span><span class="src-var">$script_nom</span><span class="src-sym">,&nbsp;</span><span class="src-var">$parametres</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
88
<li><div class="src-line"><a name="a75"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
89
<li><div class="src-line"><a name="a76"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
90
<li><div class="src-line"><a name="a77"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$Script</span><span class="src-sym">;</span></div></li>
91
<li><div class="src-line"><a name="a78"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
92
<li><div class="src-line"><a name="a79"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
93
<li><div class="src-line"><a name="a80"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><span class="src-id">obtenirNomClasse</span><span class="src-sym">(</span><span class="src-var">$script_nom</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
94
<li><div class="src-line"><a name="a81"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$nom_classe&nbsp;</span>=&nbsp;<a href="http://www.php.net/implode">implode</a><span class="src-sym">(</span><span class="src-str">''</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/array_map">array_map</a><span class="src-sym">(</span><span class="src-str">'ucfirst'</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/explode">explode</a><span class="src-sym">(</span><span class="src-str">'_'</span><span class="src-sym">,&nbsp;</span><a href="http://www.php.net/strtolower">strtolower</a><span class="src-sym">(</span><span class="src-var">$script_nom</span><span class="src-sym">))))</span><span class="src-sym">;</span></div></li>
95
<li><div class="src-line"><a name="a82"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$nom_classe</span><span class="src-sym">;</span></div></li>
96
<li><div class="src-line"><a name="a83"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
97
<li><div class="src-line"><a name="a84"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
98
<li><div class="src-line"><a name="a85"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">private&nbsp;</span><span class="src-key">static&nbsp;</span><span class="src-key">function&nbsp;</span><span class="src-id">getParametres</span><span class="src-sym">(</span><span class="src-var">$argv</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
99
<li><div class="src-line"><a name="a86"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parametres&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
100
<li><div class="src-line"><a name="a87"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;Récupération&nbsp;des&nbsp;options</span></div></li>
101
<li><div class="src-line"><a name="a88"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">while&nbsp;</span><span class="src-sym">(</span><a href="http://www.php.net/count">count</a><span class="src-sym">(</span><span class="src-var">$argv</span><span class="src-sym">))&nbsp;</span><span class="src-sym">{</span></div></li>
102
<li><div class="src-line"><a name="a89"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if&nbsp;</span><span class="src-sym">(</span>isset<span class="src-sym">(</span><span class="src-var">$argv</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>&amp;&amp;&nbsp;<span class="src-var">$argv</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">{</span><span class="src-num">0</span><span class="src-sym">}&nbsp;</span>!=&nbsp;<span class="src-str">'-'</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
103
<li><div class="src-line"><a name="a90"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$param&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_shift">array_shift</a><span class="src-sym">(</span><span class="src-var">$argv</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
104
<li><div class="src-line"><a name="a91"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parametres</span><span class="src-sym">[</span><span class="src-var">$param</span><span class="src-sym">]&nbsp;</span>=&nbsp;<a href="http://www.php.net/array_shift">array_shift</a><span class="src-sym">(</span><span class="src-var">$argv</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
105
<li><div class="src-line"><a name="a92"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">elseif&nbsp;</span><span class="src-sym">(</span><span class="src-sym">!</span>isset<span class="src-sym">(</span><span class="src-var">$argv</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">)&nbsp;</span>||&nbsp;<span class="src-var">$argv</span><span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span><span class="src-sym">{</span><span class="src-num">0</span><span class="src-sym">}&nbsp;</span>==&nbsp;<span class="src-str">'-'</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
106
<li><div class="src-line"><a name="a93"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$parametres</span><span class="src-sym">[</span><a href="http://www.php.net/array_shift">array_shift</a><span class="src-sym">(</span><span class="src-var">$argv</span><span class="src-sym">)</span><span class="src-sym">]&nbsp;</span>=&nbsp;<span class="src-id">null</span><span class="src-sym">;</span></div></li>
107
<li><div class="src-line"><a name="a94"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
108
<li><div class="src-line"><a name="a95"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/trigger_error">trigger_error</a><span class="src-sym">(</span><span class="src-str">&quot;Erreur:&nbsp;valeur&nbsp;manquante&nbsp;pour&nbsp;le&nbsp;paramêtre&nbsp;'&quot;</span>.<span class="src-var">$argv</span><span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span>.<span class="src-str">&quot;'&nbsp;\n&quot;</span><span class="src-sym">,&nbsp;</span><span class="src-id">E_USER_ERROR</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
109
<li><div class="src-line"><a name="a96"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
110
<li><div class="src-line"><a name="a97"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
111
<li><div class="src-line"><a name="a98"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">return&nbsp;</span><span class="src-var">$parametres</span><span class="src-sym">;</span></div></li>
112
<li><div class="src-line"><a name="a99"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
113
<li><div class="src-line"><a name="a100"></a><span class="src-sym">}</span></div></li>
114
<li><div class="src-line"><a name="a101"></a><span class="src-php">?&gt;</span></div></li>
115
</ol></div>
116
</div>
117
	<p class="notes" id="credit">
300 jpm 118
		Documentation generated on Tue, 18 Jan 2011 15:13:11 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.3</a>
297 jpm 119
	</p>
120
	</body>
121
</html>