Function calculatePageRange
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function calculatePageRange($recordCount)
{
$rangeInfo = [];
$pageLimit = $this->getPageLimit();
$this->set('prevPageExists', true);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method calculatePageRange uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
//Disable previous page only if page is first page and no records exists
if (1 === $this->getCurrentPage()) {
$this->set('prevPageExists', false);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Config' in method 'getPageLimit'. Open
$pageLimit = \App\Config::main('list_max_entries_per_page');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method calculatePageRange uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$rangeInfo['end'] = $prevPageLastRecordSequence + $pageLimit;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method getPageCount uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$pageCount = $this->get('page');
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Define a constant instead of duplicating this literal "start" 3 times. Open
return $rangeInfo['start'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "prevPageExists" 5 times. Open
if ($this->has('prevPageExists')) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "range" 4 times. Open
if ($this->has('range')) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "totalCount" 3 times. Open
if ($this->has('totalCount')) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "noOfEntries" 3 times. Open
return $this->getPageLimit() * ((int) $this->getCurrentPage() - 1) + (int) $this->get('noOfEntries');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "nextPageExists" 4 times. Open
if ($this->has('nextPageExists')) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Saw unextractable annotation for comment '* @return <integer>'</integer>
Open
* @return <Integer>
- Exclude checks
Saw unextractable annotation for comment '* @return <number>'</number>
Open
* @return <Number>
- Exclude checks
Saw unextractable annotation for comment '* @return <integer>'</integer>
Open
* @return <Integer>
- Exclude checks
Saw unextractable annotation for comment '* @return <number>'</number>
Open
* @return <Number>
- Exclude checks
Saw unextractable annotation for comment '* @return <array> - array of values'</array>
Open
* @return <array> - array of values
- Exclude checks
Saw unextractable annotation for comment '* @return <int> - Number of pages'</int>
Open
* @return <int> - Number of pages
- Exclude checks
Saw unextractable annotation for comment '* @return <int> - number of page'</int>
Open
* @return <int> - number of page
- Exclude checks
Saw unextractable annotation for comment '* @return <number>'</number>
Open
* @return <Number>
- Exclude checks
Avoid excessively long variable names like $prevPageLastRecordSequence. Keep variable name length under 20. Open
$prevPageLastRecordSequence = (($this->getCurrentPage() - 1) * $pageLimit);
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Vtiger_Paging_Model extends \App\Base
- Exclude checks
The class Vtiger_Paging_Model is not named in CamelCase. Open
class Vtiger_Paging_Model extends \App\Base
{
const DEFAULT_PAGE = 1;
const PAGE_LIMIT = 20;
const PAGE_MAX_LIMIT = 9999999;
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentPage = $this->get('page');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCurrentPage()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $rangeInfo['start'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const DEFAULT_PAGE = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the current page number.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Number>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($pageLimit)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rangeInfo = $this->getRecordRange();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Next page number.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->has('range')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <array> - array of values
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $currentPage;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageLimit = $this->getPageLimit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ($currentPage - 1) * $pageLimit;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getRecordStartRange()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Integer>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getRecordEndRange()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getRecordRange()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getNextPage()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the limit on the number of records per page.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageLimit = \App\Config::main('list_max_entries_per_page');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($pageLimit)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Retrieves start and end sequence number of records in the page.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($currentPage)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentPage = self::DEFAULT_PAGE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($currentPage)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageLimit = self::PAGE_LIMIT;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getPageLimit() * ((int) $this->getCurrentPage() - 1) + (int) $this->get('noOfEntries');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Number>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentPage = $this->get('page');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getPageLimit()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageLimit = $this->get('limit');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const PAGE_LIMIT = 20;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const PAGE_MAX_LIMIT = 9999999;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getStartIndex()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rangeInfo = $this->getRecordRange();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Number>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (int) $pageLimit;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentPage = $this->getCurrentPage();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Retrieves start sequence number of records in the page.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getPageLimit() * ((int) $this->getCurrentPage() - 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Retrieves end sequence number of records in the page.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Integer>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $rangeInfo['end'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordCount > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rangeInfo['start'] = $prevPageLastRecordSequence + 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to return the page number where pagination begins.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* - start key which gives start sequence number
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageLimit = $this->getPageLimit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('prevPageExists', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('prevPageExists', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('prevPageExists', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to return info about the number of pages.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageLimit = $this->getPageLimit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to specify if previous page exists.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->has('nextPageExists')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('nextPageExists', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getPageCount()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($pageNumber == $totalCount && 1 != $pageNumber) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $startPaginFrom;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Have less number of records than the page limit
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Disable previous page only if page is first page and no records exists
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageNumber = $this->get('page');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startPaginFrom = $pageNumber - 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentPage = self::DEFAULT_PAGE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $currentPage + 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->has('range')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* - end key which gives end sequence number
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$prevPageLastRecordSequence = (($this->getCurrentPage() - 1) * $pageLimit);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $pageCount;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startPaginFrom = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('range', $rangeInfo);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->has('totalCount')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageCount = $this->get('page');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->has('prevPageExists')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordCount
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rangeInfo['end'] = $prevPageLastRecordSequence + $pageLimit;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getStartPagingFrom()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('range');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('nextPageExists', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('nextPageExists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Vtiger_Paging_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isNextPageExists()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->has('noOfEntries')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordCount < $pageLimit) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$totalCount = $this->get('totalCount');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* calculates page range.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function calculatePageRange($recordCount)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isPrevPageExists()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to specify if next page exists.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('noOfEntries') == $this->getPageLimit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rangeInfo = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rangeInfo['end'] = $prevPageLastRecordSequence + $recordCount;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (0 == $pageCount) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 === $this->getCurrentPage()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <int> - Number of pages
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$totalCount = $this->get('totalCount');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startPaginFrom = $pageNumber - 4;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($startPaginFrom <= 0 || 1 == $pageNumber) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 === $rangeInfo['start']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageCount = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('prevPageExists');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pageCount = ceil($totalCount / (int) $pageLimit);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//specifies what sequencce number of last record in prev page
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <int> - number of page
- Exclude checks
Class name "Vtiger_Paging_Model" is not in camel caps format Open
class Vtiger_Paging_Model extends \App\Base
- Exclude checks