DailyCountsResult.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Service
  17. * @subpackage Technorati
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Service_Technorati_Result
  24. */
  25. require_once 'Zend/Service/Technorati/Result.php';
  26. /**
  27. * Represents a single Technorati DailyCounts query result object.
  28. * It is never returned as a standalone object,
  29. * but it always belongs to a valid Zend_Service_Technorati_DailyCountsResultSet object.
  30. *
  31. * @category Zend
  32. * @package Zend_Service
  33. * @subpackage Technorati
  34. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  35. * @license http://framework.zend.com/license/new-bsd New BSD License
  36. */
  37. class Zend_Service_Technorati_DailyCountsResult extends Zend_Service_Technorati_Result
  38. {
  39. /**
  40. * Date of count.
  41. *
  42. * @var Zend_Date
  43. * @access protected
  44. */
  45. protected $_date;
  46. /**
  47. * Number of posts containing query on given date.
  48. *
  49. * @var int
  50. * @access protected
  51. */
  52. protected $_count;
  53. /**
  54. * Constructs a new object object from DOM Document.
  55. *
  56. * @param DomElement $dom the ReST fragment for this object
  57. */
  58. public function __construct(DomElement $dom)
  59. {
  60. $this->_fields = array( '_date' => 'date',
  61. '_count' => 'count');
  62. parent::__construct($dom);
  63. // filter fields
  64. $this->_date = new Zend_Date(strtotime($this->_date));
  65. $this->_count = (int) $this->_count;
  66. }
  67. /**
  68. * Returns the date of count.
  69. *
  70. * @return Zend_Date
  71. */
  72. public function getDate() {
  73. return $this->_date;
  74. }
  75. /**
  76. * Returns the number of posts containing query on given date.
  77. *
  78. * @return int
  79. */
  80. public function getCount() {
  81. return $this->_count;
  82. }
  83. }