src/Command/RpcCommand.php
public function start()
    {
        $rpcServer = $this->getRpcServer();

        // 是否正在运行
        if ($rpcServer->isRunning()) {
            $serverStatus = $rpcServer->getServerSetting();
            \output()->writeln("<error>The server have been running!(PID: {$serverStatus['masterPid']})</error>", true, true);
        }

        // 选项参数解析
        $this->setStartArgs($rpcServer);
        $tcpStatus = $rpcServer->getTcpSetting();

        // tcp启动参数
        $tcpHost = $tcpStatus['host'];
        $tcpPort = $tcpStatus['port'];
        $tcpType = $tcpStatus['type'];
        $tcpMode = $tcpStatus['mode'];

        // 信息面板
        $lines = [
            '                    Information Panel                     ',
            '*************************************************************',
            "* tcp | Host: <note>$tcpHost</note>, port: <note>$tcpPort</note>, mode: <note>$tcpMode</note>, type: <note>$tcpType</note>",
            '*************************************************************',
        ];
        \output()->writeln(implode("\n", $lines));

        // 启动
        $rpcServer->start();
    }
public function start()
    {
        $rpcServer = $this->getRpcServer();

        // 是否正在运行
        if ($rpcServer->isRunning()) {
            $serverStatus = $rpcServer->getServerSetting();
            \output()->writeln("<error>The server have been running!(PID: {$serverStatus['masterPid']})</error>", true, true);
        }

        // 选项参数解析
        $this->setStartArgs($rpcServer);
        $tcpStatus = $rpcServer->getTcpSetting();

        // tcp启动参数
        $tcpHost = $tcpStatus['host'];
        $tcpPort = $tcpStatus['port'];
        $tcpType = $tcpStatus['type'];
        $tcpMode = $tcpStatus['mode'];

        // 信息面板
        $lines = [
            '                    Information Panel                     ',
            '*************************************************************',
            "* tcp | Host: <note>$tcpHost</note>, port: <note>$tcpPort</note>, mode: <note>$tcpMode</note>, type: <note>$tcpType</note>",
            '*************************************************************',
        ];
        \output()->writeln(implode("\n", $lines));

        // 启动
        $rpcServer->start();
    }
public function start ( ) { $ rpcServer = $ this -> getRpcServer ( ) ; // 是否正在运行 if ( $ rpcServer -> isRunning ( ) ) { $ serverStatus = $ rpcServer -> getServerSetting ( ) ; \ output ( ) -> writeln ( "<error>The server have been running!(PID: {$serverStatus['masterPid']})</error>" , true , true ) ; } // 选项参数解析 $ this -> setStartArgs ( $ rpcServer ) ; $ tcpStatus = $ rpcServer -> getTcpSetting ( ) ; // tcp启动参数 $ tcpHost = $ tcpStatus [ 'host' ] ; $ tcpPort = $ tcpStatus [ 'port' ] ; $ tcpType = $ tcpStatus [ 'type' ] ; $ tcpMode = $ tcpStatus [ 'mode' ] ; // 信息面板 $ lines = [ '                    Information Panel                     ' , '*************************************************************' , "* tcp | Host: <note>$tcpHost</note>, port: <note>$tcpPort</note>, mode: <note>$tcpMode</note>, type: <note>$tcpType</note>" , '*************************************************************' , ] ; \ output ( ) -> writeln ( implode ( "\n" , $ lines ) ) ; // 启动 $ rpcServer -> start ( ) ; }
start rpc server

@Usage {fullCommand} [-d|--daemon]
@Options
-d, --daemon    Run server on the background
@Example
{fullCommand}
{fullCommand} -d
start rpc server