����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/./././www/vendor/pda/pheanstalk/src/Socket/ |
Upload File : |
<?php
namespace Pheanstalk\Socket;
/**
* A limited history of recent socket write length/success.
*
* Facilitates retrying zero-length writes a limited number of times,
* avoiding infinite loops.
*
* Based on a patch from https://github.com/leprechaun
* https://github.com/pda/pheanstalk/pull/24
*
* A bitfield could be used instead of an array for efficiency.
*
* @author Paul Annesley
*/
class WriteHistory
{
private $limit;
private $data = [];
public function __construct(int $limit)
{
$this->limit = $limit;
}
/**
* Whether the history has reached its limit of entries.
*/
public function isFull(): bool
{
return count($this->data) >= $this->limit;
}
public function hasWrites(): bool
{
return (bool) array_sum($this->data);
}
public function isFullWithNoWrites(): bool
{
return $this->isFull() && !$this->hasWrites();
}
/**
* Logs the return value from a write call.
*/
public function log($write): void
{
if ($this->isFull()) {
array_shift($this->data);
}
$this->data[] = (int) $write;
}
}