Arquivos
hhvm/hphp/test/slow/constant_function/1621.php
T
Paul Tarjan c2ec1c97c9 sortof format slow tests
A poor man's formatter since I didn't like any of the other ones I found. The original C++ source sometimes put newlines and sometimes not.

Codemods:

    codemod '([;{}])([^\n])' '\1\n\2'
    codemod -m '\s*<\?php\s+' '<?php\n\n'
    codemod '\t' '  '

I hand-fixed all the failing tests
2013-05-30 17:32:57 -07:00

20 linhas
504 B
PHP

<?php
class JavaScriptPacker {
public function foo() {
$encode10 = $this->_getJSFunction('_encode10');
var_dump($encode10);
$encode36 = $this->_getJSFunction('_encode36');
var_dump($encode36);
}
private function _getJSFunction($aName) {
if (defined('self::JSFUNCTION'.$aName))
return constant('self::JSFUNCTION'.$aName);
else
return '';
}
const JSFUNCTION_encode10 = 'function($charCode) { return $charCode; } ';
}
$obj = new JavaScriptPacker;
$obj->foo();