diff --git a/src/Helpers/ValueGetter.php b/src/Helpers/ValueGetter.php index b01846a..2752c36 100644 --- a/src/Helpers/ValueGetter.php +++ b/src/Helpers/ValueGetter.php @@ -14,38 +14,19 @@ final class ValueGetter { /** - * @param array $response + * @param array $response * * @return mixed * * @psalm-template T - * @psalm-param array $response + * @psalm-param array $response * @psalm-return T */ public static function first(array $response) { - return self::batchFirst([$response])[0]; - } - - /** - * @param list> $responses - * - * @return list - * - * @psalm-template T - * @psalm-param list> $responses - * @psalm-return list - */ - public static function batchFirst(array $responses) : array - { - $result = []; - foreach ($responses as $response) { - $first = array_shift($response); - if ($first === null) { - throw GeneralException::new('Expected non-empty array'); - } - - $result[] = $first; + $result = array_shift($response); + if ($result === null) { + throw GeneralException::new('Expected non-empty array'); } return $result; diff --git a/tests/Helpers/ValueGetterTest.php b/tests/Helpers/ValueGetterTest.php index 0645dcc..cb5cc89 100644 --- a/tests/Helpers/ValueGetterTest.php +++ b/tests/Helpers/ValueGetterTest.php @@ -26,20 +26,6 @@ public function testFirstWithUnexpectedData() : void ValueGetter::first([]); } - public function testBatchFirst() : void - { - $responses = [['.1.2.3.1' => 'a'], ['.3.4.5.1' => 'b']]; - - self::assertSame(['a', 'b'], ValueGetter::batchFirst($responses)); - } - - public function testBatchFirstWithUnexpectedData() : void - { - $this->expectExceptionObject(GeneralException::new('Expected non-empty array')); - - ValueGetter::batchFirst([[]]); - } - public function testFirstFromSameTree() : void { $snmpClient = $this->createMock(SnmpClient::class);