本文整理汇总了PHP中DateTimeImmutable::getTimezone方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeImmutable::getTimezone方法的具体用法?PHP DateTimeImmutable::getTimezone怎么用?PHP DateTimeImmutable::getTimezone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeImmutable
的用法示例。
在下文中一共展示了DateTimeImmutable::getTimezone方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unserialize
/**
* @param \stdClass $obj
* @param array $context
* @return TwitterEvent
*/
public function unserialize($obj, array $context = [])
{
Assertion::true($this->canUnserialize($obj), 'object is not unserializable');
$createdAt = new \DateTimeImmutable($obj->created_at);
Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
return TwitterEvent::create($obj->event, $this->userSerializer->unserialize($obj->source), isset($obj->target) ? $this->userSerializer->unserialize($obj->target) : null, isset($obj->target_object) ? $this->targetSerializer->unserialize($obj->target_object) : null, $createdAt);
}
示例2: unserialize
/**
* @param \stdClass $obj
* @param array $context
* @return \Twitter\Object\Tweet
*/
public function unserialize($obj, array $context = [])
{
Assertion::true($this->canUnserialize($obj), 'object is not unserializable');
$createdAt = new \DateTimeImmutable($obj->created_at);
Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
return Tweet::create(TwitterMessageId::create($obj->id), $this->userSerializer->unserialize($obj->user), $obj->text, $obj->lang, $createdAt, $obj->entities ? $this->twitterEntitiesSerializer->unserialize($obj->entities) : TwitterEntities::create(), $obj->coordinates ? $this->coordinatesSerializer->unserialize($obj->coordinates) : null, $obj->place ? $this->placeSerializer->unserialize($obj->place) : null, $obj->in_reply_to_status_id, $obj->in_reply_to_user_id, $obj->in_reply_to_screen_name, $obj->retweeted, $obj->retweet_count, $obj->favorited, $obj->favorite_count, $obj->truncated, $obj->source, isset($obj->retweeted_status) ? $this->unserialize($obj->retweeted_status) : null);
}
示例3: unserialize
/**
* @param \stdClass $directMessage
* @param array $context
* @return TwitterDirectMessage
*/
public function unserialize($directMessage, array $context = [])
{
Assertion::true($this->canUnserialize($directMessage), 'object is not unserializable');
$dm = $directMessage->direct_message;
$createdAt = new \DateTimeImmutable($dm->created_at);
Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
return TwitterDirectMessage::create(TwitterMessageId::create($dm->id), $this->userSerializer->unserialize($dm->sender), $this->userSerializer->unserialize($dm->recipient), $dm->text, $createdAt, $this->twitterEntitiesSerializer->canUnserialize($dm->entities) ? $this->twitterEntitiesSerializer->unserialize($dm->entities) : TwitterEntities::create());
}
示例4: ago
/**
* @param boolean $ago Do we add 'ago' to interval.
*
* @return string
* @since 2015-08-07
*/
public function ago($ago = true)
{
$l = $this->lang;
$s = $l->seperator();
$to = $this->to;
if ($to === null) {
$to = new \DateTimeImmutable('now', $this->from->getTimezone());
}
$int = $this->from->diff($to);
$ret = $l->format($int, $ago);
return $ret;
}
示例5: setExpires
public function setExpires($expires)
{
if ($expires === NULL) {
$this->expires = NULL;
} else {
if (is_numeric($expires)) {
$expires = new \DateTimeImmutable('@' . $expires);
} elseif ($expires instanceof \DateTimeInterface) {
$expires = new \DateTimeImmutable('@' . $expires->getTimestamp(), $expires->getTimezone());
} else {
$expires = \DateTimeImmutable::createFromFormat(Http::DATE_COOKIE, $expires);
}
$this->expires = $expires->setTimezone(new \DateTimeZone('UTC'));
}
}
示例6: hasExpired
/**
* @return bool TRUE if the token has expired (and is invalid); FALSE otherwise.
*/
public function hasExpired() : bool
{
return $this->expires <= new \DateTimeImmutable('now', $this->expires->getTimezone());
}
示例7: getTimezone
/**
* {@inheritdoc}
*/
public function getTimezone()
{
return $this->prototype->getTimezone();
}