X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=application%2Fapi%2Fcontrollers%2FHistory.php;h=4582e8b27f8597a1a03c482161c58a1febf7706d;hb=e1850388348d4bfdf463a5aa341bc470da79cf32;hp=da034eb226eceb276d2c5e65043aceedff0a15d8;hpb=813849e5216cb87121e0f778a734575be6a36052;p=github%2Fshaarli%2FShaarli.git diff --git a/application/api/controllers/History.php b/application/api/controllers/History.php index da034eb2..4582e8b2 100644 --- a/application/api/controllers/History.php +++ b/application/api/controllers/History.php @@ -29,15 +29,13 @@ class History extends ApiController public function getHistory($request, $response) { $history = $this->history->getHistory(); - $history = array_reverse($history); // Return history operations from the {offset}th, starting from {since}. $since = \DateTime::createFromFormat(\DateTime::ATOM, $request->getParam('since')); $offset = $request->getParam('offset'); if (empty($offset)) { $offset = 0; - } - else if (ctype_digit($offset)) { + } elseif (ctype_digit($offset)) { $offset = (int) $offset; } else { throw new ApiBadParametersException('Invalid offset'); @@ -47,7 +45,7 @@ class History extends ApiController $limit = $request->getParam('limit'); if (empty($limit)) { $limit = count($history); - } else if (ctype_digit($limit)) { + } elseif (ctype_digit($limit)) { $limit = (int) $limit; } else { throw new ApiBadParametersException('Invalid limit');