Page MenuHomeSealhub

ArcanistCommentRemover.php
No OneTemporary

Authored By
Unknown
Size
688 B
Referenced Files
None
Subscribers
None

ArcanistCommentRemover.php

<?php
final class ArcanistCommentRemover extends Phobject {
/**
* Remove comment lines from a commit message. Strips trailing lines only,
* and requires "#" to appear at the beginning of a line for it to be
* considered a comment.
*/
public static function removeComments($body) {
$body = rtrim($body);
$lines = phutil_split_lines($body);
$lines = array_reverse($lines);
foreach ($lines as $key => $line) {
if (preg_match('/^#/', $line)) {
unset($lines[$key]);
continue;
}
break;
}
$lines = array_reverse($lines);
$lines = implode('', $lines);
$lines = rtrim($lines)."\n";
return $lines;
}
}

File Metadata

Mime Type
text/x-php
Expires
Fri, Nov 27, 16:17 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1217262
Default Alt Text
ArcanistCommentRemover.php (688 B)

Event Timeline