2016-02-04 20:15:43 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace manager;
|
|
|
|
|
|
|
|
|
2016-02-04 22:45:03 +00:00
|
|
|
class ManagerError{
|
2016-02-04 20:15:43 +00:00
|
|
|
|
|
|
|
/* SUCCESS */
|
2016-02-04 22:45:03 +00:00
|
|
|
const Success = 0;
|
2016-02-04 20:15:43 +00:00
|
|
|
|
|
|
|
/* Parsage json */
|
2016-02-04 22:45:03 +00:00
|
|
|
const ParsingFailed = 1;
|
2016-02-04 20:15:43 +00:00
|
|
|
|
|
|
|
/* ResourceDispatcher */
|
|
|
|
|
|
|
|
// Drapeaux invalides
|
2016-02-04 22:45:03 +00:00
|
|
|
const InvalidFlags = 2;
|
2016-02-04 20:15:43 +00:00
|
|
|
|
|
|
|
// Fichier inexistant
|
2016-02-04 22:45:03 +00:00
|
|
|
const UnreachableResource = 3;
|
2016-02-04 20:15:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* ModuleRequest */
|
|
|
|
|
|
|
|
// Le @path n'est pas renseigne
|
2016-02-04 22:45:03 +00:00
|
|
|
const MissingPath = 4;
|
2016-02-04 20:15:43 +00:00
|
|
|
|
|
|
|
// Verification de la coherence du chemin (existe dans la conf)
|
2016-02-11 09:34:26 +00:00
|
|
|
const WrongPathModule = 5;
|
2016-02-04 20:15:43 +00:00
|
|
|
|
|
|
|
// Module non specifie dans la conf
|
2016-02-11 09:34:26 +00:00
|
|
|
const UnknownModule = 6;
|
2016-02-04 20:15:43 +00:00
|
|
|
|
|
|
|
// Methode non specifie pour ce Module dans la conf
|
2016-02-11 09:34:26 +00:00
|
|
|
const UnknownMethod = 7;
|
2016-02-04 20:15:43 +00:00
|
|
|
|
|
|
|
// Methode inamorcable
|
2016-02-11 09:34:26 +00:00
|
|
|
const UncallableMethod = 8;
|
|
|
|
|
|
|
|
/* Repo */
|
|
|
|
|
|
|
|
// Verification de la coherence du chemin (existe dans la conf)
|
|
|
|
const WrongPathRepo = 9;
|
2016-02-04 22:45:03 +00:00
|
|
|
|
2016-02-11 09:34:26 +00:00
|
|
|
// Module non specifie dans la conf
|
|
|
|
const UnknownRepo = 10;
|
2016-02-04 22:45:03 +00:00
|
|
|
|
2016-02-12 21:07:46 +00:00
|
|
|
/* Database */
|
|
|
|
|
|
|
|
// Erreur lors de la creation d'un objet PDO (connection)
|
|
|
|
const PDOConnection = 11;
|
|
|
|
|
2016-02-04 22:45:03 +00:00
|
|
|
|
|
|
|
/* EXPLICITE UN CODE D'ERREUR
|
|
|
|
*
|
|
|
|
* @error<Integer> Code d'erreur
|
|
|
|
*
|
|
|
|
* @return explicit<String> Description explicite du code d'erreur
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public static function explicit($error){
|
|
|
|
switch($error){
|
|
|
|
case self::Success: return "Tout s'est bien deroule"; break;
|
|
|
|
case self::ParsingFailed: return "La lecture du fichier JSON a echoue"; break;
|
|
|
|
case self::InvalidFlags: return "Les specifications (drapeaux) sont incorrects"; break;
|
|
|
|
case self::UnreachableResource: return "La ressource n'existe pas (404)"; break;
|
|
|
|
case self::MissingPath: return "Le chemin de delegation n'a pas ete renseigne"; break;
|
2016-02-11 09:34:26 +00:00
|
|
|
case self::WrongPathModule: return "Le chemin de delegation est incorrect ('nomModule/nomMethode')"; break;
|
|
|
|
case self::WrongPathRepo: return "Le chemin de delegation est incorrect ('nomRepo/nomMethode')"; break;
|
2016-02-04 22:45:03 +00:00
|
|
|
case self::UnknownModule: return "Le module n'existe pas"; break;
|
2016-02-11 09:34:26 +00:00
|
|
|
case self::UnknownRepo: return "Le repo n'existe pas"; break;
|
2016-02-04 22:45:03 +00:00
|
|
|
case self::UnknownMethod: return "Le methode n'existe pas"; break;
|
|
|
|
case self::UncallableMethod: return "Le methode n'est pas amorcable"; break;
|
2016-02-12 21:07:46 +00:00
|
|
|
case self::PDOConnection: return "La connexion avec la base de donnees a echoue"; break;
|
2016-02-11 09:34:26 +00:00
|
|
|
|
|
|
|
default: return "Erreur inconnue..."; break;
|
2016-02-04 22:45:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 'Aucune erreur trouvee';
|
|
|
|
}
|
2016-02-04 20:15:43 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|