public function execute($routeString, $debug = true) { $this->debug = $debug; $matchedRoute = $this->routeExecuter($routeString); $matchedRouteName = $matchedRoute[0]; /** @var Route $matchedRoute */ $matchedRoute = $matchedRoute[1]; $namesExplode = explode(".", $matchedRouteName); $myselfhander = function () use($matchedRouteName, $matchedRoute, $namesExplode) { $this->contextExecuter($namesExplode); $result = $matchedRoute->invoke(); $this->contextExecuter($namesExplode, false); return $result; }; $_matchedRouteName = $namesExplode; $_matchedRouteNameCount = count($_matchedRouteName); $handers[] = CallBack::init(["name" => '__$$$$$__', "callback" => $myselfhander]); for ($i = 1; $i <= $_matchedRouteNameCount; $i++) { $name = implode(".", $_matchedRouteName); array_pop($_matchedRouteName); if (isset($this->handlers[$name])) { $handers[] = $this->handlers[$name][1]; } } $this->handlerExecuter($handers, count($handers), 1); }