Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit 67c94ce

Browse files
authored
Merge pull request #397 from mesilov/feature/393-migrate-from-ramsey-uuid-to-symfony-uuid
Replace `ramsey/uuid` with `symfony/uid` package
2 parents 95e6457 + ef7d303 commit 67c94ce

File tree

4 files changed

+16
-31
lines changed

4 files changed

+16
-31
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
* improve DX - add [Rector](https://github.com/rectorphp/rector) for improve code quality and speed up releases cycle
6161

6262
### Changed
63+
* ❗️ migrate from `ramsey/uuid` to `symfony/uid`
6364
* ❗️ update scope `telephony`, scope fully rewritten
6465
* `ExternalCall` – work with external call:
6566
* `getCallRecordUploadUrl` – get url for upload call record file
@@ -115,7 +116,9 @@
115116
* add `CrmEntityType` – crm entity type enum
116117
* add `PbxType` – pbx type enum
117118
* add `SipRegistrationStatus` – pbx sip line registration status
118-
* change signature `Bitrix24\SDK\Core\Credentials\AccessToken::getRefreshToken()?string;` - add nullable option for event tokens
119+
* change signature `Bitrix24\SDK\Core\Credentials\AccessToken::getRefreshToken()?string;` - add nullable option for event tokens
120+
* change signature `Bitrix24\SDK\Core\Commands\Command::getName():?string` renamed to `getId():string`
121+
119122

120123
### Deleted
121124
* remove class `Bitrix24\SDK\Application\Requests\Events\OnApplicationInstall\Auth`

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"ext-intl": "*",
2828
"psr/log": "^2 || ^3",
2929
"fig/http-message-util": "1.1.*",
30-
"ramsey/uuid": "^3 ||^4",
3130
"nesbot/carbon": "3.3.*",
3231
"moneyphp/money": "^3 || ^4",
3332
"symfony/http-client": "^6 || ^7",

src/Core/Batch.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ protected function getTraversable(bool $isHaltOnError): Generator
737737
[
738738
'batchItemNumber' => $batchItem,
739739
'batchApiCommand' => $traversableBatchResult->getApiCommand()->getApiMethod(),
740-
'batchApiCommandUuid' => $traversableBatchResult->getApiCommand()->getUuid()->toString(),
740+
'batchApiCommandId' => $traversableBatchResult->getApiCommand()->getId(),
741741
]
742742
);
743743
// todo try to multiplex requests
@@ -831,7 +831,7 @@ private function convertToApiCommands(): array
831831
{
832832
$apiCommands = [];
833833
foreach ($this->commands as $command) {
834-
$apiCommands[$command->getName() ?? $command->getUuid()->toString()] = sprintf(
834+
$apiCommands[$command->getId()] = sprintf(
835835
'%s?%s',
836836
$command->getApiMethod(),
837837
http_build_query($command->getParameters())

src/Core/Commands/Command.php

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,18 @@
44

55
namespace Bitrix24\SDK\Core\Commands;
66

7-
use Ramsey\Uuid\Uuid;
8-
use Ramsey\Uuid\UuidInterface;
7+
use Symfony\Component\Uid\Uuid;
98

10-
/**
11-
* Class Command
12-
*
13-
* @package Bitrix24\SDK\Core\Commands
14-
*/
159
class Command
1610
{
17-
private readonly string $name;
18-
19-
private readonly \Ramsey\Uuid\UuidInterface $uuid;
20-
21-
/**
22-
* BatchCommand constructor.
23-
*
24-
*
25-
* @throws \Exception
26-
*/
27-
public function __construct(private readonly string $apiMethod, private readonly array $parameters, ?string $name = null)
28-
{
29-
$this->uuid = Uuid::uuid4();
30-
$this->name = $name ?? $this->uuid->toString();
31-
}
32-
33-
public function getUuid(): UuidInterface
11+
public function __construct(
12+
private readonly string $apiMethod,
13+
private readonly array $parameters,
14+
private ?string $id = null)
3415
{
35-
return $this->uuid;
16+
if ($id === null) {
17+
$this->id = (Uuid::v7())->toRfc4122();
18+
}
3619
}
3720

3821
public function getApiMethod(): string
@@ -45,8 +28,8 @@ public function getParameters(): array
4528
return $this->parameters;
4629
}
4730

48-
public function getName(): ?string
31+
public function getId(): string
4932
{
50-
return $this->name;
33+
return $this->id;
5134
}
5235
}

0 commit comments

Comments
 (0)