src/Http/Controller/ServerController.php
public function swoole(): array
    {
        [$code, $return, $error] = Sys::run('php --ri swoole');
        if ($code) {
            return ['code' => 404, 'msg' => $error];
        }

        // format
        $str = \str_replace("\r\n", "\n", \trim($return));
        [, $enableStr, $directiveStr] = \explode("\n\n", $str);

        $directive = $this->formatSwooleInfo($directiveStr);
        \array_shift($directive);

        return [
            'raw'       => $return,
            'enable'    => $this->formatSwooleInfo($enableStr),
            'directive' => $directive,
        ];
    }
public function swoole(): array
    {
        [$code, $return, $error] = Sys::run('php --ri swoole');
        if ($code) {
            return ['code' => 404, 'msg' => $error];
        }

        // format
        $str = \str_replace("\r\n", "\n", \trim($return));
        [, $enableStr, $directiveStr] = \explode("\n\n", $str);

        $directive = $this->formatSwooleInfo($directiveStr);
        \array_shift($directive);

        return [
            'raw'       => $return,
            'enable'    => $this->formatSwooleInfo($enableStr),
            'directive' => $directive,
        ];
    }
public function swoole ( ) : array { [ $ code , $ return , $ error ] = Sys :: run ( 'php --ri swoole' ) ; if ( $ code ) { return [ 'code' => 404 , 'msg' => $ error ] ; } // format $ str = \ str_replace ( "\r\n" , "\n" , \ trim ( $ return ) ) ; [ , $ enableStr , $ directiveStr ] = \ explode ( "\n\n" , $ str ) ; $ directive = $ this -> formatSwooleInfo ( $ directiveStr ) ; \ array_shift ( $ directive ) ; return [ 'raw' => $ return , 'enable' => $ this -> formatSwooleInfo ( $ enableStr ) , 'directive' => $ directive , ] ; }
Get swoole info
@RequestMapping(route="swoole-info", method=RequestMethod::GET)
@return array
@throws \InvalidArgumentException
@throws \RuntimeException
Get swoole info