public function getTokens()
{
// prepare the list of tokens
if ($this->isCurrentVersion) {
if (!in_array('tokenizer', get_loaded_extensions())) {
return false;
}
$x = get_defined_constants(true);
$tokens = array_flip($x['tokenizer']);
} else {
$tmpFile = tempnam(sys_get_temp_dir(), 'Phpexec');
shell_exec($this->phpexec . ' -r "print \'<?php \\$tokens = \'; \\$x = get_defined_constants(true); if (!isset(\\$x[\'tokenizer\'])) { \\$x[\'tokenizer\'] = array(); }; var_export(array_flip(\\$x[\'tokenizer\'])); print \'; ?>\';" > ' . $tmpFile);
include $tmpFile;
unlink($tmpFile);
if (empty($tokens)) {
return false;
}
}
// prepare extra tokens
self::$tokens = $tokens + self::$extraTokens;
}