You are here

public function YoastSeoManager::getScoreStatus in Real-time SEO for Drupal 8

Get the status for a given score.

Parameters

int $score: Score in points.

Return value

string Status corresponding to the score.

1 call to YoastSeoManager::getScoreStatus()
YoastSeoManager::getOverallScoreMarkup in src/YoastSeoManager.php
Get Markup for the overall score.

File

src/YoastSeoManager.php, line 335

Class

YoastSeoManager
Class YoastSeoManager.

Namespace

Drupal\yoast_seo

Code

public function getScoreStatus($score) {
  $rules = $this
    ->getScoreToStatusRules();
  $default = $rules['default'];
  unset($rules['default']);
  foreach ($rules as $status => $status_rules) {
    $min_max_isset = isset($status_rules['min']) && isset($status_rules['max']);
    if (isset($status_rules['equal']) && $status_rules['equal'] == $score) {
      return $status;
    }
    elseif ($min_max_isset && $score > $status_rules['min'] && $score <= $status_rules['max']) {
      return $status;
    }
  }
  return $default;
}