Skip to content

Commit 8ffaa3e

Browse files
authored
Removed deprecated code - unserialize, dead imports. (#313)
1 parent 2e08a6b commit 8ffaa3e

File tree

2 files changed

+1
-42
lines changed

2 files changed

+1
-42
lines changed

src/Client.php

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use RuntimeException;
2828
use Vonage\Account\ClientFactory;
2929
use Vonage\Application\ClientFactory as ApplicationClientFactory;
30-
use Vonage\Call\Collection;
3130
use Vonage\Client\APIResource;
3231
use Vonage\Client\Credentials\Basic;
3332
use Vonage\Client\Credentials\Container;
@@ -46,46 +45,35 @@
4645
use Vonage\Client\Exception\Exception as ClientException;
4746
use Vonage\Client\Factory\FactoryInterface;
4847
use Vonage\Client\Factory\MapFactory;
49-
use Vonage\Client\Signature;
50-
use Vonage\Conversations\ClientFactory as ConversationsClientFactory;
5148
use Vonage\Conversion\ClientFactory as ConversionClientFactory;
5249
use Vonage\Entity\EntityInterface;
5350
use Vonage\Insights\ClientFactory as InsightsClientFactory;
54-
use Vonage\Logger\LoggerAwareInterface;
55-
use Vonage\Message\Client as MessageClient;
5651
use Vonage\Numbers\ClientFactory as NumbersClientFactory;
5752
use Vonage\Redact\ClientFactory as RedactClientFactory;
5853
use Vonage\Secrets\ClientFactory as SecretsClientFactory;
5954
use Vonage\SMS\ClientFactory as SMSClientFactory;
6055
use Vonage\Verify\ClientFactory as VerifyClientFactory;
6156
use Vonage\Verify\Verification;
6257
use Vonage\Voice\ClientFactory as VoiceClientFactory;
58+
use Vonage\Logger\{LoggerAwareInterface, LoggerTrait};
6359

6460
use function array_key_exists;
6561
use function array_merge;
66-
use function base64_encode;
6762
use function call_user_func_array;
6863
use function get_class;
6964
use function http_build_query;
7065
use function implode;
7166
use function is_null;
72-
use function is_string;
73-
use function json_decode;
7467
use function json_encode;
7568
use function method_exists;
76-
use function parse_str;
7769
use function set_error_handler;
7870
use function str_replace;
7971
use function strpos;
80-
use function unserialize;
81-
use Vonage\Logger\LoggerTrait;
82-
use Vonage\User\ClientFactory as UserClientFactory;
8372

8473
/**
8574
* Vonage API Client, allows access to the API from PHP.
8675
*
8776
* @method Account\Client account()
88-
* @method Message\Client message()
8977
* @method Application\Client applications()
9078
* @method Conversion\Client conversion()
9179
* @method Insights\Client insights()
@@ -95,8 +83,6 @@
9583
* @method SMS\Client sms()
9684
* @method Verify\Client verify()
9785
* @method Voice\Client voice()
98-
* @method User\Collection user()
99-
* @method Conversation\Collection conversation()
10086
*
10187
* @property string restUrl
10288
* @property string apiUrl
@@ -105,7 +91,6 @@ class Client implements LoggerAwareInterface
10591
{
10692
use LoggerTrait;
10793

108-
public const VERSION = '2.9.2';
10994
public const BASE_API = 'https://api.nexmo.com';
11095
public const BASE_REST = 'https://rest.nexmo.com';
11196

@@ -210,12 +195,6 @@ public function __construct(CredentialsInterface $credentials, $options = [], ?C
210195
$this->setFactory(
211196
new MapFactory(
212197
[
213-
// Legacy Namespaces
214-
'message' => MessageClient::class,
215-
'calls' => Collection::class,
216-
'conversation' => ConversationsClientFactory::class,
217-
'user' => UserClientFactory::class,
218-
219198
// Registered Services by name
220199
'account' => ClientFactory::class,
221200
'applications' => ApplicationClientFactory::class,
@@ -564,24 +543,6 @@ public function serialize(EntityInterface $entity): string
564543
throw new RuntimeException('unknown class `' . get_class($entity) . '``');
565544
}
566545

567-
/**
568-
* @param string|Verification $entity
569-
*
570-
* @deprecated
571-
*/
572-
public function unserialize($entity): Verification
573-
{
574-
if (is_string($entity)) {
575-
$entity = unserialize($entity);
576-
}
577-
578-
if ($entity instanceof Verification) {
579-
return $this->verify()->unserialize($entity);
580-
}
581-
582-
throw new RuntimeException('unknown class `' . get_class($entity) . '``');
583-
}
584-
585546
public function __call($name, $args)
586547
{
587548
if (!$this->factory->hasApi($name)) {

test/ClientTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,8 @@ public function testSerializationProxiesVerify(): void
525525

526526
$verification = @new Verification('15554441212', 'test app');
527527
$verify->serialize($verification)->willReturn('string data')->shouldBeCalled();
528-
$verify->unserialize($verification)->willReturn($verification)->shouldBeCalled();
529528

530529
$this->assertEquals('string data', $client->serialize($verification));
531-
$this->assertEquals($verification, $client->unserialize(serialize($verification)));
532530
}
533531

534532
/**

0 commit comments

Comments
 (0)