src/Server.php
protected function makeSocket(): void
    {
        if ($this->useSSL) {
            if (!file_exists($this->cert)) {
                throw new \Exception('Cert file not found');
            }

            $context = stream_context_create([
                'ssl' => [
                    'local_cert'        => $this->cert,
                    'passphrase'        => $this->passPhrase,
                    'verify_peer'       => false,
                    'verify_peer_name'  => false,
                    'allow_self_signed' => true,
                    'verify_depth'      => 0
                ]
            ]);

            $protocol = 'ssl';
        } else {
            $context = stream_context_create();
            $protocol = 'tcp';
        }

        $this->socket = stream_socket_server("$protocol://{$this->host}:{$this->port}", $errorNumber, $errorString, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context);

        if ($this->useConnector) {
            if (file_exists(static::$connector)) {
                unlink(static::$connector);
            }

            $this->unixConnector = stream_socket_server('unix://' . static::$connector, $errorNumber, $errorString, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN);
            chmod(static::$connector, 0777);
        }

        if (!$this->socket) {
            throw new SocketException($errorString, $errorNumber);
        }
    }
protected function makeSocket(): void
    {
        if ($this->useSSL) {
            if (!file_exists($this->cert)) {
                throw new \Exception('Cert file not found');
            }

            $context = stream_context_create([
                'ssl' => [
                    'local_cert'        => $this->cert,
                    'passphrase'        => $this->passPhrase,
                    'verify_peer'       => false,
                    'verify_peer_name'  => false,
                    'allow_self_signed' => true,
                    'verify_depth'      => 0
                ]
            ]);

            $protocol = 'ssl';
        } else {
            $context = stream_context_create();
            $protocol = 'tcp';
        }

        $this->socket = stream_socket_server("$protocol://{$this->host}:{$this->port}", $errorNumber, $errorString, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context);

        if ($this->useConnector) {
            if (file_exists(static::$connector)) {
                unlink(static::$connector);
            }

            $this->unixConnector = stream_socket_server('unix://' . static::$connector, $errorNumber, $errorString, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN);
            chmod(static::$connector, 0777);
        }

        if (!$this->socket) {
            throw new SocketException($errorString, $errorNumber);
        }
    }
protected function makeSocket ( ) : void { if ( $ this -> useSSL ) { if ( ! file_exists ( $ this -> cert ) ) { throw new \ Exception ( 'Cert file not found' ) ; } $ context = stream_context_create ( [ 'ssl' => [ 'local_cert' => $ this -> cert , 'passphrase' => $ this -> passPhrase , 'verify_peer' => false , 'verify_peer_name' => false , 'allow_self_signed' => true , 'verify_depth' => 0 ] ] ) ; $ protocol = 'ssl' ; } else { $ context = stream_context_create ( ) ; $ protocol = 'tcp' ; } $ this -> socket = stream_socket_server ( "$protocol://{$this->host}:{$this->port}" , $ errorNumber , $ errorString , STREAM_SERVER_BIND | STREAM_SERVER_LISTEN , $ context ) ; if ( $ this -> useConnector ) { if ( file_exists ( static :: $ connector ) ) { unlink ( static :: $ connector ) ; } $ this -> unixConnector = stream_socket_server ( 'unix://' . static :: $ connector , $ errorNumber , $ errorString , STREAM_SERVER_BIND | STREAM_SERVER_LISTEN ) ; chmod ( static :: $ connector , 0777 ) ; } if ( ! $ this -> socket ) { throw new SocketException ( $ errorString , $ errorNumber ) ; } }
Make server sockets

@throws SocketException|\Exception
@return void
Make server sockets