Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F12656527
ArcanistCommentRemover.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
661 B
Referenced Files
None
Subscribers
None
ArcanistCommentRemover.php
View Options
<?php
final
class
ArcanistCommentRemover
{
/**
* 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
)
{
$lines
=
explode
(
"
\n
"
,
$body
);
$lines
=
array_reverse
(
$lines
);
foreach
(
$lines
as
$key
=>
$line
)
{
if
(!
strlen
(
$line
))
{
unset
(
$lines
[
$key
]);
continue
;
}
if
(
$line
[
0
]
==
'#'
)
{
unset
(
$lines
[
$key
]);
continue
;
}
break
;
}
$lines
=
array_reverse
(
$lines
);
return
implode
(
"
\n
"
,
$lines
).
"
\n
"
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Nov 28, 15:12 (1 d, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1049667
Default Alt Text
ArcanistCommentRemover.php (661 B)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline
Log In to Comment