Skip to content

Commit

Permalink
chore(deps): upgrade myparcelnl/pdk to v2.24.2
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Sep 27, 2023
1 parent bf5b2aa commit 3a2cb60
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 5 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions src/Migration/Util/ToDeliveryTypeName.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace MyParcelNL\PrestaShop\Migration\Util;

final class ToDeliveryTypeName extends TransformValue
{
public function __construct()
{
parent::__construct([$this, 'convert']);
}

/**
* @param mixed $value
*
* @return string
*/
protected function convert($value): string
{
if (is_numeric($value)) {
if (in_array((int) $value, DeliveryOptions::DELIVERY_TYPES_IDS, true)) {
return array_flip(DeliveryOptions::DELIVERY_TYPES_NAMES_IDS_MAP)[$value];
}

return DeliveryOptions::DEFAULT_DELIVERY_TYPE_NAME;
}

return in_array($value, DeliveryOptions::DELIVERY_TYPES_NAMES, true)
? $value
: DeliveryOptions::DEFAULT_DELIVERY_TYPE_NAME;
}
}
23 changes: 23 additions & 0 deletions src/Migration/Util/ToPackageTypeName.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace MyParcelNL\PrestaShop\Migration\Util;

final class ToPackageTypeName extends TransformValue
{
public function __construct()
{
parent::__construct(static function ($value) {
if (is_numeric($value)) {
if (in_array((int) $value, DeliveryOptions::PACKAGE_TYPES_IDS, true)) {
return array_flip(DeliveryOptions::PACKAGE_TYPES_NAMES_IDS_MAP)[$value];
}

return DeliveryOptions::DEFAULT_PACKAGE_TYPE_NAME;
}

return in_array($value, DeliveryOptions::PACKAGE_TYPES_NAMES, true)
? $value
: DeliveryOptions::DEFAULT_PACKAGE_TYPE_NAME;
});
}
}
23 changes: 23 additions & 0 deletions src/Migration/Util/ToTriStateValue.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace MyParcelNL\PrestaShop\Migration\Util;

final class ToTriStateValue extends TransformValue
{
public function __construct()
{
parent::__construct([$this, 'convert']);
}

/**
* @param mixed $value
*
* @return mixed
*/
protected function convert($value)
{
$triStateService = Pdk::get(TriStateServiceInterface::class);

return $triStateService->cast($value);
}
}
15 changes: 15 additions & 0 deletions tests/factories/ProductFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

use MyParcelNL\PrestaShop\Tests\Factory\AbstractPsObjectModelFactory;

/**
*/
final class LangFactory extends AbstractPsObjectModelFactory
{
protected function getObjectModelClass(): string
{
return Lang::class;
}
}
5 changes: 5 additions & 0 deletions views/js/backend/admin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// GENERATED BY vite-plugin-custom-tsconfig
{
"extends": "../../tsconfig.base.json",
"include": ["./src/**/*", "!./src/__test__/**"]
}

0 comments on commit 3a2cb60

Please sign in to comment.