1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-16 11:52:40 +01:00
phorge-phorge/src/applications/differential/render/DifferentialChangesetTestRenderer.php
Joshua Spence 0a62f13464 Change double quotes to single quotes.
Summary: Ran `arc lint --apply-patches --everything` over rP, mainly to change double quotes to single quotes where appropriate. These changes also validate that the `ArcanistXHPASTLinter::LINT_DOUBLE_QUOTE` rule is working as expected.

Test Plan: Eyeballed it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin, hach-que

Differential Revision: https://secure.phabricator.com/D9431
2014-06-09 11:36:50 -07:00

86 lines
2.2 KiB
PHP

<?php
abstract class DifferentialChangesetTestRenderer
extends DifferentialChangesetRenderer {
protected function renderChangeTypeHeader($force) {
$changeset = $this->getChangeset();
$old = nonempty($changeset->getOldFile(), '-');
$away = nonempty(implode(', ', $changeset->getAwayPaths()), '-');
$ctype = $changeset->getChangeType();
$ftype = $changeset->getFileType();
$force = ($force ? '(forced)' : '(unforced)');
return "CTYPE {$ctype} {$ftype} {$force}\n".
"{$old}\n".
"{$away}\n";
}
public function renderShield($message, $force = 'default') {
return "SHIELD ({$force}) {$message}\n";
}
protected function renderPropertyChangeHeader() {
$changeset = $this->getChangeset();
$old = $changeset->getOldProperties();
$new = $changeset->getNewProperties();
if (!$old && !$new) {
return null;
}
$props = '';
foreach ($old as $key => $value) {
$props .= "P - {$key} {$value}~\n";
}
foreach ($new as $key => $value) {
$props .= "P + {$key} {$value}~\n";
}
return "PROPERTIES\n".$props;
}
public function renderTextChange(
$range_start,
$range_len,
$rows) {
$out = array();
$primitives = $this->buildPrimitives($range_start, $range_len);
foreach ($primitives as $p) {
$type = $p['type'];
switch ($type) {
case 'old':
case 'new':
$num = nonempty($p['line'], '-');
$render = $p['render'];
$htype = nonempty($p['htype'], '.');
// TODO: This should probably happen earlier, whenever we deal with
// \r and \t normalization?
$render = rtrim($render, "\r\n");
$t = ($type == 'old') ? 'O' : 'N';
$out[] = "{$t} {$num} {$htype} {$render}~";
break;
default:
$out[] = $type;
break;
}
}
$out = implode("\n", $out)."\n";
return $out;
}
public function renderFileChange($old_file = null,
$new_file = null,
$id = 0,
$vs = 0) {
throw new Exception('Not implemented!');
}
}