[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Plugins/Emoticons/Configurator/ -> EmoticonCollection.php (source)

   1  <?php
   2  
   3  /**
   4  * @package   s9e\TextFormatter
   5  * @copyright Copyright (c) 2010-2022 The s9e authors
   6  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
   7  */
   8  namespace s9e\TextFormatter\Plugins\Emoticons\Configurator;
   9  
  10  use RuntimeException;
  11  use s9e\TextFormatter\Configurator\Collections\NormalizedCollection;
  12  use s9e\TextFormatter\Configurator\Helpers\TemplateLoader;
  13  
  14  class EmoticonCollection extends NormalizedCollection
  15  {
  16      /**
  17      * {@inheritdoc}
  18      */
  19      protected $onDuplicateAction = 'replace';
  20  
  21      /**
  22      * Normalize an emoticon's template
  23      *
  24      * NOTE: this allows the HTML syntax to be used for individual emoticons
  25      *
  26      * @param  string $value Emoticon's original markup
  27      * @return string        Normalized template
  28      */
  29  	public function normalizeValue($value)
  30      {
  31          return TemplateLoader::save(TemplateLoader::load($value));
  32      }
  33  
  34      /**
  35      * {@inheritdoc}
  36      */
  37  	protected function getAlreadyExistsException($key)
  38      {
  39          return new RuntimeException("Emoticon '" . $key . "' already exists");
  40      }
  41  
  42      /**
  43      * {@inheritdoc}
  44      */
  45  	protected function getNotExistException($key)
  46      {
  47          return new RuntimeException("Emoticon '" . $key . "' does not exist");
  48      }
  49  }


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