Skip to content

Commit 71e938e

Browse files
committed
Fix migrations & docblocks
1 parent 6843ff4 commit 71e938e

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

lib/Migration/Version1Date20241121160300.php

-11
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
/**
2020
* This migration changes the following:
2121
* - Adding 4 new columns for the table Source: rateLimitLimit, rateLimitRemaining, rateLimitReset & rateLimitWindow
22-
* - Adding 1 new column for the table Synchronization: CurrentPage
2322
*/
2423
class Version1Date20241121160300 extends SimpleMigrationStep {
2524

@@ -73,16 +72,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
7372
]);
7473
}
7574

76-
// Synchronizations table
77-
$table = $schema->getTable('openconnector_synchronizations');
78-
79-
if ($table->hasColumn('current_page') === false) {
80-
$table->addColumn('current_page', Types::INTEGER, [
81-
'notnull' => false,
82-
'default' => 1
83-
]);
84-
}
85-
8675
return $schema;
8776
}
8877

lib/Migration/Version1Date20241210120155.php

+15-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
/**
1919
* This migration changes the following:
20-
* - Add 1 new column for the table SynchronizationContractLogs: message
20+
* - Adding 1 new column for the table Synchronization: currentPage
21+
* - Adding 1 new column for the table SynchronizationContractLogs: message
2122
*/
2223
class Version1Date20241210120155 extends SimpleMigrationStep {
2324

@@ -41,6 +42,19 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
4142
*/
4243
$schema = $schemaClosure();
4344

45+
// Synchronizations table
46+
if ($schema->hasTable('openconnector_synchronizations') === true) {
47+
$table = $schema->getTable('openconnector_synchronizations');
48+
49+
if ($table->hasColumn('current_page') === false) {
50+
$table->addColumn('current_page', Types::INTEGER, [
51+
'notnull' => false,
52+
'default' => 1
53+
]);
54+
}
55+
}
56+
57+
// SynchronizationContractLogs table
4458
if ($schema->hasTable('openconnector_synchronization_contract_logs') === true) {
4559
$table = $schema->getTable('openconnector_synchronization_contract_logs');
4660

lib/Service/SynchronizationService.php

+17-1
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,23 @@ public function getAllObjectsFromApi(Synchronization $synchronization, ?bool $is
681681
return $objects;
682682
}
683683

684-
private function getRateLimitHeaders($source): array
684+
/**
685+
* Retrieves rate limit information from a given source and formats it as HTTP headers.
686+
*
687+
* This function extracts rate limit details from the provided source object and returns them
688+
* as an associative array of headers. The headers can be used for communicating rate limit status
689+
* in API responses or logging purposes.
690+
*
691+
* @param Source $source The source object containing rate limit details, such as limits, remaining requests, and reset times.
692+
*
693+
* @return array An associative array of rate limit headers:
694+
* - 'X-RateLimit-Limit' (int|null): The maximum number of allowed requests.
695+
* - 'X-RateLimit-Remaining' (int|null): The number of requests remaining in the current window.
696+
* - 'X-RateLimit-Reset' (int|null): The Unix timestamp when the rate limit resets.
697+
* - 'X-RateLimit-Used' (int|null): The number of requests used so far.
698+
* - 'X-RateLimit-Window' (int|null): The duration of the rate limit window in seconds.
699+
*/
700+
private function getRateLimitHeaders(Source $source): array
685701
{
686702
return [
687703
'X-RateLimit-Limit' => $source->getRateLimitLimit(),

0 commit comments

Comments
 (0)