public function mode($mode)
    {
        $acceptable_modes = [-1, 0, 1, 2];
        if (!in_array($mode, $acceptable_modes)) {
            throw new JSONLibraryException('bad_mode_set');
        }
        $this->mode = $mode;

        return $this;
    }