public function runConsoleRequest() {
        $promise = resolve(true);
        //Delayed stop
        $loopStop = function() {
            $this->loop->addTimer(0.5, function() {
                $this->loop->stop();
            });
        };
        $promise->then(
            function() {
                return $this->processRequest($this->createRequest());
            }
        )->then(
            function($response = null) {
                if ($response instanceof Response) {
                    $body = $response->getBody();
                    if (is_object($body) && method_exists($body, '__toString')) {
                        $body = (string)$body;
                    }
                    return $body;
                }
                return $response;
            }
        )->done(function($result = null) use ($loopStop) {
            if (is_string($result)) {
                $this->logger->logRaw($result);
            }
            $loopStop();
        }, function($error) use ($loopStop) {
            \Reaction::error($error);
            $loopStop();
        });
    }
public function runConsoleRequest() {
        $promise = resolve(true);
        //Delayed stop
        $loopStop = function() {
            $this->loop->addTimer(0.5, function() {
                $this->loop->stop();
            });
        };
        $promise->then(
            function() {
                return $this->processRequest($this->createRequest());
            }
        )->then(
            function($response = null) {
                if ($response instanceof Response) {
                    $body = $response->getBody();
                    if (is_object($body) && method_exists($body, '__toString')) {
                        $body = (string)$body;
                    }
                    return $body;
                }
                return $response;
            }
        )->done(function($result = null) use ($loopStop) {
            if (is_string($result)) {
                $this->logger->logRaw($result);
            }
            $loopStop();
        }, function($error) use ($loopStop) {
            \Reaction::error($error);
            $loopStop();
        });
    }
public function runConsoleRequest ( ) { $ promise = resolve ( true ) ; //Delayed stop $ loopStop = function ( ) { $ this -> loop -> addTimer ( 0.5 , function ( ) { $ this -> loop -> stop ( ) ; } ) ; } ; $ promise -> then ( function ( ) { return $ this -> processRequest ( $ this -> createRequest ( ) ) ; } ) -> then ( function ( $ response = null ) { if ( $ response instanceof Response ) { $ body = $ response -> getBody ( ) ; if ( is_object ( $ body ) && method_exists ( $ body , '__toString' ) ) { $ body = ( string ) $ body ; } return $ body ; } return $ response ; } ) -> done ( function ( $ result = null ) use ( $ loopStop ) { if ( is_string ( $ result ) ) { $ this -> logger -> logRaw ( $ result ) ; } $ loopStop ( ) ; } , function ( $ error ) use ( $ loopStop ) { \ Reaction :: error ( $ error ) ; $ loopStop ( ) ; } ) ; }
Emulates request resolving in console
Emulates request resolving in console