xref: /plugin/pureldap/vendor/freedsx/socket/src/FreeDSx/Socket/Queue/Buffer.php (revision 0b3fd2d31e4d1997548a8fbc53fa771027c4a47f)
1*0b3fd2d3SAndreas Gohr<?php
2*0b3fd2d3SAndreas Gohr/**
3*0b3fd2d3SAndreas Gohr * This file is part of the FreeDSx Socket package.
4*0b3fd2d3SAndreas Gohr *
5*0b3fd2d3SAndreas Gohr * (c) Chad Sikorra <Chad.Sikorra@gmail.com>
6*0b3fd2d3SAndreas Gohr *
7*0b3fd2d3SAndreas Gohr * For the full copyright and license information, please view the LICENSE
8*0b3fd2d3SAndreas Gohr * file that was distributed with this source code.
9*0b3fd2d3SAndreas Gohr */
10*0b3fd2d3SAndreas Gohr
11*0b3fd2d3SAndreas Gohrnamespace FreeDSx\Socket\Queue;
12*0b3fd2d3SAndreas Gohr
13*0b3fd2d3SAndreas Gohr/**
14*0b3fd2d3SAndreas Gohr * Represents a consumable buffer of data in the queue.
15*0b3fd2d3SAndreas Gohr *
16*0b3fd2d3SAndreas Gohr * @author Chad Sikorra <Chad.Sikorra@gmail.com>
17*0b3fd2d3SAndreas Gohr */
18*0b3fd2d3SAndreas Gohrclass Buffer
19*0b3fd2d3SAndreas Gohr{
20*0b3fd2d3SAndreas Gohr    /**
21*0b3fd2d3SAndreas Gohr     * @var string
22*0b3fd2d3SAndreas Gohr     */
23*0b3fd2d3SAndreas Gohr    protected $bytes;
24*0b3fd2d3SAndreas Gohr
25*0b3fd2d3SAndreas Gohr    /**
26*0b3fd2d3SAndreas Gohr     * @var int
27*0b3fd2d3SAndreas Gohr     */
28*0b3fd2d3SAndreas Gohr    protected $endsAt;
29*0b3fd2d3SAndreas Gohr
30*0b3fd2d3SAndreas Gohr    /**
31*0b3fd2d3SAndreas Gohr     * @param string $bytes
32*0b3fd2d3SAndreas Gohr     * @param int $endsAt
33*0b3fd2d3SAndreas Gohr     */
34*0b3fd2d3SAndreas Gohr    public function __construct($bytes, int $endsAt)
35*0b3fd2d3SAndreas Gohr    {
36*0b3fd2d3SAndreas Gohr        $this->bytes = $bytes;
37*0b3fd2d3SAndreas Gohr        $this->endsAt = $endsAt;
38*0b3fd2d3SAndreas Gohr    }
39*0b3fd2d3SAndreas Gohr
40*0b3fd2d3SAndreas Gohr    /**
41*0b3fd2d3SAndreas Gohr     * @return string
42*0b3fd2d3SAndreas Gohr     */
43*0b3fd2d3SAndreas Gohr    public function bytes()
44*0b3fd2d3SAndreas Gohr    {
45*0b3fd2d3SAndreas Gohr        return $this->bytes;
46*0b3fd2d3SAndreas Gohr    }
47*0b3fd2d3SAndreas Gohr
48*0b3fd2d3SAndreas Gohr    /**
49*0b3fd2d3SAndreas Gohr     * @return int
50*0b3fd2d3SAndreas Gohr     */
51*0b3fd2d3SAndreas Gohr    public function endsAt(): int
52*0b3fd2d3SAndreas Gohr    {
53*0b3fd2d3SAndreas Gohr        return $this->endsAt;
54*0b3fd2d3SAndreas Gohr    }
55*0b3fd2d3SAndreas Gohr}
56