uri = $url; $this->new = $blank; } /** * Set delay. * * @param int $delay Delay in ms * * @return void * * @since 1.0.0 */ public function setDelay(int $delay) : void { $this->delay = $delay; } /** * Set uri. * * @param string $uri Uri * * @return void * * @since 1.0.0 */ public function setUri(string $uri) : void { $this->uri = $uri; } /** * Render message. * * @return string * * @since 1.0.0 */ public function serialize() : string { return $this->__toString(); } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } /** * {@inheritdoc} */ public function unserialize(mixed $raw) : void { if (!\is_string($raw)) { return; } $unserialized = \json_decode($raw, true); if (!\is_array($unserialized)) { return; } $this->delay = $unserialized['time'] ?? 0; $this->uri = $unserialized['uri'] ?? ''; $this->new = $unserialized['new'] ?? false; } /** * Stringify. * * @return string * * @since 1.0.0 */ public function __toString() { return (string) \json_encode($this->toArray()); } /** * Generate message array. * * @return array * * @since 1.0.0 */ public function toArray() : array { return [ 'type' => self::TYPE, 'time' => $this->delay, 'uri' => $this->uri, 'new' => $this->new, ]; } }