Skip to content

Commit

Permalink
Основной функционал готов
Browse files Browse the repository at this point in the history
  • Loading branch information
gkarman committed Feb 18, 2024
1 parent 078065d commit 33e8933
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace App\Domains\Order\Application;

use App\Domains\Order\Domain\Publishers\PublisherInterface;
use App\Domains\Order\Domain\Publishers\PublisherProductChangeStatusInterface;
use App\Domains\Order\Domain\Repositories\ProductRepositoryInterface;

class CockProductProcessUseCase
{
public function __construct(
private ProductRepositoryInterface $productRepository,
private PublisherInterface $publisher,
private PublisherProductChangeStatusInterface $publisher,
)
{
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use App\Domains\Order\Domain\Entity\Product\AbstractProduct;
use App\Domains\Order\Domain\Subscribers\ProductChangeStatusSubscriberInterface;

class Publisher implements PublisherInterface
class PublisherProductChangeStatus implements PublisherProductChangeStatusInterface
{
/**
* @var ProductChangeStatusSubscriberInterface[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use App\Domains\Order\Domain\Entity\Product\AbstractProduct;
use App\Domains\Order\Domain\Subscribers\ProductChangeStatusSubscriberInterface;

interface PublisherInterface
interface PublisherProductChangeStatusInterface
{
public function subscribe(ProductChangeStatusSubscriberInterface $subscriber): void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace App\Domains\Order\Domain\Subscribers;

use App\Domains\Order\Domain\Entity\Product\AbstractProduct;

interface ProductChangeStatusSubscriberInterface
{
public function run(): void;
public function run(AbstractProduct $product): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

namespace App\Domains\Order\Domain\Subscribers;

use App\Domains\Order\Domain\Entity\Product\AbstractProduct;
use App\Domains\Order\Domain\Notifications\ProductChangeStatusNotifications\PushToClientNotify;
use App\Domains\Order\Domain\Notifications\ProductChangeStatusNotifications\PushToStaffNotify;

class SendNotificationsService implements ProductChangeStatusSubscriberInterface
{
public function run(): void
public function run(AbstractProduct $product): void
{
$notifyFirst = new PushToClientNotify();
$notifySecond = new PushToStaffNotify();
$notifyFirst->setNext($notifySecond);

$notifyFirst->handle();
$notifyFirst->handle($product);
}
}
11 changes: 6 additions & 5 deletions hw16/code/app/Infrastructure/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

use App\Domains\Order\Domain\Factories\AbstractProductFactory;
use App\Domains\Order\Domain\Factories\ProductFactory;
use App\Domains\Order\Domain\Publishers\Publisher;
use App\Domains\Order\Domain\Publishers\PublisherInterface;
use App\Domains\Order\Domain\Publishers\PublisherProductChangeStatus;
use App\Domains\Order\Domain\Publishers\PublisherProductChangeStatusInterface;
use App\Domains\Order\Domain\Repositories\OrderRepositoryInterface;
use App\Domains\Order\Domain\Repositories\ProductRepositoryInterface;
use App\Domains\Order\Domain\Strategies\Cock\CockStrategyInterface;
use App\Domains\Order\Domain\Strategies\Cock\GrillCockStrategy;
use App\Domains\Order\Domain\Subscribers\SendNotificationsService;
use App\Domains\Order\Infrastructure\Repository\OrderDatabaseRepository;
use App\Domains\Order\Infrastructure\Repository\ProductDatabaseRepository;
use Illuminate\Support\ServiceProvider;
Expand Down Expand Up @@ -46,9 +47,9 @@ private function registerStrategies(): void

private function registerPublishers(): void
{
$this->app->bind(PublisherInterface::class, function ($app) {
$publisher = new Publisher();
$publisher->subscribe(ProductCha);
$this->app->bind(PublisherProductChangeStatusInterface::class, function ($app) {
$publisher = new PublisherProductChangeStatus();
$publisher->subscribe(new SendNotificationsService());
});
}
}
2 changes: 1 addition & 1 deletion hw16/code/config/session.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@

/*
|--------------------------------------------------------------------------
| Session Cookie Domain
| Session Cookie Domains
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
Expand Down

This file was deleted.

0 comments on commit 33e8933

Please sign in to comment.