[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/symfony/routing/ -> CompiledRoute.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <fabien@symfony.com>
   7   *
   8   * For the full copyright and license information, please view the LICENSE
   9   * file that was distributed with this source code.
  10   */
  11  
  12  namespace Symfony\Component\Routing;
  13  
  14  /**
  15   * CompiledRoutes are returned by the RouteCompiler class.
  16   *
  17   * @author Fabien Potencier <fabien@symfony.com>
  18   */
  19  class CompiledRoute implements \Serializable
  20  {
  21      private $variables;
  22      private $tokens;
  23      private $staticPrefix;
  24      private $regex;
  25      private $pathVariables;
  26      private $hostVariables;
  27      private $hostRegex;
  28      private $hostTokens;
  29  
  30      /**
  31       * @param string      $staticPrefix  The static prefix of the compiled route
  32       * @param string      $regex         The regular expression to use to match this route
  33       * @param array       $tokens        An array of tokens to use to generate URL for this route
  34       * @param array       $pathVariables An array of path variables
  35       * @param string|null $hostRegex     Host regex
  36       * @param array       $hostTokens    Host tokens
  37       * @param array       $hostVariables An array of host variables
  38       * @param array       $variables     An array of variables (variables defined in the path and in the host patterns)
  39       */
  40      public function __construct($staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = null, array $hostTokens = [], array $hostVariables = [], array $variables = [])
  41      {
  42          $this->staticPrefix = (string) $staticPrefix;
  43          $this->regex = $regex;
  44          $this->tokens = $tokens;
  45          $this->pathVariables = $pathVariables;
  46          $this->hostRegex = $hostRegex;
  47          $this->hostTokens = $hostTokens;
  48          $this->hostVariables = $hostVariables;
  49          $this->variables = $variables;
  50      }
  51  
  52      /**
  53       * {@inheritdoc}
  54       */
  55      public function serialize()
  56      {
  57          return serialize([
  58              'vars' => $this->variables,
  59              'path_prefix' => $this->staticPrefix,
  60              'path_regex' => $this->regex,
  61              'path_tokens' => $this->tokens,
  62              'path_vars' => $this->pathVariables,
  63              'host_regex' => $this->hostRegex,
  64              'host_tokens' => $this->hostTokens,
  65              'host_vars' => $this->hostVariables,
  66          ]);
  67      }
  68  
  69      /**
  70       * {@inheritdoc}
  71       */
  72      public function unserialize($serialized)
  73      {
  74          if (\PHP_VERSION_ID >= 70000) {
  75              $data = unserialize($serialized, ['allowed_classes' => false]);
  76          } else {
  77              $data = unserialize($serialized);
  78          }
  79  
  80          $this->variables = $data['vars'];
  81          $this->staticPrefix = $data['path_prefix'];
  82          $this->regex = $data['path_regex'];
  83          $this->tokens = $data['path_tokens'];
  84          $this->pathVariables = $data['path_vars'];
  85          $this->hostRegex = $data['host_regex'];
  86          $this->hostTokens = $data['host_tokens'];
  87          $this->hostVariables = $data['host_vars'];
  88      }
  89  
  90      /**
  91       * Returns the static prefix.
  92       *
  93       * @return string The static prefix
  94       */
  95      public function getStaticPrefix()
  96      {
  97          return $this->staticPrefix;
  98      }
  99  
 100      /**
 101       * Returns the regex.
 102       *
 103       * @return string The regex
 104       */
 105      public function getRegex()
 106      {
 107          return $this->regex;
 108      }
 109  
 110      /**
 111       * Returns the host regex.
 112       *
 113       * @return string|null The host regex or null
 114       */
 115      public function getHostRegex()
 116      {
 117          return $this->hostRegex;
 118      }
 119  
 120      /**
 121       * Returns the tokens.
 122       *
 123       * @return array The tokens
 124       */
 125      public function getTokens()
 126      {
 127          return $this->tokens;
 128      }
 129  
 130      /**
 131       * Returns the host tokens.
 132       *
 133       * @return array The tokens
 134       */
 135      public function getHostTokens()
 136      {
 137          return $this->hostTokens;
 138      }
 139  
 140      /**
 141       * Returns the variables.
 142       *
 143       * @return array The variables
 144       */
 145      public function getVariables()
 146      {
 147          return $this->variables;
 148      }
 149  
 150      /**
 151       * Returns the path variables.
 152       *
 153       * @return array The variables
 154       */
 155      public function getPathVariables()
 156      {
 157          return $this->pathVariables;
 158      }
 159  
 160      /**
 161       * Returns the host variables.
 162       *
 163       * @return array The variables
 164       */
 165      public function getHostVariables()
 166      {
 167          return $this->hostVariables;
 168      }
 169  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1