--- /dev/null
+<?php
+
+class AlloAgent {
+
+ private $allo_serveur_url;
+
+ public function __construct($allo_serveur_url){
+ $this->allo_serveur_url = $allo_serveur_url;
+ }
+
+
+ public function go($argv){
+
+ if (count($argv) >= 2) {
+ $commande = $argv[1];
+ } else {
+ $commande = "help";
+ }
+
+ if (count($argv)>=3){
+ $login = $argv[2];
+ } else {
+ $login = false;
+ }
+
+ /** @var Command $commandClass */
+ $commandClass = ucfirst("{$commande}Command");
+
+ if (! stream_resolve_include_path($commandClass.".class.php")){
+ echo "$commande : commande inconnue\n";
+ return;
+ }
+
+ try {
+ $commandClass = new $commandClass($this->allo_serveur_url,$login);
+ if ($commandClass->needLogin()) {
+ $commandClass->login($login);
+ }
+ $commandClass->go();
+ } catch (Exception $e){
+ echo "[ERREUR] {$e->getMessage()}\n";
+ }
+ }
+
+
+}
+
+