vendor/grafika/src/Grafika/Gd/Helper/GifByteStream.php
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Grafika\Gd\Helper;
/**
* Class GifByteStream
* Normalize string operations.
* Treat string as byte stream where 2 string characters are treated as 1 hex string (byte).
* Eg. String ffff with length 4 is 0xff 0xff in bytes with length of 2.
*/
final class GifByteStream
{
/**
* @var int
*/
private $position;
/**
* @var string
*/
private $bytes;
/**
* GifByteStream constructor.
*
* @param string $bytes Accepts only the string created by unpack('H*')
*/
public function __construct($bytes)
{
$this->position = 0;
$this->bytes = $bytes;
}
/**
* Take a bite from the byte stream.
*
* @param int $size Byte size in integer.
*
* @return string
*/
public function bite($size)
{
$str = substr($this->bytes, $this->position * 2, $size * 2);
$this->position += $size;
return $str;
}
/**
* @param $byteString
* @param $offset
*
* @return bool|float
*/
public function find($byteString, $offset)
{
$pos = strpos($this->bytes, $byteString, $offset * 2);
if ($pos !== false) {
return $pos / 2;
}
后面还有 63 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
