vendor/symfony/src/Symfony/Component/Security/Http/FirewallMap.php
changeset 0 7f95f8617b0b
equal deleted inserted replaced
-1:000000000000 0:7f95f8617b0b
       
     1 <?php
       
     2 
       
     3 namespace Symfony\Component\Security\Http;
       
     4 
       
     5 use Symfony\Component\HttpFoundation\RequestMatcherInterface;
       
     6 use Symfony\Component\HttpFoundation\Request;
       
     7 use Symfony\Component\Security\Http\Firewall\ExceptionListener;
       
     8 
       
     9 /*
       
    10  * This file is part of the Symfony framework.
       
    11  *
       
    12  * (c) Fabien Potencier <fabien@symfony.com>
       
    13  *
       
    14  * This source file is subject to the MIT license that is bundled
       
    15  * with this source code in the file LICENSE.
       
    16  */
       
    17 
       
    18 /**
       
    19  * FirewallMap allows configuration of different firewalls for specific parts
       
    20  * of the website.
       
    21  *
       
    22  * @author Fabien Potencier <fabien@symfony.com>
       
    23  */
       
    24 class FirewallMap implements FirewallMapInterface
       
    25 {
       
    26     private $map = array();
       
    27 
       
    28     public function add(RequestMatcherInterface $requestMatcher = null, array $listeners = array(), ExceptionListener $exceptionListener = null)
       
    29     {
       
    30         $this->map[] = array($requestMatcher, $listeners, $exceptionListener);
       
    31     }
       
    32 
       
    33     public function getListeners(Request $request)
       
    34     {
       
    35         foreach ($this->map as $elements) {
       
    36             if (null === $elements[0] || $elements[0]->matches($request)) {
       
    37                 return array($elements[1], $elements[2]);
       
    38             }
       
    39         }
       
    40 
       
    41         return array(array(), null);
       
    42     }
       
    43 }