-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathGatewayInterface.php
More file actions
31 lines (28 loc) · 1.57 KB
/
Copy pathGatewayInterface.php
File metadata and controls
31 lines (28 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
namespace Payum\Core;
use Payum\Core\Command\CommandInterface;
use Payum\Core\Exception\RequestNotSupportedException;
use Payum\Core\Reply\ReplyInterface;
use Payum\Core\Result\Result;
/**
* @method bool supportsCommand(class-string<CommandInterface<Result>> $commandClass) Whether a handler is registered for the command. Implemented by Payum\Core\Gateway; annotated rather than declared so implementations of this interface keep working.
*/
interface GatewayInterface
{
/**
* @param CommandInterface<Result>|mixed $request
* @param bool $catchReply If false the reply behave like an exception. If true the reply will be caught internally and returned.
*
* @throws RequestNotSupportedException If there is not an action which able to process the request.
* @throws ReplyInterface Gateway throws reply if some external tasks have to be done. For example show a credit card form, an iframe or perform a redirect.
*
* The return type forks with the argument, which is the price of keeping one entry point for both
* generations: a command is answered with a Result, while a v1 request still signals by throwing a
* reply (or returning it, when $catchReply is true). Narrowing a Result further -- CaptureCommand to
* CaptureResult -- needs a DynamicMethodReturnTypeExtension reading the result type each command
* declares on CommandInterface, which arrives with the executor.
*
* @return ($request is CommandInterface<Result> ? Result : ReplyInterface|null)
*/
public function execute($request, $catchReply = false);
}