1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-21 19:19:12 +01:00
phorge-phorge/src/applications/diviner/atomizer/DivinerArticleAtomizer.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

35 lines
966 B
PHP

<?php
final class DivinerArticleAtomizer extends DivinerAtomizer {
protected function executeAtomize($file_name, $file_data) {
$atom = $this->newAtom(DivinerAtom::TYPE_ARTICLE)
->setLine(1)
->setLength(count(explode("\n", $file_data)))
->setLanguage('human');
$block = "/**\n".str_replace("\n", "\n * ", $file_data)."\n */";
$atom->setDocblockRaw($block);
$meta = $atom->getDocblockMeta();
$title = idx($meta, 'title');
if (!strlen($title)) {
$title = pht('Untitled Article "%s"', basename($file_name));
$atom->addWarning('Article has no @title!');
$atom->setDocblockMetaValue('title', $title);
}
// If the article has no @name, use the filename after stripping any
// extension.
$name = idx($meta, 'name');
if (!$name) {
$name = basename($file_name);
$name = preg_replace('/\\.[^.]+$/', '', $name);
}
$atom->setName($name);
return array($atom);
}
}