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;
|
|
|
|
|
2016-02-12 23:04:00 +00:00
|
|
|
// Erreur de parametre(s)
|
|
|
|
const ParamError = 9;
|
|
|
|
|
2016-02-11 09:34:26 +00:00
|
|
|
/* Repo */
|
|
|
|
|
|
|
|
// Verification de la coherence du chemin (existe dans la conf)
|
2016-02-12 23:04:00 +00:00
|
|
|
const WrongPathRepo = 10;
|
2016-02-04 22:45:03 +00:00
|
|
|
|
2016-02-11 09:34:26 +00:00
|
|
|
// Module non specifie dans la conf
|
2016-02-12 23:04:00 +00:00
|
|
|
const UnknownRepo = 11;
|
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)
|
2016-02-12 23:04:00 +00:00
|
|
|
const PDOConnection = 12;
|
2016-02-12 21:07:46 +00:00
|
|
|
|
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 23:04:00 +00:00
|
|
|
case self::ParamError: return "Un ou plusieurs parametres sont manquants ou incorrects"; 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
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|