code: public function setSocket($socket)
      {
          if (!is_resource($socket)) {
              throw new ConnectionException('Socket don\'t is resource');
          } elseif (get_resource_type($socket) !== 'Socket') {
              throw new ConnectionException('Unknown resource type: ' . get_resource_type($socket));
          }
          $this->socket = $socket;
      }
docs: @param $socket
  
  @throws ConnectionException