Browse Source

consistent type of Decompiler_Code::toCode return

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@741 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 11 years ago
parent
commit
ed0a1d6526
  1. 27
      Decompiler.class.php

27
Decompiler.class.php

@ -11,30 +11,33 @@ function color($str, $color = 33)
function str($code, $indent = '') // {{{
{
if (is_object($code)) {
if (get_class($code) != 'Decompiler_Code') {
$code = toCode($code, $indent);
}
$code = toCode($code, $indent);
return $code->__toString();
}
return (string) $code;
}
// }}}
function toCode($src, $indent = '') // {{{
function toCode($src, $indent = '') // {{{ wrap or rewrap anything to Decompiler_Code
{
if (is_array($indent)) {
$indent = $indent['indent'];
}
if (is_object($src)) {
if (!method_exists($src, 'toCode')) {
var_dump($src);
exit('no toCode');
}
return new Decompiler_Code($src->toCode($indent));
if (!is_object($src)) {
return new Decompiler_Code($src);
}
if (!method_exists($src, 'toCode')) {
var_dump($src);
exit('no toCode');
}
if (get_class($src) != 'Decompiler_Code') {
// rewrap it
$src = new Decompiler_Code($src->toCode($indent));
}
return new Decompiler_Code($src);
return $src;
}
// }}}
function value($value) // {{{
@ -90,7 +93,7 @@ class Decompiler_Code extends Decompiler_Object // {{{
function toCode($indent)
{
return $this;
return $this->src;
}
function __toString()

Loading…
Cancel
Save