src/mako/http/routing/Dispatcher.php
protected function addMiddlewareToStack(Onion $onion, array $middleware): void
	{
		if(empty($middleware) === false)
		{
			// Resolve middleware

			$resolved = [];

			foreach($middleware as $layer)
			{
				$layer = $this->resolveMiddleware($layer);

				$resolved[$layer['name']][] = $layer;
			}

			// Add ordered middleware to stack

			foreach($this->orderMiddlewareByPriority($resolved) as $name)
			{
				foreach($name as $layer)
				{
					$onion->addLayer($layer['middleware'], $layer['parameters']);
				}
			}
		}
	}
protected function addMiddlewareToStack(Onion $onion, array $middleware): void
	{
		if(empty($middleware) === false)
		{
			// Resolve middleware

			$resolved = [];

			foreach($middleware as $layer)
			{
				$layer = $this->resolveMiddleware($layer);

				$resolved[$layer['name']][] = $layer;
			}

			// Add ordered middleware to stack

			foreach($this->orderMiddlewareByPriority($resolved) as $name)
			{
				foreach($name as $layer)
				{
					$onion->addLayer($layer['middleware'], $layer['parameters']);
				}
			}
		}
	}
protected function addMiddlewareToStack ( Onion $ onion , array $ middleware ) : void { if ( empty ( $ middleware ) === false ) { // Resolve middleware $ resolved = [ ] ; foreach ( $ middleware as $ layer ) { $ layer = $ this -> resolveMiddleware ( $ layer ) ; $ resolved [ $ layer [ 'name' ] ] [ ] = $ layer ; } // Add ordered middleware to stack foreach ( $ this -> orderMiddlewareByPriority ( $ resolved ) as $ name ) { foreach ( $ name as $ layer ) { $ onion -> addLayer ( $ layer [ 'middleware' ] , $ layer [ 'parameters' ] ) ; } } } }
Adds route middleware to the stack.

@param \mako\onion\Onion $onion      Middleware stack
@param array             $middleware Array of middleware
Adds route middleware to the stack .