[ Index ]

MailPress 7.2

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

title

Body

[close]

/mp-includes/composer/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer/ -> ArrayRecipientIterator.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   * Wraps a standard PHP array in an iterator.
  13   *
  14   * @author Chris Corbyn
  15   */
  16  class Swift_Mailer_ArrayRecipientIterator implements Swift_Mailer_RecipientIterator
  17  {
  18      /**
  19       * The list of recipients.
  20       *
  21       * @var array
  22       */
  23      private $recipients = [];
  24  
  25      /**
  26       * Create a new ArrayRecipientIterator from $recipients.
  27       */
  28      public function __construct(array $recipients)
  29      {
  30          $this->recipients = $recipients;
  31      }
  32  
  33      /**
  34       * Returns true only if there are more recipients to send to.
  35       *
  36       * @return bool
  37       */
  38      public function hasNext()
  39      {
  40          return !empty($this->recipients);
  41      }
  42  
  43      /**
  44       * Returns an array where the keys are the addresses of recipients and the
  45       * values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL).
  46       *
  47       * @return array
  48       */
  49      public function nextRecipient()
  50      {
  51          return array_splice($this->recipients, 0, 1);
  52      }
  53  }


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