Files
piratepoet/lib/Listing/PageLimit.php
Jan Jakeš 54549ff037 Convert variable names to camel case
[MAILPOET-1796]
2020-01-14 15:22:42 +01:00

30 lines
621 B
PHP

<?php
namespace MailPoet\Listing;
use MailPoet\WP\Functions as WPFunctions;
class PageLimit {
const DEFAULT_LIMIT_PER_PAGE = 20;
/** @var WPFunctions */
private $wp;
public function __construct(WPFunctions $wp) {
$this->wp = $wp;
}
public function getLimitPerPage($model = null) {
if ($model === null) {
return self::DEFAULT_LIMIT_PER_PAGE;
}
$listingPerPage = $this->wp->getUserMeta(
$this->wp->getCurrentUserId(), 'mailpoet_' . $model . '_per_page', true
);
return (!empty($listingPerPage))
? (int)$listingPerPage
: self::DEFAULT_LIMIT_PER_PAGE;
}
}