Skip to content

Commit

Permalink
fix: php-cs-fixer and phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
fox-john committed Oct 31, 2024
1 parent 1f32d92 commit efbfc7b
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/Repository/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ protected function runQuery($disableCurrentExplain = null)
$this->debugQuery();
}

$result = $this->db->executeS($this->query);
$result = (array) $this->db->executeS($this->query);

return $result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Repository/StateRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getStateIsoCodesByZoneId($zoneId, $active)
;

$this->query->select('s.iso_code');

$result = $this->runQuery(true);

foreach ($result as $state) {
Expand Down
2 changes: 1 addition & 1 deletion src/Service/ApiShopContentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function handleDataSync($shopContent, $jobId, $langIso, $limit, $fullSync
$fullSyncIsFinished = $typeSync['full_sync_finished'];
$offset = (int) $typeSync['offset'];
}

if ($isFullSync) {
$response = $this->synchronizationService->sendFullSync(
$shopContent,
Expand Down
3 changes: 1 addition & 2 deletions src/Service/CommonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public static function exitWithResponse($response)
*/
public static function exitWithExceptionMessage(\Exception $exception)
{

$code = $exception->getCode() == 0 ? 500 : $exception->getCode();

switch ($exception) {
Expand All @@ -84,7 +83,7 @@ public static function exitWithExceptionMessage(\Exception $exception)
'object_type' => \Tools::getValue('shopContent'),
'status' => false,
'httpCode' => $code,
'message' => $code == 500 ? 'Server error' : $exception->getMessage()
'message' => $code == 500 ? 'Server error' : $exception->getMessage(),
];

self::dieWithResponse($response, (int) $code);
Expand Down
8 changes: 4 additions & 4 deletions src/Service/ShopContent/CarrierDetailsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct(CarrierRepository $carrierRepository)
public function getContentsForFull($offset, $limit, $langIso)
{
$result = $this->carrierRepository->retrieveContentsForFull($offset, $limit, $langIso);

if (empty($result)) {
return [];
}
Expand Down Expand Up @@ -88,7 +88,7 @@ public function getContentsForFull($offset, $limit, $langIso)
public function getContentsForIncremental($limit, $upsertedContents, $deletedContents, $langIso)
{
$result = $this->carrierRepository->retrieveContentsForIncremental($limit, array_column($upsertedContents, 'id'), $langIso);

if (!empty($result)) {
$carrierDetails = [];

Expand Down Expand Up @@ -179,7 +179,7 @@ private function buildCarrierDetails($carrierData)

/** @var array<mixed> $stateIsoCodes */
$stateIsoCodes = $stateRepository->getStateIsoCodesByZoneId($zone['id_zone'], true);

$carrierDetail = [];
$carrierDetail['id_reference'] = $carrier->id_reference;
$carrierDetail['id_zone'] = $zone['id_zone'];
Expand All @@ -193,7 +193,7 @@ private function buildCarrierDetails($carrierData)
$carrierDetail['price'] = $zone['price'];

array_push($carrierDetails, $carrierDetail);
}
}
}

return $carrierDetails;
Expand Down
6 changes: 2 additions & 4 deletions src/Service/ShopContent/ShopContentAbstractService.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ abstract class ShopContentAbstractService
{
/**
* @param string $collection
* @param string $idKeyForBinding
* @param array<mixed> $upsertedContents
* @param array<mixed> $upsertedList
* @param array<mixed> $deletedList
*
* @return array<mixed>
Expand All @@ -47,7 +45,7 @@ protected function formatIncrementalSyncResponse($collection, $upsertedContents,
{
$data = [];

foreach($upsertedContents as $upsertedContent) {
foreach ($upsertedContents as $upsertedContent) {
$data[] = [
'action' => Config::INCREMENTAL_TYPE_UPSERT,
'collection' => $collection,
Expand All @@ -60,7 +58,7 @@ protected function formatIncrementalSyncResponse($collection, $upsertedContents,
'action' => Config::INCREMENTAL_TYPE_DELETE,
'collection' => $collection,
'properties' => [
'id' => $item['id']
'id' => $item['id'],
],
];
}
Expand Down
2 changes: 1 addition & 1 deletion src/Service/ShopContent/ThemesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function getContentsForIncremental($limit, $upsertedContents, $deletedCon
$themes = $this->formatThemes($result);
}

return parent::formatIncrementalSyncResponse(Config::COLLECTION_THEMES, 'theme_id', $themes, $upsertedContents, $deletedContents);
return parent::formatIncrementalSyncResponse(Config::COLLECTION_THEMES, $themes, $deletedContents);
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/Service/SynchronizationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ public function sendIncrementalSync(
int $limit,
int $startTime
) {

$response = [];

$serviceName = str_replace('_', '', ucwords($shopContent, '_'));
Expand Down

0 comments on commit efbfc7b

Please sign in to comment.