sonarrradarrplexorganizrnginxdashboardmuximuxlandingpagestartpagelandinghtpcserverhomepagesabnzbdheimdallembycouchpotatonzbgetbookmarkapplication-dashboard
		
		
		
		
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							38 lines
						
					
					
						
							813 B
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							38 lines
						
					
					
						
							813 B
						
					
					
				
								<?php
							 | 
						|
								
							 | 
						|
								namespace Github\HttpClient\Plugin;
							 | 
						|
								
							 | 
						|
								use Http\Client\Common\Plugin;
							 | 
						|
								use Psr\Http\Message\RequestInterface;
							 | 
						|
								
							 | 
						|
								/**
							 | 
						|
								 * Prepend the URI with a string.
							 | 
						|
								 *
							 | 
						|
								 * @author Tobias Nyholm <tobias.nyholm@gmail.com>
							 | 
						|
								 */
							 | 
						|
								class PathPrepend implements Plugin
							 | 
						|
								{
							 | 
						|
								    private $path;
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * @param string $path
							 | 
						|
								     */
							 | 
						|
								    public function __construct($path)
							 | 
						|
								    {
							 | 
						|
								        $this->path = $path;
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * {@inheritdoc}
							 | 
						|
								     */
							 | 
						|
								    public function handleRequest(RequestInterface $request, callable $next, callable $first)
							 | 
						|
								    {
							 | 
						|
								        $currentPath = $request->getUri()->getPath();
							 | 
						|
								        if (strpos($currentPath, $this->path) !== 0) {
							 | 
						|
								            $uri = $request->getUri()->withPath($this->path.$currentPath);
							 | 
						|
								            $request = $request->withUri($uri);
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        return $next($request);
							 | 
						|
								    }
							 | 
						|
								}
							 | 
						|
								
							 |