Symfony\Component\HttpFoundation\Request::getTrustedProxies PHP Method

getTrustedProxies() public static method

Gets the list of trusted proxies.
public static getTrustedProxies ( ) : array
return array An array of trusted proxies
    public static function getTrustedProxies()
    {
        return self::$trustedProxies;
    }

Usage Example

 public function testItAddsRequestTrustedProxiesSubscriberOnBoot()
 {
     $app = new Application();
     $app['root.path'] = __DIR__ . '/../../../../../..';
     $app->register(new ConfigurationServiceProvider());
     $app['phraseanet.configuration.config-path'] = __DIR__ . '/fixtures/config-proxies.yml';
     $app['phraseanet.configuration.config-compiled-path'] = __DIR__ . '/fixtures/config-proxies.php';
     $app->boot();
     /** @var EventDispatcherInterface $dispatcher */
     $dispatcher = $app['dispatcher'];
     $listener = null;
     $method = null;
     foreach ($dispatcher->getListeners(KernelEvents::REQUEST) as $callable) {
         // Only look for TrustedProxySubscriber instances
         if (!is_array($callable)) {
             continue;
         }
         list($listener, $method) = $callable;
         if ($listener instanceof TrustedProxySubscriber) {
             break;
         }
     }
     $this->assertInstanceOf('Alchemy\\Phrasea\\Core\\Event\\Subscriber\\TrustedProxySubscriber', $listener, 'TrustedProxySubscriber was not properly registered');
     $this->assertEquals('setProxyConf', $method);
     $this->assertSame([], Request::getTrustedProxies());
     $listener->setProxyConf();
     $this->assertSame(['127.0.0.1', '66.6.66.6'], Request::getTrustedProxies());
     unlink($app['phraseanet.configuration.config-compiled-path']);
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Request::getTrustedProxies