public static function handleStatic($swooleRequest, $swooleResponse, string $publicPath)
    {
        $uri = $swooleRequest->server['request_uri'] ?? '';
        $extension = strtok(pathinfo($uri, PATHINFO_EXTENSION), '?');
        $fileName = $publicPath . $uri;

        if ($extension && in_array($extension, static::EXTENSION_BLACKLIST)) {
            return false;
        }

        if (! is_file($fileName) || ! filesize($fileName)) {
            return false;
        }

        $swooleResponse->status(IlluminateResponse::HTTP_OK);
        $swooleResponse->header('Content-Type', MimeType::get($extension));
        $swooleResponse->sendfile($fileName);

        return true;
    }
public static function handleStatic($swooleRequest, $swooleResponse, string $publicPath)
    {
        $uri = $swooleRequest->server['request_uri'] ?? '';
        $extension = strtok(pathinfo($uri, PATHINFO_EXTENSION), '?');
        $fileName = $publicPath . $uri;

        if ($extension && in_array($extension, static::EXTENSION_BLACKLIST)) {
            return false;
        }

        if (! is_file($fileName) || ! filesize($fileName)) {
            return false;
        }

        $swooleResponse->status(IlluminateResponse::HTTP_OK);
        $swooleResponse->header('Content-Type', MimeType::get($extension));
        $swooleResponse->sendfile($fileName);

        return true;
    }
public static function handleStatic ( $ swooleRequest , $ swooleResponse , string $ publicPath ) { $ uri = $ swooleRequest -> server [ 'request_uri' ] ?? '' ; $ extension = strtok ( pathinfo ( $ uri , PATHINFO_EXTENSION ) , '?' ) ; $ fileName = $ publicPath . $ uri ; if ( $ extension && in_array ( $ extension , static :: EXTENSION_BLACKLIST ) ) { return false ; } if ( ! is_file ( $ fileName ) || ! filesize ( $ fileName ) ) { return false ; } $ swooleResponse -> status ( IlluminateResponse :: HTTP_OK ) ; $ swooleResponse -> header ( 'Content-Type' , MimeType :: get ( $ extension ) ) ; $ swooleResponse -> sendfile ( $ fileName ) ; return true ; }
Handle static request.

@param \Swoole\Http\Request $swooleRequest
@param \Swoole\Http\Response $swooleResponse
@param string $publicPath

@return boolean
Handle static request .