Initial commit
This commit is contained in:
28
vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php
vendored
Normal file
28
vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.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 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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php
vendored
Normal file
36
vendor/nesbot/carbon/lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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 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
|
||||
{
|
||||
abstract protected 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
73
vendor/nesbot/carbon/lazy/Carbon/ProtectedDatePeriod.php
vendored
Normal file
73
vendor/nesbot/carbon/lazy/Carbon/ProtectedDatePeriod.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?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 Carbon;
|
||||
|
||||
use DatePeriod;
|
||||
|
||||
if (!class_exists(DatePeriodBase::class, false)) {
|
||||
class DatePeriodBase extends DatePeriod
|
||||
{
|
||||
/**
|
||||
* Period start in PHP < 8.2.
|
||||
*
|
||||
* @var CarbonInterface
|
||||
*
|
||||
* @deprecated PHP 8.2 this property is no longer in sync with the actual period start.
|
||||
*/
|
||||
protected $start;
|
||||
|
||||
/**
|
||||
* Period end in PHP < 8.2.
|
||||
*
|
||||
* @var CarbonInterface|null
|
||||
*
|
||||
* @deprecated PHP 8.2 this property is no longer in sync with the actual period end.
|
||||
*/
|
||||
protected $end;
|
||||
|
||||
/**
|
||||
* Period current iterated date in PHP < 8.2.
|
||||
*
|
||||
* @var CarbonInterface|null
|
||||
*
|
||||
* @deprecated PHP 8.2 this property is no longer in sync with the actual period current iterated date.
|
||||
*/
|
||||
protected $current;
|
||||
|
||||
/**
|
||||
* Period interval in PHP < 8.2.
|
||||
*
|
||||
* @var CarbonInterval|null
|
||||
*
|
||||
* @deprecated PHP 8.2 this property is no longer in sync with the actual period interval.
|
||||
*/
|
||||
protected $interval;
|
||||
|
||||
/**
|
||||
* Period recurrences in PHP < 8.2.
|
||||
*
|
||||
* @var int|float|null
|
||||
*
|
||||
* @deprecated PHP 8.2 this property is no longer in sync with the actual period recurrences.
|
||||
*/
|
||||
protected $recurrences;
|
||||
|
||||
/**
|
||||
* Period start included option in PHP < 8.2.
|
||||
*
|
||||
* @var bool
|
||||
*
|
||||
* @deprecated PHP 8.2 this property is no longer in sync with the actual period start included option.
|
||||
*/
|
||||
protected $include_start_date;
|
||||
}
|
||||
}
|
||||
52
vendor/nesbot/carbon/lazy/Carbon/TranslatorStrongType.php
vendored
Normal file
52
vendor/nesbot/carbon/lazy/Carbon/TranslatorStrongType.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
32
vendor/nesbot/carbon/lazy/Carbon/TranslatorWeakType.php
vendored
Normal file
32
vendor/nesbot/carbon/lazy/Carbon/TranslatorWeakType.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
vendor/nesbot/carbon/lazy/Carbon/UnprotectedDatePeriod.php
vendored
Normal file
20
vendor/nesbot/carbon/lazy/Carbon/UnprotectedDatePeriod.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?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 Carbon;
|
||||
|
||||
use DatePeriod;
|
||||
|
||||
if (!class_exists(DatePeriodBase::class, false)) {
|
||||
class DatePeriodBase extends DatePeriod
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user