You are here

protected function EntityPagerAdvice::runAdviceLogic in Entity Pager 7

Run advice logic.

Run the logic that manages performance advice.

Parameters

string $advice_type: The type of advice.

string $issue: The specific issue.

2 calls to EntityPagerAdvice::runAdviceLogic()
EntityPagerOut::calculateNextAllPrevValuesFromView in includes/EntityPagerOut.inc
Calculate the values for the links.
EntityPagerOut::getEntityPager in includes/EntityPagerOut.inc
Entity Pager return links.

File

includes/EntityPagerAdvice.inc, line 68
A class to manage advice when using the Entity Pager module.

Class

EntityPagerAdvice
Class EntityPagerAdvice.

Code

protected function runAdviceLogic($advice_type, $issue) {
  if ($this
    ->checkPerformance()) {

    // Log performance suggestions.
    if ($advice_type == 'quantity') {

      // Coding note:  ideally nested 'if' statements should be avoided,
      // but the whole purpose of this little logic method is to sort
      // the logic in one manageable place. The if statements are simple
      // (single purpose) meaning they are easy to work down logically.
      if ($this
        ->getViewResultCount() > 500) {
        if ($this
          ->viewsCachingUsed()) {

          // Do nothing.
        }
        else {
          $this
            ->logAdvice($advice_type, $issue);
        }
      }
    }
    else {
      $this
        ->logAdvice($advice_type, $issue);
    }
  }
}