protected function buildEventLoop() {
        $eventLoop = $this->eventHandlerFactory->getHandler('Loop')->getInlineCode()
            . $this->buildControlHandlerLoop()
            . $this->eventHandlerFactory->getHandler('Custom')->getInlineCode()
            . $this->eventHandlerFactory->getHandler('Timer')->getInlineCode();

        $result = '';
        if (!empty($eventLoop)) {
            $result = '    while(True) {' . PHP_EOL
                    . $eventLoop
                    . '        yield;' . PHP_EOL
                    . '    }';
        }
        return $result;
    }