diff --git a/composer.json b/composer.json index 5d5375e..4ee6d52 100644 --- a/composer.json +++ b/composer.json @@ -12,13 +12,14 @@ ], "require": { "php": ">=5.3", - "clue/socket-raw": "1.* | 0.1.*", - "evenement/evenement": "1.*", - "react/event-loop": ">=0.2, <0.4", - "react/promise": "1.*", - "react/stream": ">=0.2, <0.4", - "react/socket": ">=0.2, <0.4", - "react/datagram": "~1.0" + "clue/socket-raw": "^1.0", + "evenement/evenement": "^3.0", + "react/event-loop": "^1.0", + "react/promise": "^2.0", + "react/stream": "^1.0", + "react/socket": "^1.0", + "react/datagram": "^1.0", + "ext-sockets": "*" }, "autoload": { "psr-4": {"Socket\\React\\": "src"} diff --git a/src/EventLoop/SocketSelectLoop.php b/src/EventLoop/SocketSelectLoop.php index 5402e39..544dbe8 100644 --- a/src/EventLoop/SocketSelectLoop.php +++ b/src/EventLoop/SocketSelectLoop.php @@ -4,7 +4,7 @@ use React\EventLoop\LoopInterface; use React\EventLoop\Timer\Timer; -use React\EventLoop\Timer\TimerInterface; +use React\EventLoop\TimerInterface; use React\EventLoop\Timer\Timers; use InvalidArgumentException; @@ -31,7 +31,7 @@ public function addReadStream($stream, $listener) { $this->assertStream($stream); - $id = (int) $stream; + $id = (int)$stream; if (!isset($this->readStreams[$id])) { $this->readStreams[$id] = $stream; @@ -43,7 +43,7 @@ public function addWriteStream($stream, $listener) { $this->assertStream($stream); - $id = (int) $stream; + $id = (int)$stream; if (!isset($this->writeStreams[$id])) { $this->writeStreams[$id] = $stream; @@ -53,7 +53,7 @@ public function addWriteStream($stream, $listener) public function removeReadStream($stream) { - $id = (int) $stream; + $id = (int)$stream; unset( $this->readStreams[$id], @@ -63,7 +63,7 @@ public function removeReadStream($stream) public function removeWriteStream($stream) { - $id = (int) $stream; + $id = (int)$stream; unset( $this->writeStreams[$id], @@ -79,7 +79,7 @@ public function removeStream($stream) public function addTimer($interval, $callback) { - $timer = new Timer($this, $interval, $callback, false); + $timer = new Timer($interval, $callback, false); $this->timers->add($timer); return $timer; @@ -87,7 +87,7 @@ public function addTimer($interval, $callback) public function addPeriodicTimer($interval, $callback) { - $timer = new Timer($this, $interval, $callback, true); + $timer = new Timer($interval, $callback, true); $this->timers->add($timer); return $timer; @@ -146,18 +146,18 @@ protected function runStreamSelect() if (socket_select($read, $write, $except, 0, $this->getNextEventTimeInMicroSeconds()) > 0) { if ($read) { foreach ($read as $stream) { - $listener = $this->readListeners[(int) $stream]; + $listener = $this->readListeners[(int)$stream]; call_user_func($listener, $stream, $this); } } if ($write) { foreach ($write as $stream) { - if (!isset($this->writeListeners[(int) $stream])) { + if (!isset($this->writeListeners[(int)$stream])) { continue; } - $listener = $this->writeListeners[(int) $stream]; + $listener = $this->writeListeners[(int)$stream]; call_user_func($listener, $stream, $this); } } @@ -202,7 +202,34 @@ private function assertStream($stream) } if (!$checked[$type]) { - throw new InvalidArgumentException('Socket loop only accepts resources of type "Socket", but "' . $type .'" given'); + throw new InvalidArgumentException('Socket loop only accepts resources of type "Socket", but "' . $type . '" given'); } } + + /** + * @inheritDoc + */ + public function futureTick($listener) + { + throw new \Exception('Not implemented yet'); + } + + /** + * @inheritDoc + */ + public function addSignal($signal, $listener) + { + throw new \Exception('Not implemented yet'); + + } + + /** + * @inheritDoc + */ + public function removeSignal($signal, $listener) + { + throw new \Exception('Not implemented yet'); + } + + }