Skip to content

Commit

Permalink
Rename webhook consumer to webhook parser
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Jun 17, 2024
1 parent 50e6943 commit e21df30
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

declare(strict_types=1);

namespace Setono\PeakWMS\Consumer;
namespace Setono\PeakWMS\Parser;

use CuyZ\Valinor\MapperBuilder;
use Setono\PeakWMS\DataTransferObject\Webhook\Name;
use Setono\PeakWMS\DataTransferObject\Webhook\WebhookDataPickOrderPacked;
use Setono\PeakWMS\DataTransferObject\Webhook\WebhookDataStockAdjust;

final class WebhookConsumer implements WebhookConsumerInterface
final class WebhookParser implements WebhookParserInterface
{
private ?MapperBuilder $mapperBuilder = null;

public function consume(string $json, string $dataClass): object
public function parse(string $json, string $dataClass): object
{
return $this
->getMapperBuilder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace Setono\PeakWMS\Consumer;
namespace Setono\PeakWMS\Parser;

interface WebhookConsumerInterface
interface WebhookParserInterface
{
/**
* @template T
Expand All @@ -13,5 +13,5 @@ interface WebhookConsumerInterface
*
* @return T
*/
public function consume(string $json, string $dataClass): object;
public function parse(string $json, string $dataClass): object;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Setono\PeakWMS\Consumer;
namespace Setono\PeakWMS\Parser;

use PHPUnit\Framework\TestCase;
use Setono\PeakWMS\DataTransferObject\Webhook\Name;
Expand All @@ -15,7 +15,7 @@ final class WebhookConsumerTest extends TestCase
*/
public function it_converts_name_to_data_class(): void
{
self::assertSame(WebhookDataStockAdjust::class, WebhookConsumer::convertNameToDataClass(100));
self::assertSame(WebhookDataStockAdjust::class, WebhookConsumer::convertNameToDataClass(Name::StockAdjust));
self::assertSame(WebhookDataStockAdjust::class, WebhookParser::convertNameToDataClass(100));
self::assertSame(WebhookDataStockAdjust::class, WebhookParser::convertNameToDataClass(Name::StockAdjust));
}
}

0 comments on commit e21df30

Please sign in to comment.