31 if (!is_string(
$data)) {
32 throw new \InvalidArgumentException();
47 return strlen($this->data);
65 $size = strlen($this->data);
74 $res = (string) substr($this->data, 0, $limit);
75 $this->data = (string) substr($this->data, $limit);
96 throw new \InvalidArgumentException();
99 $pos = strpos($this->data, $limit);
100 if ($pos ===
false) {
104 $pos += strlen($limit);
105 $res = substr($this->data, 0, $pos);
106 $this->data = (string) substr($this->data, $pos);
123 public function get($limit)
125 if (is_int($limit)) {
129 if (is_string($limit)) {
133 throw new \InvalidArgumentException();
147 if (!is_string(
$data)) {
148 throw new \InvalidArgumentException();
166 if (!is_string(
$data)) {
167 throw new \InvalidArgumentException();
170 $this->data .=
$data;
$data
The buffer's current data.
Classes implementing Countable can be used with the count() function.