Skip to content

Commit a55f054

Browse files
committed
Changed method names to more appropriate names
1 parent fde2117 commit a55f054

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/JsonDecodeService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct(LoopInterface $loop)
2323
$this->loop = $loop;
2424
}
2525

26-
public function handle(string $input = ''): CancellablePromiseInterface
26+
public function decode(string $input): CancellablePromiseInterface
2727
{
2828
return futureFunctionPromise($this->loop, $input, function ($json) {
2929
return decode($json, true);

src/JsonEncodeService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(LoopInterface $loop)
2828
* @param array $input
2929
* @return CancellablePromiseInterface
3030
*/
31-
public function handle(array $input = []): CancellablePromiseInterface
31+
public function encode(array $input): CancellablePromiseInterface
3232
{
3333
if (!is_array($input)) {
3434
return resolve($input);

tests/JsonDecodeServiceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function testHandler()
1717
];
1818
$loop = Factory::create();
1919
$service = new JsonDecodeService($loop);
20-
self::assertSame($json, await($service->handle(json_encode($json)), $loop));
20+
self::assertSame($json, await($service->decode(json_encode($json)), $loop));
2121
}
2222

2323
public function provideFaultyJsonStrings()
@@ -56,6 +56,6 @@ public function testFailure(string $string, string $errorMessage)
5656

5757
$loop = Factory::create();
5858
$service = new JsonDecodeService($loop);
59-
await($service->handle($string), $loop);
59+
await($service->decode($string), $loop);
6060
}
6161
}

tests/JsonEncodeServiceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function testHandler()
1414
{
1515
$loop = Factory::create();
1616
$handler = new JsonEncodeService($loop);
17-
self::assertSame('[]', await($handler->handle([]), $loop));
17+
self::assertSame('[]', await($handler->encode([]), $loop));
1818
}
1919

2020
public function testFailure()
@@ -24,6 +24,6 @@ public function testFailure()
2424

2525
$loop = Factory::create();
2626
$handler = new JsonEncodeService($loop);
27-
await($handler->handle(["\xB1\x31"]), $loop);
27+
await($handler->encode(["\xB1\x31"]), $loop);
2828
}
2929
}

0 commit comments

Comments
 (0)