- Added some more features to attributes and various Curl wrappers

This commit is contained in:
mcndave committed 2026-07-01 13:24:04 -04:00
1 parent b1adf5a086
commit fe56a1727b
9 files changed
+142 -15

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
<?php
namespace Ulmus\Api\Response;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Ulmus\Api\Common\XmlMessageTrait;
use Ulmus\Api\Stream\XmlStream;
use Ulmus\Api\Common\StreamOutputInterface;
class XmlResponse extends Response implements StreamOutputInterface
{
use XmlMessageTrait;
public function __construct(null|StreamInterface $stream = null, int $statusCode = 200, array $headers = [])
{
parent::__construct($stream, $statusCode, $headers + [ 'Content-Type' => "application/xml" ]);
}
public static function fromResponse(ResponseInterface $response) : static
{
return new static($response->getBody(), $response->getStatusCode(), $response->getHeaders());
}
public static function createFrom(mixed $content) : ResponseInterface
{
return new static(XmlStream::fromContent($content));
}
}