File tree Expand file tree Collapse file tree 3 files changed +17
-19
lines changed Expand file tree Collapse file tree 3 files changed +17
-19
lines changed Original file line number Diff line number Diff line change @@ -307,26 +307,26 @@ public static function unreference($watcherId)
307
307
*
308
308
* @return void
309
309
*/
310
- public static function storeState ($ key , $ value )
310
+ public static function setState ($ key , $ value )
311
311
{
312
312
$ driver = self ::$ driver ?: self ::get ();
313
- $ driver ->storeState ($ key , $ value );
313
+ $ driver ->setState ($ key , $ value );
314
314
}
315
315
316
316
/**
317
- * Fetches information stored bound to the loop. Stored information is package private. Packages MUST NOT retrieve
318
- * the stored state of other packages.
317
+ * Gets information stored bound to the loop. Stored information is package private. Packages MUST NOT retrieve the
318
+ * stored state of other packages.
319
319
*
320
320
* Therefore packages SHOULD use the following prefix to keys: `vendor.package.`
321
321
*
322
322
* @param string $key namespaced storage key
323
323
*
324
324
* @return mixed previously stored value or null if it doesn't exist
325
325
*/
326
- public static function fetchState ($ key )
326
+ public static function getState ($ key )
327
327
{
328
328
$ driver = self ::$ driver ?: self ::get ();
329
- return $ driver ->fetchState ($ key );
329
+ return $ driver ->getState ($ key );
330
330
}
331
331
332
332
/**
Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ abstract public function unreference($watcherId);
194
194
*
195
195
* @return void
196
196
*/
197
- final public function storeState ($ key , $ value )
197
+ final public function setState ($ key , $ value )
198
198
{
199
199
if ($ value === null ) {
200
200
unset($ this ->registry [$ key ]);
@@ -204,16 +204,16 @@ final public function storeState($key, $value)
204
204
}
205
205
206
206
/**
207
- * Fetches information stored bound to the loop. Stored information is package private. Packages MUST NOT retrieve
208
- * the stored state of other packages.
207
+ * Gets information stored bound to the loop. Stored information is package private. Packages MUST NOT retrieve the
208
+ * stored state of other packages.
209
209
*
210
210
* Therefore packages SHOULD use the following prefix to keys: `vendor.package.`
211
211
*
212
212
* @param string $key namespaced storage key
213
213
*
214
214
* @return mixed previously stored value or null if it doesn't exist
215
215
*/
216
- final public function fetchState ($ key )
216
+ final public function getState ($ key )
217
217
{
218
218
return isset ($ this ->registry [$ key ]) ? $ this ->registry [$ key ] : null ;
219
219
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace Interop \Async \Loop ;
4
4
5
- class RegistryTest extends \PHPUnit_Framework_TestCase
5
+ class LoopStateTest extends \PHPUnit_Framework_TestCase
6
6
{
7
- private $ registry ;
7
+ private $ loop ;
8
8
9
9
protected function setUp ()
10
10
{
11
- $ this ->registry = $ this ->getMockForAbstractClass (Driver::class);
11
+ $ this ->loop = $ this ->getMockForAbstractClass (Driver::class);
12
12
}
13
13
14
14
/** @test */
15
15
public function defaultsToNull ()
16
16
{
17
- $ this ->assertNull ($ this ->registry -> fetchState ("foobar " ));
17
+ $ this ->assertNull ($ this ->loop -> getState ("foobar " ));
18
18
}
19
19
20
20
/**
21
21
* @test
22
22
* @dataProvider provideValues
23
23
*/
24
- public function fetchesStoredValue ($ value )
24
+ public function getsPreviouslySetValue ($ value )
25
25
{
26
- $ this ->assertNull ($ this ->registry ->fetchState ("foobar " ));
27
- $ this ->registry ->storeState ("foobar " , $ value );
28
-
29
- $ this ->assertSame ($ value , $ this ->registry ->fetchState ("foobar " ));
26
+ $ this ->loop ->setState ("foobar " , $ value );
27
+ $ this ->assertSame ($ value , $ this ->loop ->getState ("foobar " ));
30
28
}
31
29
32
30
public function provideValues ()
You can’t perform that action at this time.
0 commit comments