Get middle ware from Route

@param Route $route

@return array
165833
private function getMiddleWareFromRoute(Route $route)
    {
        if (!$route->group) {
            return $route->middleWare;
        }
        $groupMiddleWare = $this->getMiddleWareFromGroup($route->group);
        return \array_merge($groupMiddleWare, $route->middleWare);
    }
150672
public function route($route, $prefix = null)
    {
        $this->route = substr($route, strlen($prefix));
        $parameters = [];

        // Go through predefined routes till a match is found
        foreach ($this->routeOrder as $routeName) {
            $routeDescription = $this->routes[$routeName];
            $parameters = $this->match($this->route, $routeDescription);
            if ($parameters !== false) {
                return [
                    'route' => $this->route,
                    'parameters' => $this->fillInDefaultParameters($routeDescription, $parameters),
                    'description' => $routeDescription
                ];
            }
        }
        return [
            'route' => $this->route,
            'parameters' => $parameters,
            'description' => $this->routes['default']
        ];
    }
1148296
public function parseRoute (Route $route) {

		if (preg_match_all('#^' . $route->getRoute () . '$#', $this->getUrl (), $matches, PREG_OFFSET_CAPTURE)) {

			// Rework matches to only contain the matches, not the orig string
			$matches = array_slice($matches, 1);

			// Extract the matched URL parameters (and only the parameters)
			$params = array_map(function($match, $index) use ($matches) {

				// We have a following parameter: take the substring from the current param position until the next one's position (thank you PREG_OFFSET_CAPTURE)
				if (isset($matches[$index+1]) && isset($matches[$index+1][0]) && is_array($matches[$index+1][0])) {
					return trim(substr($match[0][0], 0, $matches[$index+1][0][1] - $match[0][1]), '/');
				}

				// We have no following paramete: return the whole lot
				else {
					return (isset($match[0][0]) ? trim($match[0][0], '/') : null);
				}

			}, $matches, array_keys($matches));

			if (empty ($params)) {
				return true;
			}
			else {
				return $params;
			}
		}

		return false;
	}
853197
private function getRouteName(Route $route)
    {
        return is_null($name = $route->getName()) ? $route->uri() : $name;
    }
13055
private function getMiddleWareFromGroup(RouteGroup $group, array $middleWareList = [])
    {
        if ($group->middleWare) {
            $middleWareList = \array_merge($group->middleWare, $middleWareList);
        }
        if (\is_null($group->parentGroup)) {
            return $middleWareList;
        }
        return $this->getMiddleWareFromGroup($group->parentGroup, $middleWareList);
    }
213165
public function inflect(Route $route)
    {
        $arguments = $this->extractAttributes($route);
        return $this->createDispatch($arguments);
    }
1022150
public function get($route)
    {
        $this->ensureStorage();

        return isset($this->storage[$route]) ? $this->storage[$route] : null;
    }
439553
protected function fromRoute(Router\Route $route)
    {
        return $this->newInstance(
            $route->input,
            $route->domain,
            $route->responder
        );
    }
1293542
function getMiddlewareNames(route) {
		var middleware = getRouteMiddleware(route);

		// If the middleware is an array, just return it
		if ( middleware instanceof Array ) {
			return middleware;
		}

		// If there is no middleware, then return an empty array
		if ( typeof middleware === 'undefined' ) {
			return [];
		}

		// Otherwise, split the pipes & return an array
		return middleware.split('|');
	}
813167
public function getFromRequest($route = null) {
        $resolvers = [];
        foreach ($this->segmentsResolvers as $key => $resolverClass) {
            if( $bindedClass = request()->route($key) ) {
                $resolvers[$key] = new $resolverClass($bindedClass);
            }
        }
        // sort resolvers in same order they are in request
        if (!empty($resolvers)) {
            if (empty($route)) {
                $route = \Route::getCurrentRoute()->uri();
            }       
            $segments = explode('/', $route);
            $sortedResolvers = [];
            foreach($segments as $segment) {
                $segment = trim($segment, "{}");
                if (isset($resolvers [$segment])) {
                    $sortedResolvers[$segment] = $resolvers[$segment];
                }
            }
            $resolvers = $sortedResolvers;
        }
        return empty($resolvers) ? false  : $resolvers;
    }
1042008
protected function  handleFoundRoute($route, Request $request)
    {
        $this->currentRoute = $route;
        $request->attributes->add($route[2]);

        if (isset($route[1]['middleware']) && !empty($route[1]['middleware'])) {
            $middleware = $route[1]['middleware'];
            $middleware = is_string($middleware) ? explode('|', $middleware) : (array) $middleware;
            $middleware = array_map(function ($m) { return $this->middlewareNamespace .'\\'. $m; }, $middleware);

            $response = (new Pipeline())->send($request)->through($middleware)
                ->then(function () use ($route, $request) {
                    return $this->callAction($route, $request);
                });
        }
        else {
            $response = $this->callAction($route, $request);
        }

        if (!$response instanceof Response) {
            $response = new Response($response);
        }

        return $response;
    }
884441
public function parse($route)
    {
        // reset param names
        $this->paramNames = [];

        // replace shortcuts
        $regex = strtr($route, $this->shortcuts);

        // replace param names that doesn't include shortcuts or regex
        $regex = preg_replace_callback('/{([a-zA-Z0-9]+)}/', [$this, 'replaceWithoutRegex'], $regex);

        // replace param names that includes shortcuts or regex
        $regex = preg_replace_callback('/{([a-zA-Z0-9]+):/', [$this, 'replaceWithRegex'], $regex);

        // replace ending grouping
        $regex = str_replace('}', ')', $regex);

        // fix slashes when optional params are present
        $regex = $this->fixOptionalSlashes($regex);

        // fix for handling trailing slashes
        $regex .= '(/)?';

        // return regex and param names
        return ['#^'. $regex .'$#', $this->paramNames];
    }
161976
protected function getRouteInformation(Route $route)
	{
		$uri = head($route->methods()).' '.$route->uri();

		return $this->filterRoute(array(
			'host'   => $route->domain(),
			'uri'    => $uri,
			'name'   => $route->getName(),
			'action' => $route->getActionName(),
			'before' => $this->getBeforeFilters($route),
			'after'  => $this->getAfterFilters($route)
		));
	}
1130551
public static function parseRoute($route)
    {
        if (!empty($route)) {
            $url = [];
            $r = explode('&', $route);
            $url[0] = $r[0];
            unset($r[0]);
            foreach ($r as $part) {
                $part = explode('=', $part);
                $url[$part[0]] = isset($part[1]) ? $part[1] : '';
            }

            return $url;
        }

        return '#';
    }
1108522
protected function parseRoute($route)
    {
        $parsedRoute = parse_url($route);

        if (isset($parsedRoute['query'])) {
            parse_str($parsedRoute['query'], $parsedRoute['params']);
        } else {
            $parsedRoute['params'] = [];
        }

        $resolvedRoute = new Resolver(new \common_http_Request($route));
        $this->propagate($resolvedRoute);
        $parsedRoute['extension']         = $resolvedRoute->getExtensionId();
        $parsedRoute['controller']        = $resolvedRoute->getControllerShortName();
        $parsedRoute['controller_class']  = $resolvedRoute->getControllerClass();
        $parsedRoute['action']            = $resolvedRoute->getMethodName();

        return $parsedRoute;
    }
841530
private function signatureParameters(Route $route)
    {
        return collect($route->signatureParameters())
            ->reject(function (ReflectionParameter $parameter) use ($route) {
                return !array_key_exists($parameter->name, $route->parameters());
            })
            ->reject(function (ReflectionParameter $parameter) {
                return !$parameter->getClass();
            })->toArray();
    }
293125
public function match(string $route): array
    {
        if (!isset($this->routes[$route])) {
            return [];
        }

        return $this->routes[$route];
    }