mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 11:41:31 +00:00
updated streamline-setup v2
This commit is contained in:
@@ -188,6 +188,20 @@ abstract class AbstractHeader implements HeaderInterface
|
||||
$tokens[] = $encodedToken;
|
||||
}
|
||||
|
||||
foreach ($tokens as $i => $token) {
|
||||
// whitespace(s) between 2 encoded tokens
|
||||
if (
|
||||
0 < $i
|
||||
&& isset($tokens[$i + 1])
|
||||
&& preg_match('~^[\t ]+$~', $token)
|
||||
&& $this->tokenNeedsEncoding($tokens[$i - 1])
|
||||
&& $this->tokenNeedsEncoding($tokens[$i + 1])
|
||||
) {
|
||||
$tokens[$i - 1] .= $token.$tokens[$i + 1];
|
||||
array_splice($tokens, $i, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -130,11 +130,11 @@ class Message extends RawMessage
|
||||
*/
|
||||
public function ensureValidity()
|
||||
{
|
||||
if (!$this->headers->has('To') && !$this->headers->has('Cc') && !$this->headers->has('Bcc')) {
|
||||
if (!$this->headers->get('To')?->getBody() && !$this->headers->get('Cc')?->getBody() && !$this->headers->get('Bcc')?->getBody()) {
|
||||
throw new LogicException('An email must have a "To", "Cc", or "Bcc" header.');
|
||||
}
|
||||
|
||||
if (!$this->headers->has('From') && !$this->headers->has('Sender')) {
|
||||
if (!$this->headers->get('From')?->getBody() && !$this->headers->get('Sender')?->getBody()) {
|
||||
throw new LogicException('An email must have a "From" or a "Sender" header.');
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ final class FormDataPart extends AbstractMultipartPart
|
||||
private array $fields = [];
|
||||
|
||||
/**
|
||||
* @param array<string|array|DataPart> $fields
|
||||
* @param array<string|array|TextPart> $fields
|
||||
*/
|
||||
public function __construct(array $fields = [])
|
||||
{
|
||||
|
||||
@@ -123,7 +123,11 @@ class TextPart extends AbstractPart
|
||||
public function getBody(): string
|
||||
{
|
||||
if ($this->body instanceof File) {
|
||||
return file_get_contents($this->body->getPath());
|
||||
if (false === $ret = @file_get_contents($this->body->getPath())) {
|
||||
throw new InvalidArgumentException(error_get_last()['message']);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
if (null === $this->seekable) {
|
||||
|
||||
+28
-4
@@ -18,20 +18,35 @@ use Symfony\Component\Mime\Exception\LogicException;
|
||||
*/
|
||||
class RawMessage
|
||||
{
|
||||
private iterable|string $message;
|
||||
/** @var iterable<string>|string|resource */
|
||||
private $message;
|
||||
private bool $isGeneratorClosed;
|
||||
|
||||
public function __construct(iterable|string $message)
|
||||
/**
|
||||
* @param iterable<string>|string|resource $message
|
||||
*/
|
||||
public function __construct(mixed $message)
|
||||
{
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
if (\is_resource($this->message)) {
|
||||
fclose($this->message);
|
||||
}
|
||||
}
|
||||
|
||||
public function toString(): string
|
||||
{
|
||||
if (\is_string($this->message)) {
|
||||
return $this->message;
|
||||
}
|
||||
|
||||
if (\is_resource($this->message)) {
|
||||
return stream_get_contents($this->message, -1, 0);
|
||||
}
|
||||
|
||||
$message = '';
|
||||
foreach ($this->message as $chunk) {
|
||||
$message .= $chunk;
|
||||
@@ -53,10 +68,19 @@ class RawMessage
|
||||
return;
|
||||
}
|
||||
|
||||
if (\is_resource($this->message)) {
|
||||
rewind($this->message);
|
||||
while ($line = fgets($this->message)) {
|
||||
yield $line;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->message instanceof \Generator) {
|
||||
$message = '';
|
||||
$message = fopen('php://temp', 'w+');
|
||||
foreach ($this->message as $chunk) {
|
||||
$message .= $chunk;
|
||||
fwrite($message, $chunk);
|
||||
yield $chunk;
|
||||
}
|
||||
$this->isGeneratorClosed = !$this->message->valid();
|
||||
|
||||
+3
-2
@@ -26,16 +26,17 @@
|
||||
"league/html-to-markdown": "^5.0",
|
||||
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
|
||||
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
|
||||
"symfony/process": "^5.4|^6.4|^7.0",
|
||||
"symfony/property-access": "^5.4|^6.0|^7.0",
|
||||
"symfony/property-info": "^5.4|^6.0|^7.0",
|
||||
"symfony/serializer": "^6.3.2|^7.0"
|
||||
"symfony/serializer": "^6.4.3|^7.0.3"
|
||||
},
|
||||
"conflict": {
|
||||
"egulias/email-validator": "~3.0.0",
|
||||
"phpdocumentor/reflection-docblock": "<3.2.2",
|
||||
"phpdocumentor/type-resolver": "<1.4.0",
|
||||
"symfony/mailer": "<5.4",
|
||||
"symfony/serializer": "<6.3.2"
|
||||
"symfony/serializer": "<6.4.3|>7.0,<7.0.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Component\\Mime\\": "" },
|
||||
|
||||
Reference in New Issue
Block a user