[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

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

   1  <?php
   2  
   3  /**
   4   * Parent class for usage resources that expose a single date, eg 'Today', 'ThisMonth', etc
   5   * @author Kevin Burke <[email protected]>
   6   * @license  http://creativecommons.org/licenses/MIT/ MIT
   7   * @link     http://pear.php.net/package/Services_Twilio
   8   */
   9  class Services_Twilio_TimeRangeResource extends Services_Twilio_UsageResource {
  10  
  11      /**
  12       * Return a UsageRecord corresponding to the given category.
  13       *
  14       * @param string $category The category of usage to retrieve. For a full 
  15       *      list of valid categories, please see the documentation at 
  16       *      http://www.twilio.com/docs/api/rest/usage-records#usage-all-categories
  17       * @return Services_Twilio_Rest_UsageRecord
  18       * @throws Services_Twilio_RestException
  19       */
  20      public function getCategory($category) {
  21          $page = $this->getPage(0, 1, array(
  22              'Category' => $category,
  23          ));
  24          $items = $page->getItems();
  25          if (!is_array($items) || count($items) === 0) {
  26              throw new Services_Twilio_RestException(
  27                  400, "Usage record data is unformattable.");
  28          }
  29          return $items[0];
  30      }
  31  }


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