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)
307307 *
308308 * @return void
309309 */
310- public static function storeState ($ key , $ value )
310+ public static function setState ($ key , $ value )
311311 {
312312 $ driver = self ::$ driver ?: self ::get ();
313- $ driver ->storeState ($ key , $ value );
313+ $ driver ->setState ($ key , $ value );
314314 }
315315
316316 /**
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.
319319 *
320320 * Therefore packages SHOULD use the following prefix to keys: `vendor.package.`
321321 *
322322 * @param string $key namespaced storage key
323323 *
324324 * @return mixed previously stored value or null if it doesn't exist
325325 */
326- public static function fetchState ($ key )
326+ public static function getState ($ key )
327327 {
328328 $ driver = self ::$ driver ?: self ::get ();
329- return $ driver ->fetchState ($ key );
329+ return $ driver ->getState ($ key );
330330 }
331331
332332 /**
Original file line number Diff line number Diff line change @@ -194,7 +194,7 @@ abstract public function unreference($watcherId);
194194 *
195195 * @return void
196196 */
197- final public function storeState ($ key , $ value )
197+ final public function setState ($ key , $ value )
198198 {
199199 if ($ value === null ) {
200200 unset($ this ->registry [$ key ]);
@@ -204,16 +204,16 @@ final public function storeState($key, $value)
204204 }
205205
206206 /**
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.
209209 *
210210 * Therefore packages SHOULD use the following prefix to keys: `vendor.package.`
211211 *
212212 * @param string $key namespaced storage key
213213 *
214214 * @return mixed previously stored value or null if it doesn't exist
215215 */
216- final public function fetchState ($ key )
216+ final public function getState ($ key )
217217 {
218218 return isset ($ this ->registry [$ key ]) ? $ this ->registry [$ key ] : null ;
219219 }
Original file line number Diff line number Diff line change 22
33namespace Interop \Async \Loop ;
44
5- class RegistryTest extends \PHPUnit_Framework_TestCase
5+ class LoopStateTest extends \PHPUnit_Framework_TestCase
66{
7- private $ registry ;
7+ private $ loop ;
88
99 protected function setUp ()
1010 {
11- $ this ->registry = $ this ->getMockForAbstractClass (Driver::class);
11+ $ this ->loop = $ this ->getMockForAbstractClass (Driver::class);
1212 }
1313
1414 /** @test */
1515 public function defaultsToNull ()
1616 {
17- $ this ->assertNull ($ this ->registry -> fetchState ("foobar " ));
17+ $ this ->assertNull ($ this ->loop -> getState ("foobar " ));
1818 }
1919
2020 /**
2121 * @test
2222 * @dataProvider provideValues
2323 */
24- public function fetchesStoredValue ($ value )
24+ public function getsPreviouslySetValue ($ value )
2525 {
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 " ));
3028 }
3129
3230 public function provideValues ()
You can’t perform that action at this time.
0 commit comments