mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 19:21:33 +00:00
resolved conflicts
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?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\CssSelector\Node;
|
||||
|
||||
/**
|
||||
* Represents a "<selector>:is(<subSelectorList>)" node.
|
||||
*
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Hubert Lenoir <lenoir.hubert@gmail.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class MatchingNode extends AbstractNode
|
||||
{
|
||||
/**
|
||||
* @param array<NodeInterface> $arguments
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly NodeInterface $selector,
|
||||
public readonly array $arguments = [],
|
||||
) {
|
||||
}
|
||||
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
$argumentsSpecificity = array_reduce(
|
||||
$this->arguments,
|
||||
fn ($c, $n) => 1 === $n->getSpecificity()->compareTo($c) ? $n->getSpecificity() : $c,
|
||||
new Specificity(0, 0, 0),
|
||||
);
|
||||
|
||||
return $this->selector->getSpecificity()->plus($argumentsSpecificity);
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$selectorArguments = array_map(
|
||||
fn ($n): string => ltrim((string) $n, '*'),
|
||||
$this->arguments,
|
||||
);
|
||||
|
||||
return \sprintf('%s[%s:is(%s)]', $this->getNodeName(), $this->selector, implode(', ', $selectorArguments));
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
<?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\CssSelector\Node;
|
||||
|
||||
/**
|
||||
* Represents a "<selector>:where(<subSelectorList>)" node.
|
||||
*
|
||||
* This component is a port of the Python cssselect library,
|
||||
* which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect.
|
||||
*
|
||||
* @author Hubert Lenoir <lenoir.hubert@gmail.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class SpecificityAdjustmentNode extends AbstractNode
|
||||
{
|
||||
/**
|
||||
* @param array<NodeInterface> $arguments
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly NodeInterface $selector,
|
||||
public readonly array $arguments = [],
|
||||
) {
|
||||
}
|
||||
|
||||
public function getSpecificity(): Specificity
|
||||
{
|
||||
return $this->selector->getSpecificity();
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
$selectorArguments = array_map(
|
||||
fn ($n) => ltrim((string) $n, '*'),
|
||||
$this->arguments,
|
||||
);
|
||||
|
||||
return \sprintf('%s[%s:where(%s)]', $this->getNodeName(), $this->selector, implode(', ', $selectorArguments));
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?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\Contracts\Service;
|
||||
|
||||
/**
|
||||
* A ServiceProviderInterface that is also countable and iterable.
|
||||
*
|
||||
* @author Kevin Bond <kevinbond@gmail.com>
|
||||
*
|
||||
* @template-covariant T of mixed
|
||||
*
|
||||
* @extends ServiceProviderInterface<T>
|
||||
* @extends \IteratorAggregate<string, T>
|
||||
*/
|
||||
interface ServiceCollectionInterface extends ServiceProviderInterface, \Countable, \IteratorAggregate
|
||||
{
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
<?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\Contracts\Service;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Contracts\Service\Attribute\Required;
|
||||
use Symfony\Contracts\Service\Attribute\SubscribedService;
|
||||
|
||||
/**
|
||||
* Implementation of ServiceSubscriberInterface that determines subscribed services
|
||||
* from methods that have the #[SubscribedService] attribute.
|
||||
*
|
||||
* Service ids are available as "ClassName::methodName" so that the implementation
|
||||
* of subscriber methods can be just `return $this->container->get(__METHOD__);`.
|
||||
*
|
||||
* @author Kevin Bond <kevinbond@gmail.com>
|
||||
*/
|
||||
trait ServiceMethodsSubscriberTrait
|
||||
{
|
||||
protected ContainerInterface $container;
|
||||
|
||||
public static function getSubscribedServices(): array
|
||||
{
|
||||
$services = method_exists(get_parent_class(self::class) ?: '', __FUNCTION__) ? parent::getSubscribedServices() : [];
|
||||
|
||||
foreach ((new \ReflectionClass(self::class))->getMethods() as $method) {
|
||||
if (self::class !== $method->getDeclaringClass()->name) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$attribute = $method->getAttributes(SubscribedService::class)[0] ?? null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($method->isStatic() || $method->isAbstract() || $method->isGenerator() || $method->isInternal() || $method->getNumberOfRequiredParameters()) {
|
||||
throw new \LogicException(sprintf('Cannot use "%s" on method "%s::%s()" (can only be used on non-static, non-abstract methods with no parameters).', SubscribedService::class, self::class, $method->name));
|
||||
}
|
||||
|
||||
if (!$returnType = $method->getReturnType()) {
|
||||
throw new \LogicException(sprintf('Cannot use "%s" on methods without a return type in "%s::%s()".', SubscribedService::class, $method->name, self::class));
|
||||
}
|
||||
|
||||
/* @var SubscribedService $attribute */
|
||||
$attribute = $attribute->newInstance();
|
||||
$attribute->key ??= self::class.'::'.$method->name;
|
||||
$attribute->type ??= $returnType instanceof \ReflectionNamedType ? $returnType->getName() : (string) $returnType;
|
||||
$attribute->nullable = $returnType->allowsNull();
|
||||
|
||||
if ($attribute->attributes) {
|
||||
$services[] = $attribute;
|
||||
} else {
|
||||
$services[$attribute->key] = ($attribute->nullable ? '?' : '').$attribute->type;
|
||||
}
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
#[Required]
|
||||
public function setContainer(ContainerInterface $container): ?ContainerInterface
|
||||
{
|
||||
$ret = null;
|
||||
if (method_exists(get_parent_class(self::class) ?: '', __FUNCTION__)) {
|
||||
$ret = parent::setContainer($container);
|
||||
}
|
||||
|
||||
$this->container = $container;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?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\String\Inflector;
|
||||
|
||||
final class SpanishInflector implements InflectorInterface
|
||||
{
|
||||
/**
|
||||
* A list of all rules for pluralise.
|
||||
*
|
||||
* @see https://www.spanishdict.com/guide/spanish-plural-noun-forms
|
||||
* @see https://www.rae.es/gram%C3%A1tica/morfolog%C3%ADa/la-formaci%C3%B3n-del-plural-plurales-en-s-y-plurales-en-es-reglas-generales
|
||||
*/
|
||||
// First entry: regex
|
||||
// Second entry: replacement
|
||||
private const PLURALIZE_REGEXP = [
|
||||
// Specials sí, no
|
||||
['/(sí|no)$/i', '\1es'],
|
||||
|
||||
// Words ending with vowel must use -s (RAE 3.2a, 3.2c)
|
||||
['/(a|e|i|o|u|á|é|í|ó|ú)$/i', '\1s'],
|
||||
|
||||
// Word ending in s or x and the previous letter is accented (RAE 3.2n)
|
||||
['/ás$/i', 'ases'],
|
||||
['/és$/i', 'eses'],
|
||||
['/ís$/i', 'ises'],
|
||||
['/ós$/i', 'oses'],
|
||||
['/ús$/i', 'uses'],
|
||||
|
||||
// Words ending in -ión must changed to -iones
|
||||
['/ión$/i', '\1iones'],
|
||||
|
||||
// Words ending in some consonants must use -es (RAE 3.2k)
|
||||
['/(l|r|n|d|j|s|x|ch|y)$/i', '\1es'],
|
||||
|
||||
// Word ending in z, must changed to ces
|
||||
['/(z)$/i', 'ces'],
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of all rules for singularize.
|
||||
*/
|
||||
private const SINGULARIZE_REGEXP = [
|
||||
// Specials sí, no
|
||||
['/(sí|no)es$/i', '\1'],
|
||||
|
||||
// Words ending in -ión must changed to -iones
|
||||
['/iones$/i', '\1ión'],
|
||||
|
||||
// Word ending in z, must changed to ces
|
||||
['/ces$/i', 'z'],
|
||||
|
||||
// Word ending in s or x and the previous letter is accented (RAE 3.2n)
|
||||
['/(\w)ases$/i', '\1ás'],
|
||||
['/eses$/i', 'és'],
|
||||
['/ises$/i', 'ís'],
|
||||
['/(\w{2,})oses$/i', '\1ós'],
|
||||
['/(\w)uses$/i', '\1ús'],
|
||||
|
||||
// Words ending in some consonants and -es, must be the consonants
|
||||
['/(l|r|n|d|j|s|x|ch|y)e?s$/i', '\1'],
|
||||
|
||||
// Words ended with vowel and s, must be vowel
|
||||
['/(a|e|i|o|u|á|é|ó|í|ú)s$/i', '\1'],
|
||||
];
|
||||
|
||||
private const UNINFLECTED_RULES = [
|
||||
// Words ending with pies (RAE 3.2n)
|
||||
'/.*(piés)$/i',
|
||||
];
|
||||
|
||||
private const UNINFLECTED = '/^(lunes|martes|miércoles|jueves|viernes|análisis|torax|yo|pies)$/i';
|
||||
|
||||
public function singularize(string $plural): array
|
||||
{
|
||||
if ($this->isInflectedWord($plural)) {
|
||||
return [$plural];
|
||||
}
|
||||
|
||||
foreach (self::SINGULARIZE_REGEXP as $rule) {
|
||||
[$regexp, $replace] = $rule;
|
||||
|
||||
if (1 === preg_match($regexp, $plural)) {
|
||||
return [preg_replace($regexp, $replace, $plural)];
|
||||
}
|
||||
}
|
||||
|
||||
return [$plural];
|
||||
}
|
||||
|
||||
public function pluralize(string $singular): array
|
||||
{
|
||||
if ($this->isInflectedWord($singular)) {
|
||||
return [$singular];
|
||||
}
|
||||
|
||||
foreach (self::PLURALIZE_REGEXP as $rule) {
|
||||
[$regexp, $replace] = $rule;
|
||||
|
||||
if (1 === preg_match($regexp, $singular)) {
|
||||
return [preg_replace($regexp, $replace, $singular)];
|
||||
}
|
||||
}
|
||||
|
||||
return [$singular.'s'];
|
||||
}
|
||||
|
||||
private function isInflectedWord(string $word): bool
|
||||
{
|
||||
foreach (self::UNINFLECTED_RULES as $rule) {
|
||||
if (1 === preg_match($rule, $word)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return 1 === preg_match(self::UNINFLECTED, $word);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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\String;
|
||||
|
||||
enum TruncateMode
|
||||
{
|
||||
/**
|
||||
* Will cut exactly at given length.
|
||||
*
|
||||
* Length: 14
|
||||
* Source: Lorem ipsum dolor sit amet
|
||||
* Output: Lorem ipsum do
|
||||
*/
|
||||
case Char;
|
||||
|
||||
/**
|
||||
* Returns the string up to the last complete word containing the specified length.
|
||||
*
|
||||
* Length: 14
|
||||
* Source: Lorem ipsum dolor sit amet
|
||||
* Output: Lorem ipsum
|
||||
*/
|
||||
case WordBefore;
|
||||
|
||||
/**
|
||||
* Returns the string up to the complete word after or at the given length.
|
||||
*
|
||||
* Length: 14
|
||||
* Source: Lorem ipsum dolor sit amet
|
||||
* Output: Lorem ipsum dolor
|
||||
*/
|
||||
case WordAfter;
|
||||
}
|
||||
Reference in New Issue
Block a user