Example #1
0
        return new APIResult(APIResult::STATUS_CALL_ERROR, $err_code);
    }
}
class APIError
{
    public static $REJ_NOT_LOGGED;
    public static $REJ_NO_ACTION;
    public static $REJ_WRONG_API;
    public static $REJ_WRONG_PARAMS;
    public static $ERR_GENERIC;
    public static function init()
    {
        APIError::$REJ_NOT_LOGGED = new APIError("Not logged");
        APIError::$REJ_NO_ACTION = new APIError("No action");
        APIError::$REJ_WRONG_API = new APIError("Wrong API");
        APIError::$REJ_WRONG_PARAMS = new APIError("Wrong parameters");
        APIError::$ERR_GENERIC = new APIError("Server error");
    }
    public $code;
    public $params;
    public function __construct($code, $params = null)
    {
        $this->code = $code;
        if ($params === null) {
            $this->params = array();
        }
        $this->params = $params;
    }
}
APIError::init();