public function execute($code, $throwExceptions = false)
    {
        $this->setCode($code, true);
        $closure = new ExecutionClosure($this);

        if ($throwExceptions) {
            return $closure->execute();
        }

        try {
            return $closure->execute();
        } catch (\TypeError $_e) {
            $this->writeException(TypeErrorException::fromTypeError($_e));
        } catch (\Error $_e) {
            $this->writeException(ErrorException::fromError($_e));
        } catch (\Exception $_e) {
            $this->writeException($_e);
        }
    }
public function execute($code, $throwExceptions = false)
    {
        $this->setCode($code, true);
        $closure = new ExecutionClosure($this);

        if ($throwExceptions) {
            return $closure->execute();
        }

        try {
            return $closure->execute();
        } catch (\TypeError $_e) {
            $this->writeException(TypeErrorException::fromTypeError($_e));
        } catch (\Error $_e) {
            $this->writeException(ErrorException::fromError($_e));
        } catch (\Exception $_e) {
            $this->writeException($_e);
        }
    }
public function execute ( $ code , $ throwExceptions = false ) { $ this -> setCode ( $ code , true ) ; $ closure = new ExecutionClosure ( $ this ) ; if ( $ throwExceptions ) { return $ closure -> execute ( ) ; } try { return $ closure -> execute ( ) ; } catch ( \ TypeError $ _e ) { $ this -> writeException ( TypeErrorException :: fromTypeError ( $ _e ) ) ; } catch ( \ Error $ _e ) { $ this -> writeException ( ErrorException :: fromError ( $ _e ) ) ; } catch ( \ Exception $ _e ) { $ this -> writeException ( $ _e ) ; } }
Execute code in the shell execution context.

@param string $code
@param bool   $throwExceptions

@return mixed
Execute code in the shell execution context .