Files
piratepoet/mailpoet/lib/Automation/Engine/Endpoints/Automations/AutomationsDeleteEndpoint.php
Jan Lysý 525c80bac4 Fix PHPStan warnings in lib
[MAILPOET-5751]
2023-12-13 11:48:14 +01:00

35 lines
966 B
PHP

<?php declare(strict_types = 1);
namespace MailPoet\Automation\Engine\Endpoints\Automations;
use MailPoet\API\REST\Request;
use MailPoet\API\REST\Response;
use MailPoet\Automation\Engine\API\Endpoint;
use MailPoet\Automation\Engine\Builder\DeleteAutomationController;
use MailPoet\Validator\Builder;
class AutomationsDeleteEndpoint extends Endpoint {
/** @var DeleteAutomationController */
private $deleteController;
public function __construct(
DeleteAutomationController $deleteController
) {
$this->deleteController = $deleteController;
}
public function handle(Request $request): Response {
/** @var int $automationId */
$automationId = $request->getParam('id');
$automationId = intval($automationId);
$this->deleteController->deleteAutomation($automationId);
return new Response(null);
}
public static function getRequestSchema(): array {
return [
'id' => Builder::integer()->required(),
];
}
}