mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-13 19:51:30 +00:00
Import latest app updates from streamline
An updated set of source files and initialization was provided by streamline to address issues observed during initial testing. These files have been updated in order to generate a new set of app images.
This commit is contained in:
-37
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Provider;
|
||||
|
||||
use Symfony\Component\Translation\Exception\IncompleteDsnException;
|
||||
|
||||
abstract class AbstractProviderFactory implements ProviderFactoryInterface
|
||||
{
|
||||
public function supports(Dsn $dsn): bool
|
||||
{
|
||||
return \in_array($dsn->getScheme(), $this->getSupportedSchemes(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
abstract protected function getSupportedSchemes(): array;
|
||||
|
||||
protected function getUser(Dsn $dsn): string
|
||||
{
|
||||
return $dsn->getUser() ?? throw new IncompleteDsnException('User is not set.', $dsn->getScheme().'://'.$dsn->getHost());
|
||||
}
|
||||
|
||||
protected function getPassword(Dsn $dsn): string
|
||||
{
|
||||
return $dsn->getPassword() ?? throw new IncompleteDsnException('Password is not set.', $dsn->getOriginalDsn());
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Provider;
|
||||
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\MissingRequiredOptionException;
|
||||
|
||||
/**
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Oskar Stark <oskarstark@googlemail.com>
|
||||
*/
|
||||
final class Dsn
|
||||
{
|
||||
private ?string $scheme;
|
||||
private ?string $host;
|
||||
private ?string $user;
|
||||
private ?string $password;
|
||||
private ?int $port;
|
||||
private ?string $path;
|
||||
private array $options = [];
|
||||
private string $originalDsn;
|
||||
|
||||
public function __construct(#[\SensitiveParameter] string $dsn)
|
||||
{
|
||||
$this->originalDsn = $dsn;
|
||||
|
||||
if (false === $params = parse_url($dsn)) {
|
||||
throw new InvalidArgumentException('The translation provider DSN is invalid.');
|
||||
}
|
||||
|
||||
if (!isset($params['scheme'])) {
|
||||
throw new InvalidArgumentException('The translation provider DSN must contain a scheme.');
|
||||
}
|
||||
$this->scheme = $params['scheme'];
|
||||
|
||||
if (!isset($params['host'])) {
|
||||
throw new InvalidArgumentException('The translation provider DSN must contain a host (use "default" by default).');
|
||||
}
|
||||
$this->host = $params['host'];
|
||||
|
||||
$this->user = '' !== ($params['user'] ?? '') ? rawurldecode($params['user']) : null;
|
||||
$this->password = '' !== ($params['pass'] ?? '') ? rawurldecode($params['pass']) : null;
|
||||
$this->port = $params['port'] ?? null;
|
||||
$this->path = $params['path'] ?? null;
|
||||
parse_str($params['query'] ?? '', $this->options);
|
||||
}
|
||||
|
||||
public function getScheme(): string
|
||||
{
|
||||
return $this->scheme;
|
||||
}
|
||||
|
||||
public function getHost(): string
|
||||
{
|
||||
return $this->host;
|
||||
}
|
||||
|
||||
public function getUser(): ?string
|
||||
{
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function getPort(?int $default = null): ?int
|
||||
{
|
||||
return $this->port ?? $default;
|
||||
}
|
||||
|
||||
public function getOption(string $key, mixed $default = null): mixed
|
||||
{
|
||||
return $this->options[$key] ?? $default;
|
||||
}
|
||||
|
||||
public function getRequiredOption(string $key): mixed
|
||||
{
|
||||
if (!\array_key_exists($key, $this->options) || '' === trim($this->options[$key])) {
|
||||
throw new MissingRequiredOptionException($key);
|
||||
}
|
||||
|
||||
return $this->options[$key];
|
||||
}
|
||||
|
||||
public function getOptions(): array
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
public function getPath(): ?string
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function getOriginalDsn(): string
|
||||
{
|
||||
return $this->originalDsn;
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Provider;
|
||||
|
||||
use Symfony\Component\Translation\TranslatorBag;
|
||||
use Symfony\Component\Translation\TranslatorBagInterface;
|
||||
|
||||
/**
|
||||
* Filters domains and locales between the Translator config values and those specific to each provider.
|
||||
*
|
||||
* @author Mathieu Santostefano <msantostefano@protonmail.com>
|
||||
*/
|
||||
class FilteringProvider implements ProviderInterface
|
||||
{
|
||||
private ProviderInterface $provider;
|
||||
private array $locales;
|
||||
private array $domains;
|
||||
|
||||
public function __construct(ProviderInterface $provider, array $locales, array $domains = [])
|
||||
{
|
||||
$this->provider = $provider;
|
||||
$this->locales = $locales;
|
||||
$this->domains = $domains;
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return (string) $this->provider;
|
||||
}
|
||||
|
||||
public function write(TranslatorBagInterface $translatorBag): void
|
||||
{
|
||||
$this->provider->write($translatorBag);
|
||||
}
|
||||
|
||||
public function read(array $domains, array $locales): TranslatorBag
|
||||
{
|
||||
$domains = !$this->domains ? $domains : array_intersect($this->domains, $domains);
|
||||
$locales = array_intersect($this->locales, $locales);
|
||||
|
||||
return $this->provider->read($domains, $locales);
|
||||
}
|
||||
|
||||
public function delete(TranslatorBagInterface $translatorBag): void
|
||||
{
|
||||
$this->provider->delete($translatorBag);
|
||||
}
|
||||
|
||||
public function getDomains(): array
|
||||
{
|
||||
return $this->domains;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Provider;
|
||||
|
||||
use Symfony\Component\Translation\TranslatorBag;
|
||||
use Symfony\Component\Translation\TranslatorBagInterface;
|
||||
|
||||
/**
|
||||
* @author Mathieu Santostefano <msantostefano@protonmail.com>
|
||||
*/
|
||||
class NullProvider implements ProviderInterface
|
||||
{
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'null';
|
||||
}
|
||||
|
||||
public function write(TranslatorBagInterface $translatorBag, bool $override = false): void
|
||||
{
|
||||
}
|
||||
|
||||
public function read(array $domains, array $locales): TranslatorBag
|
||||
{
|
||||
return new TranslatorBag();
|
||||
}
|
||||
|
||||
public function delete(TranslatorBagInterface $translatorBag): void
|
||||
{
|
||||
}
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Provider;
|
||||
|
||||
use Symfony\Component\Translation\Exception\UnsupportedSchemeException;
|
||||
|
||||
/**
|
||||
* @author Mathieu Santostefano <msantostefano@protonmail.com>
|
||||
*/
|
||||
final class NullProviderFactory extends AbstractProviderFactory
|
||||
{
|
||||
public function create(Dsn $dsn): ProviderInterface
|
||||
{
|
||||
if ('null' === $dsn->getScheme()) {
|
||||
return new NullProvider();
|
||||
}
|
||||
|
||||
throw new UnsupportedSchemeException($dsn, 'null', $this->getSupportedSchemes());
|
||||
}
|
||||
|
||||
protected function getSupportedSchemes(): array
|
||||
{
|
||||
return ['null'];
|
||||
}
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Provider;
|
||||
|
||||
use Symfony\Component\Translation\Exception\IncompleteDsnException;
|
||||
use Symfony\Component\Translation\Exception\UnsupportedSchemeException;
|
||||
|
||||
interface ProviderFactoryInterface
|
||||
{
|
||||
/**
|
||||
* @throws UnsupportedSchemeException
|
||||
* @throws IncompleteDsnException
|
||||
*/
|
||||
public function create(Dsn $dsn): ProviderInterface;
|
||||
|
||||
public function supports(Dsn $dsn): bool;
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Provider;
|
||||
|
||||
use Symfony\Component\Translation\TranslatorBag;
|
||||
use Symfony\Component\Translation\TranslatorBagInterface;
|
||||
|
||||
interface ProviderInterface extends \Stringable
|
||||
{
|
||||
/**
|
||||
* Translations available in the TranslatorBag only must be created.
|
||||
* Translations available in both the TranslatorBag and on the provider
|
||||
* must be overwritten.
|
||||
* Translations available on the provider only must be kept.
|
||||
*/
|
||||
public function write(TranslatorBagInterface $translatorBag): void;
|
||||
|
||||
public function read(array $domains, array $locales): TranslatorBag;
|
||||
|
||||
public function delete(TranslatorBagInterface $translatorBag): void;
|
||||
}
|
||||
Vendored
-57
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Provider;
|
||||
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @author Mathieu Santostefano <msantostefano@protonmail.com>
|
||||
*/
|
||||
final class TranslationProviderCollection
|
||||
{
|
||||
/**
|
||||
* @var array<string, ProviderInterface>
|
||||
*/
|
||||
private array $providers;
|
||||
|
||||
/**
|
||||
* @param array<string, ProviderInterface> $providers
|
||||
*/
|
||||
public function __construct(iterable $providers)
|
||||
{
|
||||
$this->providers = \is_array($providers) ? $providers : iterator_to_array($providers);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return '['.implode(',', array_keys($this->providers)).']';
|
||||
}
|
||||
|
||||
public function has(string $name): bool
|
||||
{
|
||||
return isset($this->providers[$name]);
|
||||
}
|
||||
|
||||
public function get(string $name): ProviderInterface
|
||||
{
|
||||
if (!$this->has($name)) {
|
||||
throw new InvalidArgumentException(sprintf('Provider "%s" not found. Available: "%s".', $name, (string) $this));
|
||||
}
|
||||
|
||||
return $this->providers[$name];
|
||||
}
|
||||
|
||||
public function keys(): array
|
||||
{
|
||||
return array_keys($this->providers);
|
||||
}
|
||||
}
|
||||
Vendored
-57
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Translation\Provider;
|
||||
|
||||
use Symfony\Component\Translation\Exception\UnsupportedSchemeException;
|
||||
|
||||
/**
|
||||
* @author Mathieu Santostefano <msantostefano@protonmail.com>
|
||||
*/
|
||||
class TranslationProviderCollectionFactory
|
||||
{
|
||||
private iterable $factories;
|
||||
private array $enabledLocales;
|
||||
|
||||
/**
|
||||
* @param iterable<mixed, ProviderFactoryInterface> $factories
|
||||
*/
|
||||
public function __construct(iterable $factories, array $enabledLocales)
|
||||
{
|
||||
$this->factories = $factories;
|
||||
$this->enabledLocales = $enabledLocales;
|
||||
}
|
||||
|
||||
public function fromConfig(array $config): TranslationProviderCollection
|
||||
{
|
||||
$providers = [];
|
||||
foreach ($config as $name => $currentConfig) {
|
||||
$providers[$name] = $this->fromDsnObject(
|
||||
new Dsn($currentConfig['dsn']),
|
||||
!$currentConfig['locales'] ? $this->enabledLocales : $currentConfig['locales'],
|
||||
!$currentConfig['domains'] ? [] : $currentConfig['domains']
|
||||
);
|
||||
}
|
||||
|
||||
return new TranslationProviderCollection($providers);
|
||||
}
|
||||
|
||||
public function fromDsnObject(Dsn $dsn, array $locales, array $domains = []): ProviderInterface
|
||||
{
|
||||
foreach ($this->factories as $factory) {
|
||||
if ($factory->supports($dsn)) {
|
||||
return new FilteringProvider($factory->create($dsn), $locales, $domains);
|
||||
}
|
||||
}
|
||||
|
||||
throw new UnsupportedSchemeException($dsn);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user