[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/externals/twilio-php/Services/Twilio/ -> Page.php (source)

   1  <?php
   2  
   3  /**
   4   * A representation of a page of resources.
   5   *
   6   * @category Services
   7   * @package  Services_Twilio
   8   * @author   Neuman Vong <[email protected]>
   9   * @license  http://creativecommons.org/licenses/MIT/ MIT
  10   * @link     http://pear.php.net/package/Services_Twilio
  11   */ 
  12  class Services_Twilio_Page
  13      implements IteratorAggregate
  14  {
  15  
  16      /**
  17       * The item list.
  18       *
  19       * @var array $items
  20       */
  21      protected $items;
  22  
  23      /**
  24       * Constructs a page.
  25       *
  26       * @param object $page The page object
  27       * @param string $name The key of the item list
  28       */
  29      public function __construct($page, $name, $next_page_uri = null)
  30      {
  31          $this->page = $page;
  32          $this->items = $page->{$name};
  33          $this->next_page_uri = $next_page_uri;
  34      }
  35  
  36      /**
  37       * The item list of the page.
  38       *
  39       * @return array A list of instance resources
  40       */
  41      public function getItems()
  42      {
  43          return $this->items;
  44      }
  45  
  46      /**
  47       * Magic method to allow retrieving the properties of the wrapped page.
  48       *
  49       * @param string $prop The property name
  50       *
  51       * @return mixed Could be anything
  52       */
  53      public function __get($prop)
  54      {
  55          return $this->page->$prop;
  56      }
  57  
  58      /**
  59       * Implementation of IteratorAggregate::getIterator().
  60       *
  61       * @return Traversable
  62       */
  63      public function getIterator()
  64      {
  65          return $this->getItems();
  66      }
  67  }
  68  


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1