Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Overview.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 
17 class Overview implements ArgumentInterface
18 {
22  private $session;
23 
27  private $addressErrors = [];
28 
32  public function __construct(
34  ) {
35  $this->session = $session;
36  }
37 
44  public function getAddressError(Address $address): string
45  {
46  $addressErrors = $this->getAddressErrors();
47 
48  return $addressErrors[$address->getId()] ?? '';
49  }
50 
56  public function getAddressErrors(): array
57  {
58  if (empty($this->addressErrors)) {
59  $this->addressErrors = $this->session->getAddressErrors(true);
60  }
61 
62  return $this->addressErrors ?? [];
63  }
64 
71  public function getAddressAnchorName(int $addressId): string
72  {
73  return 'a' . $addressId;
74  }
75 }
$address
Definition: customer.php:38
__construct(SessionManagerInterface $session)
Definition: Overview.php:32