PHP 8.3.31
Preview: ServerEvent.php Size: 3.34 KB
//proc/thread-self/root/home/getspomw/itechservicellc.com/vendor/symfony/http-foundation/ServerEvent.php

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\HttpFoundation;

/**
 * An event generated on the server intended for streaming to the client
 * as part of the SSE streaming technique.
 *
 * @implements \IteratorAggregate<string>
 *
 * @author Yonel Ceruto <open@yceruto.dev>
 */
class ServerEvent implements \IteratorAggregate
{
    /**
     * @param string|iterable<string> $data    The event data field for the message
     * @param string|null             $type    The event type
     * @param int|null                $retry   The number of milliseconds the client should wait
     *                                         before reconnecting in case of network failure
     * @param string|null             $id      The event ID to set the EventSource object's last event ID value
     * @param string|null             $comment The event comment
     */
    public function __construct(
        private string|iterable $data,
        private ?string $type = null,
        private ?int $retry = null,
        private ?string $id = null,
        private ?string $comment = null,
    ) {
    }

    public function getData(): iterable|string
    {
        return $this->data;
    }

    /**
     * @return $this
     */
    public function setData(iterable|string $data): static
    {
        $this->data = $data;

        return $this;
    }

    public function getType(): ?string
    {
        return $this->type;
    }

    /**
     * @return $this
     */
    public function setType(string $type): static
    {
        $this->type = $type;

        return $this;
    }

    public function getRetry(): ?int
    {
        return $this->retry;
    }

    /**
     * @return $this
     */
    public function setRetry(?int $retry): static
    {
        $this->retry = $retry;

        return $this;
    }

    public function getId(): ?string
    {
        return $this->id;
    }

    /**
     * @return $this
     */
    public function setId(string $id): static
    {
        $this->id = $id;

        return $this;
    }

    public function getComment(): ?string
    {
        return $this->comment;
    }

    public function setComment(string $comment): static
    {
        $this->comment = $comment;

        return $this;
    }

    /**
     * @return \Traversable<string>
     */
    public function getIterator(): \Traversable
    {
        static $lastRetry = null;

        $head = '';
        if ($this->comment) {
            $head .= \sprintf(': %s', $this->comment)."\n";
        }
        if ($this->id) {
            $head .= \sprintf('id: %s', $this->id)."\n";
        }
        if ($this->retry > 0 && $this->retry !== $lastRetry) {
            $head .= \sprintf('retry: %s', $lastRetry = $this->retry)."\n";
        }
        if ($this->type) {
            $head .= \sprintf('event: %s', $this->type)."\n";
        }
        yield $head;

        if ($this->data) {
            if (is_iterable($this->data)) {
                foreach ($this->data as $data) {
                    yield \sprintf('data: %s', $data)."\n";
                }
            } else {
                yield \sprintf('data: %s', $this->data)."\n";
            }
        }

        yield "\n";
    }
}

Directory Contents

Dirs: 6 × Files: 29

Name Size Perms Modified Actions
Exception DIR
- drwxr-xr-x 2025-11-18 19:24:10
Edit Download
File DIR
- drwxr-xr-x 2025-11-18 19:24:10
Edit Download
- drwxr-xr-x 2025-11-18 19:24:10
Edit Download
- drwxr-xr-x 2025-11-18 19:24:10
Edit Download
Session DIR
- drwxr-xr-x 2025-11-18 19:24:12
Edit Download
Test DIR
- drwxr-xr-x 2025-11-18 19:24:12
Edit Download
3.36 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
3.16 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
13.22 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
873 B lrw-r--r-- 2025-10-28 20:23:36
Edit Download
21.22 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
1.34 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
11.53 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
2.88 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
3.77 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
6.94 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
9.07 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
5.13 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
8.99 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
6.45 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
1.04 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
7.72 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
526 B lrw-r--r-- 2025-10-28 20:23:36
Edit Download
2.57 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
69.33 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
621 B lrw-r--r-- 2025-10-28 20:23:36
Edit Download
3.05 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
39.09 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
7.75 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
3.92 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
3.34 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
5.64 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
3.57 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
7.58 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download
3.05 KB lrw-r--r-- 2025-10-28 20:23:36
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).