[ Index ]

PHP Cross Reference of phpBB-3.3.7-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Parser/AttributeFilters/ -> MapFilter.php (source)

   1  <?php
   2  
   3  /**
   4  * @package   s9e\TextFormatter
   5  * @copyright Copyright (c) 2010-2021 The s9e authors
   6  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
   7  */
   8  namespace s9e\TextFormatter\Parser\AttributeFilters;
   9  
  10  class MapFilter
  11  {
  12      /**
  13      * Filter a mapped value
  14      *
  15      * NOTE: if there's no match, the original value is returned
  16      *
  17      * @param  string $attrValue Original value
  18      * @param  array  $map       List in the form [[<regexp>, <value>]]
  19      * @return mixed             Filtered value, or FALSE if invalid
  20      */
  21  	public static function filter($attrValue, array $map)
  22      {
  23          foreach ($map as $pair)
  24          {
  25              if (preg_match($pair[0], $attrValue))
  26              {
  27                  return $pair[1];
  28              }
  29          }
  30  
  31          return $attrValue;
  32      }
  33  }


Generated: Thu Mar 24 21:31:15 2022 Cross-referenced by PHPXref 0.7.1