本文整理匯總了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();
}