[ Index ]

MailPress 7.2

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/composer/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/ -> IdGenerator.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of SwiftMailer.
   5   * (c) 2004-2009 Chris Corbyn
   6   *
   7   * For the full copyright and license information, please view the LICENSE
   8   * file that was distributed with this source code.
   9   */
  10  
  11  /**
  12   * Message ID generator.
  13   */
  14  class Swift_Mime_IdGenerator implements Swift_IdGenerator
  15  {
  16      private $idRight;
  17  
  18      /**
  19       * @param string $idRight
  20       */
  21      public function __construct($idRight)
  22      {
  23          $this->idRight = $idRight;
  24      }
  25  
  26      /**
  27       * Returns the right-hand side of the "@" used in all generated IDs.
  28       *
  29       * @return string
  30       */
  31      public function getIdRight()
  32      {
  33          return $this->idRight;
  34      }
  35  
  36      /**
  37       * Sets the right-hand side of the "@" to use in all generated IDs.
  38       *
  39       * @param string $idRight
  40       */
  41      public function setIdRight($idRight)
  42      {
  43          $this->idRight = $idRight;
  44      }
  45  
  46      /**
  47       * @return string
  48       */
  49      public function generateId()
  50      {
  51          // 32 hex values for the left part
  52          return bin2hex(random_bytes(16)).'@'.$this->idRight;
  53      }
  54  }


Generated: Tue May 19 15:55:14 2020 Cross-referenced by PHPXref 0.7.1