getIncludes() as $__psysh_include__) { include $__psysh_include__; } } catch (\Exception $_e) { $__psysh__->writeException($_e); } restore_error_handler(); unset($__psysh_include__); extract($__psysh__->getScopeVariables()); do { $__psysh__->beforeLoop(); $__psysh__->setScopeVariables(get_defined_vars()); try { // read a line, see if we should eval $__psysh__->getInput(); // evaluate the current code buffer ob_start( array($__psysh__, 'writeStdout'), version_compare(PHP_VERSION, '5.4', '>=') ? 1 : 2 ); set_error_handler(array($__psysh__, 'handleError')); $_ = eval($__psysh__->flushCode() ?: Loop::NOOP_INPUT); restore_error_handler(); ob_end_flush(); $__psysh__->writeReturnValue($_); } catch (BreakException $_e) { restore_error_handler(); if (ob_get_level() > 0) { ob_end_clean(); } $__psysh__->writeException($_e); return; } catch (ThrowUpException $_e) { restore_error_handler(); if (ob_get_level() > 0) { ob_end_clean(); } $__psysh__->writeException($_e); throw $_e; } catch (\TypeError $_e) { restore_error_handler(); if (ob_get_level() > 0) { ob_end_clean(); } $__psysh__->writeException(TypeErrorException::fromTypeError($_e)); } catch (\Exception $_e) { restore_error_handler(); if (ob_get_level() > 0) { ob_end_clean(); } $__psysh__->writeException($_e); } $__psysh__->afterLoop(); } while (true); }; // bind the closure to $this from the shell scope variables... if (self::bindLoop()) { $that = null; try { $that = $shell->getScopeVariable('this'); } catch (\InvalidArgumentException $e) { // well, it was worth a shot } if (is_object($that)) { $loop = $loop->bindTo($that, get_class($that)); } else { $loop = $loop->bindTo(null, null); } } $loop($shell); } /** * A beforeLoop callback. * * This is executed at the start of each loop iteration. In the default * (non-forking) loop implementation, this is a no-op. */ public function beforeLoop() { // no-op } /** * A afterLoop callback. * * This is executed at the end of each loop iteration. In the default * (non-forking) loop implementation, this is a no-op. */ public function afterLoop() { // no-op } /** * Decide whether to bind the execution loop. * * @return bool */ protected static function bindLoop() { // skip binding on HHVM <= 3.5.0 // see https://github.com/facebook/hhvm/issues/1203 if (defined('HHVM_VERSION')) { return version_compare(HHVM_VERSION, '3.5.0', '>='); } return version_compare(PHP_VERSION, '5.4', '>='); } }