Initial Commit
This commit is contained in:
22
dependencies/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php
vendored
Normal file
22
dependencies/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WP_Ultimo\Dependencies\Carbon\MessageFormatter;
|
||||
|
||||
use Symfony\Component\Translation\Formatter\MessageFormatterInterface;
|
||||
if (!\class_exists(LazyMessageFormatter::class, \false)) {
|
||||
abstract class LazyMessageFormatter implements MessageFormatterInterface
|
||||
{
|
||||
public function format(string $message, string $locale, array $parameters = []) : string
|
||||
{
|
||||
return $this->formatter->format($message, $this->transformLocale($locale), $parameters);
|
||||
}
|
||||
}
|
||||
}
|
28
dependencies/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php
vendored
Normal file
28
dependencies/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WP_Ultimo\Dependencies\Carbon\MessageFormatter;
|
||||
|
||||
use Symfony\Component\Translation\Formatter\ChoiceMessageFormatterInterface;
|
||||
use Symfony\Component\Translation\Formatter\MessageFormatterInterface;
|
||||
if (!\class_exists(LazyMessageFormatter::class, \false)) {
|
||||
abstract class LazyMessageFormatter implements MessageFormatterInterface, ChoiceMessageFormatterInterface
|
||||
{
|
||||
protected abstract function transformLocale(?string $locale) : ?string;
|
||||
public function format($message, $locale, array $parameters = [])
|
||||
{
|
||||
return $this->formatter->format($message, $this->transformLocale($locale), $parameters);
|
||||
}
|
||||
public function choiceFormat($message, $number, $locale, array $parameters = [])
|
||||
{
|
||||
return $this->formatter->choiceFormat($message, $number, $locale, $parameters);
|
||||
}
|
||||
}
|
||||
}
|
30
dependencies/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroBuiltin.php
vendored
Normal file
30
dependencies/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroBuiltin.php
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WP_Ultimo\Dependencies\Carbon\PHPStan;
|
||||
|
||||
use WP_Ultimo\Dependencies\PHPStan\BetterReflection\Reflection;
|
||||
use ReflectionMethod;
|
||||
if (!\class_exists(AbstractReflectionMacro::class, \false)) {
|
||||
abstract class AbstractReflectionMacro extends AbstractMacro
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getReflection() : ?ReflectionMethod
|
||||
{
|
||||
if ($this->reflectionFunction instanceof Reflection\ReflectionMethod) {
|
||||
return new Reflection\Adapter\ReflectionMethod($this->reflectionFunction);
|
||||
}
|
||||
return $this->reflectionFunction instanceof ReflectionMethod ? $this->reflectionFunction : null;
|
||||
}
|
||||
}
|
||||
}
|
33
dependencies/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroStatic.php
vendored
Normal file
33
dependencies/nesbot/carbon/lazy/Carbon/PHPStan/AbstractMacroStatic.php
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WP_Ultimo\Dependencies\Carbon\PHPStan;
|
||||
|
||||
use WP_Ultimo\Dependencies\PHPStan\BetterReflection\Reflection;
|
||||
use ReflectionMethod;
|
||||
if (!\class_exists(AbstractReflectionMacro::class, \false)) {
|
||||
abstract class AbstractReflectionMacro extends AbstractMacro
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getReflection() : ?Reflection\Adapter\ReflectionMethod
|
||||
{
|
||||
if ($this->reflectionFunction instanceof Reflection\Adapter\ReflectionMethod) {
|
||||
return $this->reflectionFunction;
|
||||
}
|
||||
if ($this->reflectionFunction instanceof Reflection\ReflectionMethod) {
|
||||
return new Reflection\Adapter\ReflectionMethod($this->reflectionFunction);
|
||||
}
|
||||
return $this->reflectionFunction instanceof ReflectionMethod ? new Reflection\Adapter\ReflectionMethod(Reflection\ReflectionMethod::createFromName($this->reflectionFunction->getDeclaringClass()->getName(), $this->reflectionFunction->getName())) : null;
|
||||
}
|
||||
}
|
||||
}
|
40
dependencies/nesbot/carbon/lazy/Carbon/PHPStan/MacroStrongType.php
vendored
Normal file
40
dependencies/nesbot/carbon/lazy/Carbon/PHPStan/MacroStrongType.php
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WP_Ultimo\Dependencies\Carbon\PHPStan;
|
||||
|
||||
if (!\class_exists(LazyMacro::class, \false)) {
|
||||
abstract class LazyMacro extends AbstractReflectionMacro
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFileName() : ?string
|
||||
{
|
||||
$file = $this->reflectionFunction->getFileName();
|
||||
return (($file ? \realpath($file) : null) ?: $file) ?: null;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStartLine() : ?int
|
||||
{
|
||||
return $this->reflectionFunction->getStartLine();
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEndLine() : ?int
|
||||
{
|
||||
return $this->reflectionFunction->getEndLine();
|
||||
}
|
||||
}
|
||||
}
|
46
dependencies/nesbot/carbon/lazy/Carbon/PHPStan/MacroWeakType.php
vendored
Normal file
46
dependencies/nesbot/carbon/lazy/Carbon/PHPStan/MacroWeakType.php
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WP_Ultimo\Dependencies\Carbon\PHPStan;
|
||||
|
||||
if (!\class_exists(LazyMacro::class, \false)) {
|
||||
abstract class LazyMacro extends AbstractReflectionMacro
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return string|false
|
||||
*/
|
||||
public function getFileName()
|
||||
{
|
||||
$file = $this->reflectionFunction->getFileName();
|
||||
return (($file ? \realpath($file) : null) ?: $file) ?: null;
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return int|false
|
||||
*/
|
||||
public function getStartLine()
|
||||
{
|
||||
return $this->reflectionFunction->getStartLine();
|
||||
}
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return int|false
|
||||
*/
|
||||
public function getEndLine()
|
||||
{
|
||||
return $this->reflectionFunction->getEndLine();
|
||||
}
|
||||
}
|
||||
}
|
43
dependencies/nesbot/carbon/lazy/Carbon/TranslatorStrongType.php
vendored
Normal file
43
dependencies/nesbot/carbon/lazy/Carbon/TranslatorStrongType.php
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WP_Ultimo\Dependencies\Carbon;
|
||||
|
||||
use Symfony\Component\Translation\MessageCatalogueInterface;
|
||||
if (!\class_exists(LazyTranslator::class, \false)) {
|
||||
class LazyTranslator extends AbstractTranslator implements TranslatorStrongTypeInterface
|
||||
{
|
||||
public function trans(?string $id, array $parameters = [], ?string $domain = null, ?string $locale = null) : string
|
||||
{
|
||||
return $this->translate($id, $parameters, $domain, $locale);
|
||||
}
|
||||
public function getFromCatalogue(MessageCatalogueInterface $catalogue, string $id, string $domain = 'messages')
|
||||
{
|
||||
$messages = $this->getPrivateProperty($catalogue, 'messages');
|
||||
if (isset($messages[$domain . MessageCatalogueInterface::INTL_DOMAIN_SUFFIX][$id])) {
|
||||
return $messages[$domain . MessageCatalogueInterface::INTL_DOMAIN_SUFFIX][$id];
|
||||
}
|
||||
if (isset($messages[$domain][$id])) {
|
||||
return $messages[$domain][$id];
|
||||
}
|
||||
$fallbackCatalogue = $this->getPrivateProperty($catalogue, 'fallbackCatalogue');
|
||||
if ($fallbackCatalogue !== null) {
|
||||
return $this->getFromCatalogue($fallbackCatalogue, $id, $domain);
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
private function getPrivateProperty($instance, string $field)
|
||||
{
|
||||
return (function (string $field) {
|
||||
return $this->{$field};
|
||||
})->call($instance, $field);
|
||||
}
|
||||
}
|
||||
}
|
31
dependencies/nesbot/carbon/lazy/Carbon/TranslatorWeakType.php
vendored
Normal file
31
dependencies/nesbot/carbon/lazy/Carbon/TranslatorWeakType.php
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Carbon package.
|
||||
*
|
||||
* (c) Brian Nesbitt <brian@nesbot.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
namespace WP_Ultimo\Dependencies\Carbon;
|
||||
|
||||
if (!\class_exists(LazyTranslator::class, \false)) {
|
||||
class LazyTranslator extends AbstractTranslator
|
||||
{
|
||||
/**
|
||||
* Returns the translation.
|
||||
*
|
||||
* @param string|null $id
|
||||
* @param array $parameters
|
||||
* @param string|null $domain
|
||||
* @param string|null $locale
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function trans($id, array $parameters = [], $domain = null, $locale = null)
|
||||
{
|
||||
return $this->translate($id, $parameters, $domain, $locale);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user