src/FrameworkHandler.php
public function export(string $event, bool $map = false)
    {
        $handler = $this;

        $next = function (...$args) use ($handler, $event, $map) {
            $request = $handler->getRequest();
            $response = $handler->getResponse();

            $meta = $handler
                //do this directly from the handler
                ->getEventHandler()
                //trigger
                ->trigger($event, $request, $response, ...$args)
                //if our events returns false
                //lets tell the interface the same
                ->getMeta();

            //no map ? let's try our best
            //if we have meta
            if ($meta === EventHandler::STATUS_OK) {
                //return the response
                return $response->getContent(true);
            }

            //otherwise return false
            return false;
        };

        if (!$map) {
            return $next;
        }

        $request = $handler->getRequest();
        $response = $handler->getResponse();

        return [$request, $response, $next];
    }
public function export(string $event, bool $map = false)
    {
        $handler = $this;

        $next = function (...$args) use ($handler, $event, $map) {
            $request = $handler->getRequest();
            $response = $handler->getResponse();

            $meta = $handler
                //do this directly from the handler
                ->getEventHandler()
                //trigger
                ->trigger($event, $request, $response, ...$args)
                //if our events returns false
                //lets tell the interface the same
                ->getMeta();

            //no map ? let's try our best
            //if we have meta
            if ($meta === EventHandler::STATUS_OK) {
                //return the response
                return $response->getContent(true);
            }

            //otherwise return false
            return false;
        };

        if (!$map) {
            return $next;
        }

        $request = $handler->getRequest();
        $response = $handler->getResponse();

        return [$request, $response, $next];
    }
public function export ( string $ event , bool $ map = false ) { $ handler = $ this ; $ next = function ( ... $ args ) use ( $ handler , $ event , $ map ) { $ request = $ handler -> getRequest ( ) ; $ response = $ handler -> getResponse ( ) ; $ meta = $ handler //do this directly from the handler -> getEventHandler ( ) //trigger -> trigger ( $ event , $ request , $ response , ... $ args ) //if our events returns false //lets tell the interface the same -> getMeta ( ) ; //no map ? let's try our best //if we have meta if ( $ meta === EventHandler :: STATUS_OK ) { //return the response return $ response -> getContent ( true ) ; } //otherwise return false return false ; } ; if ( ! $ map ) { return $ next ; } $ request = $ handler -> getRequest ( ) ; $ response = $ handler -> getResponse ( ) ; return [ $ request , $ response , $ next ] ; }
Exports a flow to another external interface

@param *string $event
@param bool    $map

@return Closure|array
Exports a flow to another external interface