Zend_Date_DateObject-时间戳检查和强制转换


Zend_Date_DateObject - timestamp check and cast

有人能解释为什么Zend_Date_DateObject在返回时间戳属性(并将其转换为int或string…

    protected function getTimestamp()
    {
        if ($this->_unixTimestamp === intval($this->_unixTimestamp)) {
            return (int) $this->_unixTimestamp;
        } else {
            return (string) $this->_unixTimestamp;
        }
    }

这看起来很奇怪,但这一定有一定的逻辑??

根据他们的svn日志:

> svn log http://framework.zend.com/svn/framework -r 2773
------------------------------------------------------------------------
r2773 | gavin | 2007-01-15 19:22:51 +0200 (Mon, 15 Jan 2007) | 5 lines
* consistency updates
* bug fixes
* updates for DateObject unit tests to work with recent changes
  (10 Errors, 3 Failures yet to fix)
------------------------------------------------------------------------

添加了一些练习这种(string/int)行为的测试。所以我想说,这只是为了让他们的单元测试符合要求。