[ Index ]

MailPress 544

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

title

Body

[close]

/mp-includes/Swiftmailer/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 = array();
  24  
  25      /**
  26       * Create a new ArrayRecipientIterator from $recipients.
  27       *
  28       * @param array $recipients
  29       */
  30      public function __construct(array $recipients)
  31      {
  32          $this->_recipients = $recipients;
  33      }
  34  
  35      /**
  36       * Returns true only if there are more recipients to send to.
  37       *
  38       * @return bool
  39       */
  40      public function hasNext()
  41      {
  42          return !empty($this->_recipients);
  43      }
  44  
  45      /**
  46       * Returns an array where the keys are the addresses of recipients and the
  47       * values are the names. e.g. ('foo@bar' => 'Foo') or ('foo@bar' => NULL).
  48       *
  49       * @return array
  50       */
  51      public function nextRecipient()
  52      {
  53          return array_splice($this->_recipients, 0, 1);
  54      }
  55  }


Generated: Thu Apr 28 18:38:52 2016 Cross-referenced by PHPXref 0.7.1