Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/view/PHUIDiffTableOfContentsItemView.php
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | public function renderChangesetLines() { | ||||
return pht('%d line(s)', $line_count); | return pht('%d line(s)', $line_count); | ||||
} | } | ||||
public function renderCoverage() { | public function renderCoverage() { | ||||
$not_applicable = '-'; | $not_applicable = '-'; | ||||
$coverage = $this->getCoverage(); | $coverage = $this->getCoverage(); | ||||
if (!strlen($coverage)) { | if ($coverage === null || !strlen($coverage)) { | ||||
return $not_applicable; | return $not_applicable; | ||||
} | } | ||||
$covered = substr_count($coverage, 'C'); | $covered = substr_count($coverage, 'C'); | ||||
$not_covered = substr_count($coverage, 'U'); | $not_covered = substr_count($coverage, 'U'); | ||||
if (!$not_covered && !$covered) { | if (!$not_covered && !$covered) { | ||||
return $not_applicable; | return $not_applicable; | ||||
} | } | ||||
return sprintf('%d%%', 100 * ($covered / ($covered + $not_covered))); | return sprintf('%d%%', 100 * ($covered / ($covered + $not_covered))); | ||||
} | } | ||||
public function renderModifiedCoverage() { | public function renderModifiedCoverage() { | ||||
$not_applicable = '-'; | $not_applicable = '-'; | ||||
$coverage = $this->getCoverage(); | $coverage = $this->getCoverage(); | ||||
if (!strlen($coverage)) { | if ($coverage === null || !strlen($coverage)) { | ||||
return $not_applicable; | return $not_applicable; | ||||
} | } | ||||
if ($this->getIsVisible()) { | if ($this->getIsVisible()) { | ||||
$label = pht('Loading...'); | $label = pht('Loading...'); | ||||
} else { | } else { | ||||
$label = pht('?'); | $label = pht('?'); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |