1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-11 08:06:13 +01:00
phorge-phorge/src/applications/phpast/controller/PhabricatorXHPASTViewStreamController.php

33 lines
782 B
PHP
Raw Normal View History

2011-04-07 04:17:05 +02:00
<?php
final class PhabricatorXHPASTViewStreamController
2011-04-07 04:17:05 +02:00
extends PhabricatorXHPASTViewPanelController {
public function processRequest() {
$storage = $this->getStorageTree();
$input = $storage->getInput();
$stdout = $storage->getStdout();
$tree = XHPASTTree::newFromDataAndResolvedExecFuture(
$input,
array(0, $stdout, ''));
$tokens = array();
foreach ($tree->getRawTokenStream() as $id => $token) {
$seq = $id;
$name = $token->getTypeName();
$title = "Token {$seq}: {$name}";
$tokens[] = phutil_tag(
2011-04-07 04:17:05 +02:00
'span',
array(
'title' => $title,
'class' => 'token',
),
$token->getValue());
2011-04-07 04:17:05 +02:00
}
return $this->buildXHPASTViewPanelResponse(implode('', $tokens));
}
}