From 01d29e1497cff238618ada95235a11f58b7a8ba3 Mon Sep 17 00:00:00 2001 From: mesilov Date: Mon, 31 Oct 2022 23:16:12 +0400 Subject: [PATCH] rename batch interface Signed-off-by: mesilov --- CHANGELOG.md | 1 + src/Core/Batch.php | 4 ++-- src/Core/BulkItemsReader/BulkItemsReaderBuilder.php | 12 ++++++------ .../FilterWithBatchWithoutCountOrder.php | 10 +++++----- ...tchInterface.php => BatchOperationsInterface.php} | 4 ++-- src/Services/AbstractBatchService.php | 10 +++++----- src/Services/AbstractServiceBuilder.php | 8 ++++---- src/Services/CRM/Deal/Service/Batch.php | 10 +++++----- src/Services/CRM/Lead/Service/Batch.php | 10 +++++----- tests/Unit/Stubs/NullBatch.php | 4 ++-- tools/PerformanceBenchmarks/ListCommand.php | 4 ++-- 11 files changed, 39 insertions(+), 38 deletions(-) rename src/Core/Contracts/{BatchInterface.php => BatchOperationsInterface.php} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 08592589..43c59228 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Added ### Changed +* ❗️Batch interface `BatchInterface` [renamed](https://github.com/mesilov/bitrix24-php-sdk/issues/324) to `Bitrix24\SDK\Core\Contracts\BatchOperationsInterface` ### Bugfix * fix [typehint at ContactItemResult](https://github.com/mesilov/bitrix24-php-sdk/issues/320) diff --git a/src/Core/Batch.php b/src/Core/Batch.php index 10224162..d4123b87 100644 --- a/src/Core/Batch.php +++ b/src/Core/Batch.php @@ -6,7 +6,7 @@ use Bitrix24\SDK\Core\Commands\Command; use Bitrix24\SDK\Core\Commands\CommandCollection; -use Bitrix24\SDK\Core\Contracts\BatchInterface; +use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; use Bitrix24\SDK\Core\Contracts\CoreInterface; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Exceptions\InvalidArgumentException; @@ -23,7 +23,7 @@ * * @package Bitrix24\SDK\Core */ -class Batch implements BatchInterface +class Batch implements BatchOperationsInterface { private CoreInterface $core; private LoggerInterface $logger; diff --git a/src/Core/BulkItemsReader/BulkItemsReaderBuilder.php b/src/Core/BulkItemsReader/BulkItemsReaderBuilder.php index 32e99a0e..0c0fa8ea 100644 --- a/src/Core/BulkItemsReader/BulkItemsReaderBuilder.php +++ b/src/Core/BulkItemsReader/BulkItemsReaderBuilder.php @@ -5,7 +5,7 @@ namespace Bitrix24\SDK\Core\BulkItemsReader; use Bitrix24\SDK\Core\BulkItemsReader\ReadStrategies\FilterWithBatchWithoutCountOrder; -use Bitrix24\SDK\Core\Contracts\BatchInterface; +use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; use Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface; use Bitrix24\SDK\Core\Contracts\CoreInterface; use Psr\Log\LoggerInterface; @@ -13,16 +13,16 @@ class BulkItemsReaderBuilder { protected CoreInterface $core; - protected BatchInterface $batch; + protected BatchOperationsInterface $batch; protected LoggerInterface $logger; protected BulkItemsReaderInterface $readStrategy; /** - * @param \Bitrix24\SDK\Core\Contracts\CoreInterface $core - * @param \Bitrix24\SDK\Core\Contracts\BatchInterface $batch - * @param \Psr\Log\LoggerInterface $logger + * @param \Bitrix24\SDK\Core\Contracts\CoreInterface $core + * @param \Bitrix24\SDK\Core\Contracts\BatchOperationsInterface $batch + * @param \Psr\Log\LoggerInterface $logger */ - public function __construct(CoreInterface $core, BatchInterface $batch, LoggerInterface $logger) + public function __construct(CoreInterface $core, BatchOperationsInterface $batch, LoggerInterface $logger) { $this->core = $core; $this->batch = $batch; diff --git a/src/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrder.php b/src/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrder.php index ef58f410..b8eed12d 100644 --- a/src/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrder.php +++ b/src/Core/BulkItemsReader/ReadStrategies/FilterWithBatchWithoutCountOrder.php @@ -4,21 +4,21 @@ namespace Bitrix24\SDK\Core\BulkItemsReader\ReadStrategies; -use Bitrix24\SDK\Core\Contracts\BatchInterface; +use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; use Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface; use Generator; use Psr\Log\LoggerInterface; class FilterWithBatchWithoutCountOrder implements BulkItemsReaderInterface { - private BatchInterface $batch; + private BatchOperationsInterface $batch; private LoggerInterface $log; /** - * @param \Bitrix24\SDK\Core\Contracts\BatchInterface $batch - * @param \Psr\Log\LoggerInterface $log + * @param \Bitrix24\SDK\Core\Contracts\BatchOperationsInterface $batch + * @param \Psr\Log\LoggerInterface $log */ - public function __construct(BatchInterface $batch, LoggerInterface $log) + public function __construct(BatchOperationsInterface $batch, LoggerInterface $log) { $this->batch = $batch; $this->log = $log; diff --git a/src/Core/Contracts/BatchInterface.php b/src/Core/Contracts/BatchOperationsInterface.php similarity index 97% rename from src/Core/Contracts/BatchInterface.php rename to src/Core/Contracts/BatchOperationsInterface.php index b6f0744e..801beab6 100644 --- a/src/Core/Contracts/BatchInterface.php +++ b/src/Core/Contracts/BatchOperationsInterface.php @@ -9,11 +9,11 @@ use Generator; /** - * Interface BatchInterface + * Interface BatchOperationsInterface * * @package Bitrix24\SDK\Core\Contracts */ -interface BatchInterface +interface BatchOperationsInterface { /** * Batch wrapper for *.list methods without counting elements on every api-call diff --git a/src/Services/AbstractBatchService.php b/src/Services/AbstractBatchService.php index c3d30071..c62a6b69 100644 --- a/src/Services/AbstractBatchService.php +++ b/src/Services/AbstractBatchService.php @@ -4,7 +4,7 @@ namespace Bitrix24\SDK\Services; -use Bitrix24\SDK\Core\Contracts\BatchInterface; +use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; use Psr\Log\LoggerInterface; /** @@ -14,16 +14,16 @@ */ abstract class AbstractBatchService { - protected BatchInterface $batch; + protected BatchOperationsInterface $batch; protected LoggerInterface $log; /** * Batch constructor. * - * @param BatchInterface $batch - * @param LoggerInterface $log + * @param BatchOperationsInterface $batch + * @param LoggerInterface $log */ - public function __construct(BatchInterface $batch, LoggerInterface $log) + public function __construct(BatchOperationsInterface $batch, LoggerInterface $log) { $this->batch = $batch; $this->log = $log; diff --git a/src/Services/AbstractServiceBuilder.php b/src/Services/AbstractServiceBuilder.php index 186b5867..36c97565 100644 --- a/src/Services/AbstractServiceBuilder.php +++ b/src/Services/AbstractServiceBuilder.php @@ -5,7 +5,7 @@ namespace Bitrix24\SDK\Services; -use Bitrix24\SDK\Core\Contracts\BatchInterface; +use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; use Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface; use Bitrix24\SDK\Core\Contracts\CoreInterface; use Psr\Log\LoggerInterface; @@ -18,7 +18,7 @@ abstract class AbstractServiceBuilder { protected CoreInterface $core; - protected BatchInterface $batch; + protected BatchOperationsInterface $batch; protected BulkItemsReaderInterface $bulkItemsReader; protected LoggerInterface $log; protected array $serviceCache; @@ -27,13 +27,13 @@ abstract class AbstractServiceBuilder * AbstractServiceBuilder constructor. * * @param CoreInterface $core - * @param BatchInterface $batch + * @param BatchOperationsInterface $batch * @param \Bitrix24\SDK\Core\Contracts\BulkItemsReaderInterface $bulkItemsReader * @param LoggerInterface $log */ public function __construct( CoreInterface $core, - BatchInterface $batch, + BatchOperationsInterface $batch, BulkItemsReaderInterface $bulkItemsReader, LoggerInterface $log ) { diff --git a/src/Services/CRM/Deal/Service/Batch.php b/src/Services/CRM/Deal/Service/Batch.php index e5351495..6be17a0a 100644 --- a/src/Services/CRM/Deal/Service/Batch.php +++ b/src/Services/CRM/Deal/Service/Batch.php @@ -4,7 +4,7 @@ namespace Bitrix24\SDK\Services\CRM\Deal\Service; -use Bitrix24\SDK\Core\Contracts\BatchInterface; +use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Result\AddedItemBatchResult; use Bitrix24\SDK\Core\Result\DeletedItemBatchResult; @@ -20,16 +20,16 @@ */ class Batch { - protected BatchInterface $batch; + protected BatchOperationsInterface $batch; protected LoggerInterface $log; /** * Batch constructor. * - * @param BatchInterface $batch - * @param LoggerInterface $log + * @param BatchOperationsInterface $batch + * @param LoggerInterface $log */ - public function __construct(BatchInterface $batch, LoggerInterface $log) + public function __construct(BatchOperationsInterface $batch, LoggerInterface $log) { $this->batch = $batch; $this->log = $log; diff --git a/src/Services/CRM/Lead/Service/Batch.php b/src/Services/CRM/Lead/Service/Batch.php index 934457c5..e34bdbbb 100644 --- a/src/Services/CRM/Lead/Service/Batch.php +++ b/src/Services/CRM/Lead/Service/Batch.php @@ -4,7 +4,7 @@ namespace Bitrix24\SDK\Services\CRM\Lead\Service; -use Bitrix24\SDK\Core\Contracts\BatchInterface; +use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Result\AddedItemBatchResult; use Bitrix24\SDK\Core\Result\DeletedItemBatchResult; @@ -19,16 +19,16 @@ */ class Batch { - protected BatchInterface $batch; + protected BatchOperationsInterface $batch; protected LoggerInterface $log; /** * Batch constructor. * - * @param BatchInterface $batch - * @param LoggerInterface $log + * @param BatchOperationsInterface $batch + * @param LoggerInterface $log */ - public function __construct(BatchInterface $batch, LoggerInterface $log) + public function __construct(BatchOperationsInterface $batch, LoggerInterface $log) { $this->batch = $batch; $this->log = $log; diff --git a/tests/Unit/Stubs/NullBatch.php b/tests/Unit/Stubs/NullBatch.php index 14ddbb6f..f775dab6 100644 --- a/tests/Unit/Stubs/NullBatch.php +++ b/tests/Unit/Stubs/NullBatch.php @@ -4,7 +4,7 @@ namespace Bitrix24\SDK\Tests\Unit\Stubs; -use Bitrix24\SDK\Core\Contracts\BatchInterface; +use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; use Bitrix24\SDK\Core\Exceptions\BaseException; use Bitrix24\SDK\Core\Response\DTO\ResponseData; use Generator; @@ -14,7 +14,7 @@ * * @package Bitrix24\SDK\Tests\Unit\Stubs */ -class NullBatch implements BatchInterface +class NullBatch implements BatchOperationsInterface { /** diff --git a/tools/PerformanceBenchmarks/ListCommand.php b/tools/PerformanceBenchmarks/ListCommand.php index 1a5d06f7..a06c78a9 100644 --- a/tools/PerformanceBenchmarks/ListCommand.php +++ b/tools/PerformanceBenchmarks/ListCommand.php @@ -5,7 +5,7 @@ namespace Bitrix24\SDK\Tools\PerformanceBenchmarks; use Bitrix24\SDK\Core\Batch; -use Bitrix24\SDK\Core\Contracts\BatchInterface; +use Bitrix24\SDK\Core\Contracts\BatchOperationsInterface; use Bitrix24\SDK\Core\Contracts\CoreInterface; use Bitrix24\SDK\Core\CoreBuilder; use Bitrix24\SDK\Core\Credentials\Credentials; @@ -34,7 +34,7 @@ class ListCommand extends Command { protected LoggerInterface $logger; protected CoreInterface $core; - protected BatchInterface $batch; + protected BatchOperationsInterface $batch; /** * @var string */