diff --git a/src/Handshake/ServerNegotiator.php b/src/Handshake/ServerNegotiator.php index 14377f1..2ebdf6b 100644 --- a/src/Handshake/ServerNegotiator.php +++ b/src/Handshake/ServerNegotiator.php @@ -13,15 +13,12 @@ class ServerNegotiator implements NegotiatorInterface { */ private $verifier; - private $_supportedSubProtocols; + private $_supportedSubProtocols = []; - private $_strictSubProtocols; + private $_strictSubProtocols = false; - public function __construct(RequestVerifier $requestVerifier, array $supportedSubProtocols = [], $strictSubProtocol = false) { + public function __construct(RequestVerifier $requestVerifier) { $this->verifier = $requestVerifier; - - $this->_supportedSubProtocols = $supportedSubProtocols; - $this->_strictSubProtocols = $strictSubProtocol; } /** @@ -130,7 +127,6 @@ class ServerNegotiator implements NegotiatorInterface { /** * @param array $protocols - * @deprecated */ function setSupportedSubProtocols(array $protocols) { $this->_supportedSubProtocols = array_flip($protocols); @@ -143,7 +139,6 @@ class ServerNegotiator implements NegotiatorInterface { * @todo Consider extending this interface and moving this there. * The spec does says the server can fail for this reason, but * it is not a requirement. This is an implementation detail. - * @deprecated */ function setStrictSubProtocolCheck($enable) { $this->_strictSubProtocols = (boolean)$enable; diff --git a/tests/unit/Handshake/ServerNegotiatorTest.php b/tests/unit/Handshake/ServerNegotiatorTest.php index 519a37a..94d9add 100644 --- a/tests/unit/Handshake/ServerNegotiatorTest.php +++ b/tests/unit/Handshake/ServerNegotiatorTest.php @@ -111,7 +111,9 @@ Accept-Language: en-US,en;q=0.8'; } public function testBadSubprotocolResponse() { - $negotiator = new ServerNegotiator(new RequestVerifier(), [], true); + $negotiator = new ServerNegotiator(new RequestVerifier()); + $negotiator->setStrictSubProtocolCheck(true); + $negotiator->setSupportedSubProtocols([]); $requestText = 'GET / HTTP/1.1 Host: 127.0.0.1:6789