Skip to content

Commit ef68e03

Browse files
committed
Rename EventLoop → Loop and EventLoopDriver → LoopDriver
1 parent 4b3a841 commit ef68e03

File tree

2 files changed

+62
-62
lines changed

2 files changed

+62
-62
lines changed

src/EventLoop.php renamed to src/Loop.php

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
namespace Interop\Async\EventLoop;
44

5-
final class EventLoop
5+
final class Loop
66
{
77
/**
8-
* @var EventLoopDriver
8+
* @var LoopDriver
99
*/
1010
private static $driver = null;
1111

1212
/**
1313
* Execute a callback within the scope of an event loop driver.
1414
*
1515
* @param callable $callback The callback to execute
16-
* @param EventLoopDriver $driver The event loop driver
16+
* @param LoopDriver $driver The event loop driver
1717
*
1818
* @return void
1919
*/
20-
public static function execute(callable $callback, EventLoopDriver $driver)
20+
public static function execute(callable $callback, LoopDriver $driver)
2121
{
2222
$previousDriver = self::$driver;
2323

@@ -34,8 +34,8 @@ public static function execute(callable $callback, EventLoopDriver $driver)
3434

3535
/**
3636
* Retrieve the event loop driver that is in scope.
37-
*
38-
* @return EventLoopDriver
37+
*
38+
* @return LoopDriver
3939
*/
4040
public static function get()
4141
{
@@ -48,7 +48,7 @@ public static function get()
4848

4949
/**
5050
* Stop the event loop.
51-
*
51+
*
5252
* @return void
5353
*/
5454
public static function stop()
@@ -58,9 +58,9 @@ public static function stop()
5858

5959
/**
6060
* Defer the execution of a callback.
61-
*
61+
*
6262
* @param callable $callback The callback to defer.
63-
*
63+
*
6464
* @return string An identifier that can be used to cancel, enable or disable the event.
6565
*/
6666
public static function defer(callable $callback)
@@ -70,10 +70,10 @@ public static function defer(callable $callback)
7070

7171
/**
7272
* Delay the execution of a callback. The time delay is approximate and accuracy is not guaranteed.
73-
*
73+
*
7474
* @param callable $callback The callback to delay.
7575
* @param int $time The amount of time, in milliseconds, to delay the execution for.
76-
*
76+
*
7777
* @return string An identifier that can be used to cancel, enable or disable the event.
7878
*/
7979
public static function delay(callable $callback, $time)
@@ -83,10 +83,10 @@ public static function delay(callable $callback, $time)
8383

8484
/**
8585
* Repeatedly execute a callback. The interval between executions is approximate and accuracy is not guaranteed.
86-
*
86+
*
8787
* @param callable $callback The callback to repeat.
8888
* @param int $interval The time interval, in milliseconds, to wait between executions.
89-
*
89+
*
9090
* @return string An identifier that can be used to cancel, enable or disable the event.
9191
*/
9292
public static function repeat(callable $callback, $interval)
@@ -96,10 +96,10 @@ public static function repeat(callable $callback, $interval)
9696

9797
/**
9898
* Execute a callback when a stream resource becomes readable.
99-
*
99+
*
100100
* @param resource $stream The stream to monitor.
101101
* @param callable $callback The callback to execute.
102-
*
102+
*
103103
* @return string An identifier that can be used to cancel, enable or disable the event.
104104
*/
105105
public static function onReadable($stream, callable $callback)
@@ -109,10 +109,10 @@ public static function onReadable($stream, callable $callback)
109109

110110
/**
111111
* Execute a callback when a stream resource becomes writable.
112-
*
112+
*
113113
* @param resource $stream The stream to monitor.
114114
* @param callable $callback The callback to execute.
115-
*
115+
*
116116
* @return string An identifier that can be used to cancel, enable or disable the event.
117117
*/
118118
public static function onWritable($stream, callable $callback)
@@ -122,10 +122,10 @@ public static function onWritable($stream, callable $callback)
122122

123123
/**
124124
* Execute a callback when a signal is received.
125-
*
125+
*
126126
* @param int $signo The signal number to monitor.
127127
* @param callable $callback The callback to execute.
128-
*
128+
*
129129
* @return string An identifier that can be used to cancel, enable or disable the event.
130130
*/
131131
public static function onSignal($signo, callable $callback)
@@ -135,9 +135,9 @@ public static function onSignal($signo, callable $callback)
135135

136136
/**
137137
* Execute a callback when an error occurs.
138-
*
138+
*
139139
* @param callable $callback The callback to execute.
140-
*
140+
*
141141
* @return string An identifier that can be used to cancel, enable or disable the event.
142142
*/
143143
public static function onError(callable $callback)
@@ -147,9 +147,9 @@ public static function onError(callable $callback)
147147

148148
/**
149149
* Enable an event.
150-
*
150+
*
151151
* @param string $eventIdentifier The event identifier.
152-
*
152+
*
153153
* @return void
154154
*/
155155
public static function enable($eventIdentifier)
@@ -159,9 +159,9 @@ public static function enable($eventIdentifier)
159159

160160
/**
161161
* Disable an event.
162-
*
162+
*
163163
* @param string $eventIdentifier The event identifier.
164-
*
164+
*
165165
* @return void
166166
*/
167167
public static function disable($eventIdentifier)
@@ -171,9 +171,9 @@ public static function disable($eventIdentifier)
171171

172172
/**
173173
* Cancel an event.
174-
*
174+
*
175175
* @param string $eventIdentifier The event identifier.
176-
*
176+
*
177177
* @return void
178178
*/
179179
public static function cancel($eventIdentifier)
@@ -183,11 +183,11 @@ public static function cancel($eventIdentifier)
183183

184184
/**
185185
* Reference an event.
186-
*
186+
*
187187
* This will keep the event loop alive whilst the event is still being monitored. Events have this state by default.
188-
*
188+
*
189189
* @param string $eventIdentifier The event identifier.
190-
*
190+
*
191191
* @return void
192192
*/
193193
public static function reference($eventIdentifier)
@@ -197,12 +197,12 @@ public static function reference($eventIdentifier)
197197

198198
/**
199199
* Unreference an event.
200-
*
200+
*
201201
* The event loop should exit the run method when only unreferenced events are still being monitored. Events are all
202202
* referenced by default.
203-
*
203+
*
204204
* @param string $eventIdentifier The event identifier.
205-
*
205+
*
206206
* @return void
207207
*/
208208
public static function unreference($eventIdentifier)

src/EventLoopDriver.php renamed to src/LoopDriver.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,136 +2,136 @@
22

33
namespace Interop\Async\EventLoop;
44

5-
interface EventLoopDriver
5+
interface LoopDriver
66
{
77
/**
88
* Start the event loop.
9-
*
9+
*
1010
* @return void
1111
*/
1212
public function run();
1313

1414
/**
1515
* Stop the event loop.
16-
*
16+
*
1717
* @return void
1818
*/
1919
public function stop();
2020

2121
/**
2222
* Defer the execution of a callback.
23-
*
23+
*
2424
* @param callable $callback The callback to defer.
25-
*
25+
*
2626
* @return string An identifier that can be used to cancel, enable or disable the event.
2727
*/
2828
public function defer(callable $callback);
2929

3030
/**
3131
* Delay the execution of a callback. The time delay is approximate and accuracy is not guaranteed.
32-
*
32+
*
3333
* @param callable $callback The callback to delay.
3434
* @param int $delay The amount of time, in milliseconds, to delay the execution for.
35-
*
35+
*
3636
* @return string An identifier that can be used to cancel, enable or disable the event.
3737
*/
3838
public function delay(callable $callback, $delay);
3939

4040
/**
4141
* Repeatedly execute a callback. The interval between executions is approximate and accuracy is not guaranteed.
42-
*
42+
*
4343
* @param callable $callback The callback to repeat.
4444
* @param int $interval The time interval, in milliseconds, to wait between executions.
45-
*
45+
*
4646
* @return string An identifier that can be used to cancel, enable or disable the event.
4747
*/
4848
public function repeat(callable $callback, $interval);
4949

5050
/**
5151
* Execute a callback when a stream resource becomes readable.
52-
*
52+
*
5353
* @param resource $stream The stream to monitor.
5454
* @param callable $callback The callback to execute.
55-
*
55+
*
5656
* @return string An identifier that can be used to cancel, enable or disable the event.
5757
*/
5858
public function onReadable($stream, callable $callback);
5959

6060
/**
6161
* Execute a callback when a stream resource becomes writable.
62-
*
62+
*
6363
* @param resource $stream The stream to monitor.
6464
* @param callable $callback The callback to execute.
65-
*
65+
*
6666
* @return string An identifier that can be used to cancel, enable or disable the event.
6767
*/
6868
public function onWritable($stream, callable $callback);
6969

7070
/**
7171
* Execute a callback when a signal is received.
72-
*
72+
*
7373
* @param int $signo The signal number to monitor.
7474
* @param callable $callback The callback to execute.
75-
*
75+
*
7676
* @return string An identifier that can be used to cancel, enable or disable the event.
7777
*/
7878
public function onSignal($signo, callable $callback);
7979

8080
/**
8181
* Execute a callback when an error occurs.
82-
*
82+
*
8383
* @param callable $callback The callback to execute.
84-
*
84+
*
8585
* @return string An identifier that can be used to cancel, enable or disable the event.
8686
*/
8787
public function onError(callable $callback);
8888

8989
/**
9090
* Enable an event.
91-
*
91+
*
9292
* @param string $eventIdentifier The event identifier.
93-
*
93+
*
9494
* @return void
9595
*/
9696
public function enable($eventIdentifier);
9797

9898
/**
9999
* Disable an event.
100-
*
100+
*
101101
* @param string $eventIdentifier The event identifier.
102-
*
102+
*
103103
* @return void
104104
*/
105105
public function disable($eventIdentifier);
106106

107107
/**
108108
* Cancel an event.
109-
*
109+
*
110110
* @param string $eventIdentifier The event identifier.
111-
*
111+
*
112112
* @return void
113113
*/
114114
public function cancel($eventIdentifier);
115115

116116
/**
117117
* Reference an event.
118-
*
118+
*
119119
* This will keep the event loop alive whilst the event is still being monitored. Events have this state by default.
120-
*
120+
*
121121
* @param string $eventIdentifier The event identifier.
122-
*
122+
*
123123
* @return void
124124
*/
125125
public function reference($eventIdentifier);
126126

127127
/**
128128
* Unreference an event.
129-
*
129+
*
130130
* The event loop should exit the run method when only unreferenced events are still being monitored. Events are all
131131
* referenced by default.
132-
*
132+
*
133133
* @param string $eventIdentifier The event identifier.
134-
*
134+
*
135135
* @return void
136136
*/
137137
public function unreference($eventIdentifier);

0 commit comments

Comments
 (0)