public function sortMiddleware( $middleware ) {
		$sorted = $middleware;

		usort( $sorted, function ( $a, $b ) use ( $middleware ) {
			$a_priority = $this->getMiddlewarePriorityForMiddleware( $a );
			$b_priority = $this->getMiddlewarePriorityForMiddleware( $b );
			$priority = $b_priority - $a_priority;

			if ( $priority !== 0 ) {
				return $priority;
			}

			// Keep relative order from original array.
			return array_search( $a, $middleware ) - array_search( $b, $middleware );
		} );

		return array_values( $sorted );
	}
public function sortMiddleware( $middleware ) {
		$sorted = $middleware;

		usort( $sorted, function ( $a, $b ) use ( $middleware ) {
			$a_priority = $this->getMiddlewarePriorityForMiddleware( $a );
			$b_priority = $this->getMiddlewarePriorityForMiddleware( $b );
			$priority = $b_priority - $a_priority;

			if ( $priority !== 0 ) {
				return $priority;
			}

			// Keep relative order from original array.
			return array_search( $a, $middleware ) - array_search( $b, $middleware );
		} );

		return array_values( $sorted );
	}
public function sortMiddleware ( $ middleware ) { $ sorted = $ middleware ; usort ( $ sorted , function ( $ a , $ b ) use ( $ middleware ) { $ a_priority = $ this -> getMiddlewarePriorityForMiddleware ( $ a ) ; $ b_priority = $ this -> getMiddlewarePriorityForMiddleware ( $ b ) ; $ priority = $ b_priority - $ a_priority ; if ( $ priority !== 0 ) { return $ priority ; } // Keep relative order from original array. return array_search ( $ a , $ middleware ) - array_search ( $ b , $ middleware ) ; } ) ; return array_values ( $ sorted ) ; }
Sort array of fully qualified middleware class names by priority in ascending order.

@param  array<string> $middleware
@return array
Sort array of fully qualified middleware class names by priority in ascending order .