61 $cacheId =
'RoutesConfig' 63 $this->_reader = $reader;
65 $this->_cacheId = $cacheId;
66 $this->_configScope = $configScope;
67 $this->_areaList = $areaList;
78 $scope = $scope ?: $this->_configScope->getCurrentScope();
79 if (isset($this->_routes[$scope])) {
80 return $this->_routes[$scope];
83 $cachedRoutes = $this->_cache->load($cacheId);
85 $cachedRoutes = $this->getSerializer()->unserialize($cachedRoutes);
86 if (is_array($cachedRoutes)) {
87 $this->_routes[$scope] = $cachedRoutes;
92 $routers = $this->_reader->read($scope);
93 $routes = $routers[$this->_areaList->getDefaultRouter($scope)][
'routes'];
94 $routesData = $this->getSerializer()->serialize($routes);
95 $this->_cache->save($routesData, $cacheId);
96 $this->_routes[$scope] = $routes;
110 return isset($routes[$routeId]) ? $routes[$routeId][
'frontName'] : $routeId;
120 foreach ($this->
_getRoutes($scope) as $routeId => $routeData) {
121 if ($routeData[
'frontName'] == $frontName) {
138 foreach ($routes as $routeData) {
139 if ($routeData[
'frontName'] == $frontName && isset($routeData[
'modules'])) {
140 $modules = $routeData[
'modules'];
145 return array_unique($modules);
154 private function getSerializer()
156 if ($this->serializer ===
null) {
158 ->get(SerializerInterface::class);
160 return $this->serializer;
getModulesByFrontName($frontName, $scope=null)
getRouteFrontName($routeId, $scope=null)
getRouteByFrontName($frontName, $scope=null)
__construct(Config\Reader $reader, \Magento\Framework\Config\CacheInterface $cache, \Magento\Framework\Config\ScopeInterface $configScope, \Magento\Framework\App\AreaList $areaList, $cacheId='RoutesConfig')