géré en js /* EXPLICITE UN CODE D'ERREUR * * @error Code d'erreur * * @return explicit Description explicite du code d'erreur * */ public static function explicit($error){ switch($error){ case self::Success: return "All right man!"; break; case self::ParsingFailed: return "Parsing failed (json, xml, etc). Check your format."; break; case self::InvalidFlags: return "You sent invalid flags."; break; case self::UnreachableResource: return "Resource unreachable."; break; case self::MissingPath: return "The @path is missing"; break; case self::WrongPathModule: return "Invalid @path ('moduleName/methodName')."; break; case self::WrongPathRepo: return "Invalid @path ('repoName/methodName')."; break; case self::UnknownModule: return "Module not found."; break; case self::UnknownRepo: return "Repository not found."; break; case self::UnknownMethod: return "The method doesn't exist."; break; case self::UncallableMethod: return "The method can't be called."; break; case self::ParamError: return "Missing or wrong arguments."; break; case self::ModuleError: return "Module error."; break; case self::RepoError: return "Repository error."; break; case self::PDOConnection: return "Database connection failed."; break; case self::TokenError: return "Missing or wrong token."; break; case self::PermissionError: return "Permission denied."; break; case self::UploadError: return "Upload error"; break; case self::FormatError: return "Format error."; break; case self::CyclicHashExpired: return "Cyclic hash has to be renewed."; break; default: return "Unknown Error..."; break; } // Erreur inconnue return null; } public static function setHttpCode($error){ http_response_code( $error == self::Success ? 200 : 417 ); } } ?>