Code Duplication    Length = 4-5 lines in 3 locations

code/controllers/DMSDocumentCartController.php 3 locations

@@ 103-106 (lines=4) @@
100
            }
101
        }
102
103
        if ($request->isAjax()) {
104
            $this->response->addHeader('Content-Type', 'application/json');
105
            return Convert::raw2json(array('result' => $result, 'message' => $message));
106
        }
107
108
        if (!$result) {
109
            Session::set('dms-cart-validation-message', $message);
@@ 132-136 (lines=5) @@
129
        $this->getCart()->updateItemQuantity((int)$request->param('ID'), $quantity);
130
        $this->redirectBack();
131
132
        if ($request->isAjax()) {
133
            $this->response->addHeader('Content-Type', 'application/json');
134
135
            return Convert::raw2json(array('result' => true));
136
        }
137
        if ($backURL = $request->getVar('BackURL')) {
138
            return $this->redirect($backURL);
139
        }
@@ 155-159 (lines=5) @@
152
    {
153
        $this->getCart()->removeItemByID(intval($request->param('ID')));
154
155
        if ($request->isAjax()) {
156
            $this->response->addHeader('Content-Type', 'application/json');
157
158
            return Convert::raw2json(array('result' => !$this->getIsCartEmpty()));
159
        }
160
161
        return $this->redirectBack();
162
    }