mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 19:58:22 +08:00
Format code.
This commit is contained in:
parent
89f54ed720
commit
a17c0ad330
@ -19,7 +19,6 @@ use Hyperf\HttpMessage\Stream\SwooleStream;
|
||||
use Hyperf\HttpServer\Contract\ResponseInterface;
|
||||
use Hyperf\HttpServer\Exception\Http\EncodingException;
|
||||
use Hyperf\HttpServer\Exception\Http\FileException;
|
||||
use Hyperf\Utils\MimeTypeExtensionGuesser;
|
||||
use Hyperf\HttpServer\Exception\Http\InvalidResponseException;
|
||||
use Hyperf\Utils\ApplicationContext;
|
||||
use Hyperf\Utils\ClearStatCache;
|
||||
@ -27,6 +26,7 @@ use Hyperf\Utils\Context;
|
||||
use Hyperf\Utils\Contracts\Arrayable;
|
||||
use Hyperf\Utils\Contracts\Jsonable;
|
||||
use Hyperf\Utils\Contracts\Xmlable;
|
||||
use Hyperf\Utils\MimeTypeExtensionGuesser;
|
||||
use Hyperf\Utils\Str;
|
||||
use Hyperf\Utils\Traits\Macroable;
|
||||
use Psr\Http\Message\ResponseInterface as PsrResponseInterface;
|
||||
@ -447,26 +447,6 @@ class Response implements PsrResponseInterface, ResponseInterface
|
||||
return $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ETag header according to the checksum of the file.
|
||||
*/
|
||||
protected function createEtag(\SplFileInfo $file, bool $weak = false): string
|
||||
{
|
||||
$etag = '';
|
||||
if ($weak) {
|
||||
ClearStatCache::clear($file->getPathname());
|
||||
$lastModified = $file->getMTime();
|
||||
$filesize = $file->getSize();
|
||||
if (! $lastModified || ! $filesize) {
|
||||
return $etag;
|
||||
}
|
||||
$etag = sprintf('W/"%x-%x"', $lastModified, $filesize);
|
||||
} else {
|
||||
$etag = md5_file($file->getPathname());
|
||||
}
|
||||
return $etag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|Arrayable|Jsonable $data
|
||||
* @throws EncodingException when the data encoding error
|
||||
|
@ -324,7 +324,7 @@ class Str
|
||||
/**
|
||||
* Replace the first occurrence of a given value in the string.
|
||||
*/
|
||||
public static function replaceFirst(string $search, string $replace, string $subject): string
|
||||
public static function replaceFirst(string $search, string $replace, string $subject): string
|
||||
{
|
||||
if ($search == '') {
|
||||
return $subject;
|
||||
@ -342,7 +342,7 @@ class Str
|
||||
/**
|
||||
* Replace the last occurrence of a given value in the string.
|
||||
*/
|
||||
public static function replaceLast(string $search, string $replace, string $subject): string
|
||||
public static function replaceLast(string $search, string $replace, string $subject): string
|
||||
{
|
||||
$position = strrpos($subject, $search);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user