Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
samdark committed Jun 5, 2024
1 parent 890eb3a commit cf7139c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion framework/data/ActiveDataProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ protected function prepareTotalCount()
$query = (clone $this->query)->limit(-1)->offset(-1)->orderBy([]);
$key = md5((string)$query);

if (isset($this->_totalCount[$key]) === false) {
if (!array_key_exists($key, $this->_totalCount)) {
$this->_totalCount[$key] = (int)$query->count('*', $this->db);
}
return $this->_totalCount[$key];
Expand Down
4 changes: 2 additions & 2 deletions framework/data/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class Pagination extends BaseObject implements Linkable
*/
private $_pageSize;
/**
* @var Closure|int return total number of items.
* @var Closure|int total number of items or closure returning it.
*/
private $_totalCount = 0;

Expand Down Expand Up @@ -353,7 +353,7 @@ public function getTotalCount()
if (is_numeric($this->_totalCount)) {
return (int)$this->_totalCount;
}
return (int)call_user_func($this->_totalCount);
return (int)$this->_totalCount();
}

/**
Expand Down

0 comments on commit cf7139c

Please sign in to comment.