Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NoRouteHandlerList.php
Go to the documentation of this file.
1 <?php
9 
11 {
17  protected $_handlers;
18 
22  protected $_handlerList;
23 
27  protected $_objectManager;
28 
33  public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, array $handlerClassesList)
34  {
35  $this->_handlerList = $handlerClassesList;
36  $this->_objectManager = $objectManager;
37  }
38 
44  public function getHandlers()
45  {
46  if (!$this->_handlers) {
47  //sorting handlers list
48  $sortedHandlersList = [];
49  foreach ($this->_handlerList as $handlerInfo) {
50  if (isset($handlerInfo['class']) && isset($handlerInfo['sortOrder'])) {
51  $sortedHandlersList[$handlerInfo['class']] = $handlerInfo['sortOrder'];
52  }
53  }
54 
55  asort($sortedHandlersList);
56 
57  //creating handlers
58  foreach (array_keys($sortedHandlersList) as $handlerInstance) {
59  $this->_handlers[] = $this->_objectManager->create($handlerInstance);
60  }
61  }
62 
63  return $this->_handlers;
64  }
65 }
$objectManager
Definition: bootstrap.php:17
__construct(\Magento\Framework\ObjectManagerInterface $objectManager, array $handlerClassesList)