Changeset 713 for trunk/Decompiler.class.php
- Timestamp:
- 04/08/2011 08:27:55 PM (2 years ago)
- Files:
-
- 1 modified
-
trunk/Decompiler.class.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Decompiler.class.php
r522 r713 29 29 if (is_array($src)) { 30 30 die_error('array str'); 31 $src = new Decompiler_Array($src, false,$indent);31 $src = new Decompiler_Array($src, $indent); 32 32 return $src->__toString(); 33 33 } … … 38 38 die_error('no __toString'); 39 39 } 40 return $src->__toString( $indent);40 return $src->__toString(); 41 41 } 42 42 … … 56 56 57 57 if (is_array($value)) { 58 $value = new Decompiler_Array($value , true);58 $value = new Decompiler_Array($value); 59 59 } 60 60 else { 61 $value = new Decompiler_Value($value , true);61 $value = new Decompiler_Value($value); 62 62 } 63 63 return $value; … … 257 257 class Decompiler_Array extends Decompiler_Value // {{{ 258 258 { 259 var $needExport = false;260 259 var $indent = ''; 261 260 262 function Decompiler_Array($value = array(), $ needexport = false, $indent = '')261 function Decompiler_Array($value = array(), $indent = '') 263 262 { 264 263 $this->value = $value; 265 $this->needExport = $needexport;266 264 $this->indent = $indent; 267 265 } … … 286 284 ++ $i; 287 285 } 288 if ($assoclen && $this->needExport) {286 if ($assoclen) { 289 287 $assoclen += 2; 290 288 } … … 306 304 } 307 305 308 if ($this->needExport) { 309 $k = var_export($k, true); 310 } 306 $k = var_export($k, true); 311 307 if ($multiline) { 312 308 $exp .= sprintf("%{$assoclen}s => ", $k); … … 316 312 } 317 313 318 if (is_array($v)) { 319 $v = new Decompiler_Array($v, $this->needExport); 320 } 321 $exp .= str($v, $subindent); 314 $exp .= str(value($v), $subindent); 322 315 323 316 $i ++; … … 1608 1601 if (!empty($class['default_properties'])) { 1609 1602 echo "\n"; 1610 $infos = empty($class['properties_info']) ? null : $class['properties_info'];1611 foreach ( $class['default_properties'] as $name => $v) {1603 $infos = !empty($class['properties_info']) ? $class['properties_info'] : null; 1604 foreach (!empty($class['properties_info']) ? $class['properties_info'] : ($class['default_static_members'] + $class['default_properties']) as $name => $dummy) { 1612 1605 $info = (isset($infos) && isset($infos[$name])) ? $infos[$name] : null; 1613 1606 if (isset($info)) { … … 1620 1613 1621 1614 echo $newindent; 1615 $static = false; 1616 if (isset($info)) { 1617 if ($info['flags'] & ZEND_ACC_STATIC) { 1618 $static = true; 1619 } 1620 } 1621 else if (isset($class['default_static_members'][$name])) { 1622 $static = true; 1623 } 1624 1625 if ($static) { 1626 echo "static "; 1627 } 1628 1629 $mangled = false; 1622 1630 if (PHP_VERSION < 5) { 1623 1631 echo 'var '; … … 1636 1644 case ZEND_ACC_PRIVATE: 1637 1645 echo "private "; 1646 $mangled = true; 1638 1647 break; 1639 1648 case ZEND_ACC_PROTECTED: 1640 1649 echo "protected "; 1650 $mangled = true; 1641 1651 break; 1642 1652 } 1643 if ($info['flags'] & ZEND_ACC_STATIC) {1644 echo "static ";1645 }1646 1653 } 1647 1654 1648 1655 echo '$', $name; 1649 if (isset($v)) { 1656 1657 $key = isset($info) ? $info['name'] . ($mangled ? "\000" : "") : $name; 1658 1659 $value = $class[$static ? 'default_static_members' : 'default_properties'][$key]; 1660 if (isset($value)) { 1650 1661 echo ' = '; 1651 echo str(value($v ));1662 echo str(value($value)); 1652 1663 } 1653 1664 echo ";\n";

