c2ec1c97c9
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
20 linhas
504 B
PHP
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();
|