Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
HttpMethodMap.php
Go to the documentation of this file.
1 <?php
7 declare(strict_types=1);
8 
10 
15 {
19  private $map;
20 
24  public function __construct(array $map)
25  {
26  $this->map = $this->processMap($map);
27  }
28 
37  private function processMap(array $map): array
38  {
39  $filtered = [];
40  foreach ($map as $method => $interface) {
41  $interface = trim(preg_replace('/^\\\+/', '', $interface));
42  if (!(interface_exists($interface) || class_exists($interface))) {
43  throw new \InvalidArgumentException(
44  "Interface '$interface' does not exist"
45  );
46  }
47  if (!$method) {
48  throw new \InvalidArgumentException('Invalid method given');
49  }
50 
51  $filtered[$method] = $interface;
52  }
53 
54  return $filtered;
55  }
56 
64  public function getMap(): array
65  {
66  return $this->map;
67  }
68 }
$method
Definition: info.phtml:13