/** * Creates an icon by the given values. * * @param WPSEO_Rank $rank The ranking object. * @param string $title Optional. The title to show. Defaults to the rank label. * * @return string The HTML for a score icon. */ private function create_score_icon(WPSEO_Rank $rank, $title = '') { if (empty($title)) { $title = $rank->get_label(); } return '<div aria-hidden="true" title="' . esc_attr($title) . '" class="wpseo-score-icon ' . esc_attr($rank->get_css_class()) . '"></div><span class="screen-reader-text">' . $title . '</span>'; }