Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
HandlerComposite.php
Go to the documentation of this file.
1 <?php
7 
10 
12 {
16  private $handlers = [];
17 
21  public function __construct(array $handlers = [])
22  {
23  array_walk(
24  $handlers,
25  function ($handler, $code) {
26  if (!$handler instanceof HandlerInterface) {
27  $message = 'Type mismatch. Expected type: %s. Actual: %s, Code: %s';
28 
29  throw new \LogicException(
30  sprintf($message, 'HandlerInterface', gettype($handler), $code)
31  );
32  }
33  }
34  );
35 
36  $this->handlers = $handlers;
37  }
38 
43  {
44  foreach ($this->handlers as $handle) {
45  $handle->handle($payment, $response);
46  }
47  }
48 }
$response
Definition: 404.php:11
$message
$payment
Definition: order.php:17
$handle
$code
Definition: info.phtml:12
catch(\Exception $e) $handler
Definition: index.php:30