-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3,516 changed files
with
302,071 additions
and
4 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
{ | ||
"require": { | ||
"php": ">=8.2.0", | ||
"phpseclib/phpseclib": "3.0.35", | ||
"laravel/lumen-framework": "v10.0.0", | ||
"firebase/php-jwt" : "v6.4.0", | ||
"ezyang/htmlpurifier": "v4.16.0", | ||
"cboden/ratchet" : "v0.4.4", | ||
|
||
"symfony/routing" : "v6.2.8", | ||
"symfony/http-foundation" : "v6.2.10", | ||
"react/event-loop" : "v1.3.0", | ||
"react/stream" : "v1.2.0", | ||
"react/promise-timer" : "v1.9.0", | ||
"react/dns" : "v1.10.0", | ||
"react/socket" : "v1.12.0", | ||
"monolog/monolog" : "3.3.1", | ||
"symfony/translation" : "v6.2.8", | ||
"symfony/browser-kit" : "v6.2", | ||
"symfony/http-client" : "v6.2", | ||
"symfony/http-kernel" : "v6.2.6", | ||
"symfony/deprecation-contracts": "v3.4.0", | ||
"symfony/polyfill-intl-idn": "v1.28.0", | ||
"symfony/polyfill-intl-normalizer": "v1.28.0", | ||
"symfony/polyfill-mbstring": "v1.28.0", | ||
"symfony/polyfill-php72": "v1.28.0", | ||
"guzzlehttp/psr7" : "v2.5.0", | ||
"psr/http-client": "1.0.3", | ||
"guzzlehttp/guzzle": "7.7.1", | ||
"guzzlehttp/promises": "2.0.2", | ||
|
||
"google/auth": "1.34", | ||
"google/apiclient": "v2.15.3", | ||
"google/apiclient-services": "0.333.0", | ||
|
||
"nesbot/carbon" : "2.68.1", | ||
|
||
"tsugi/lib": "dev-master#5143de10d4ca185330913494ddbf1b72816c05ea", | ||
"koseu/lib": "dev-master#70c7ac1ca413c2dd541e078ebe07719405621b1b" | ||
}, | ||
"config": { | ||
"preferred-install": "dist" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Carbon | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# carbonphp/carbon-doctrine-types | ||
|
||
Types to use Carbon in Doctrine | ||
|
||
## Documentation | ||
|
||
[Check how to use in the official Carbon documentation](https://carbon.nesbot.com/symfony/) | ||
|
||
This package is an externalization of [src/Carbon/Doctrine](https://github.com/briannesbitt/Carbon/tree/2.71.0/src/Carbon/Doctrine) | ||
from `nestbot/carbon` package. | ||
|
||
Externalization allows to better deal with different versions of dbal. With | ||
version 4.0 of dbal, it no longer sustainable to be compatible with all version | ||
using a single code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "carbonphp/carbon-doctrine-types", | ||
"description": "Types to use Carbon in Doctrine", | ||
"type": "library", | ||
"keywords": [ | ||
"date", | ||
"time", | ||
"DateTime", | ||
"Carbon", | ||
"Doctrine" | ||
], | ||
"require": { | ||
"php": "^7.4 || ^8.0" | ||
}, | ||
"require-dev": { | ||
"doctrine/dbal": "^3.7.0", | ||
"nesbot/carbon": "^2.71.0 || ^3.0.0", | ||
"phpunit/phpunit": "^10.3" | ||
}, | ||
"conflict": { | ||
"doctrine/dbal": "<3.7.0 || >=4.0.0" | ||
}, | ||
"license": "MIT", | ||
"autoload": { | ||
"psr-4": { | ||
"Carbon\\Doctrine\\": "src/Carbon/Doctrine/" | ||
} | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "KyleKatarn", | ||
"email": "kylekatarnls@gmail.com" | ||
} | ||
], | ||
"minimum-stability": "dev" | ||
} |
14 changes: 14 additions & 0 deletions
14
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonDoctrineType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace Carbon\Doctrine; | ||
|
||
use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
|
||
interface CarbonDoctrineType | ||
{ | ||
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform); | ||
|
||
public function convertToPHPValue($value, AbstractPlatform $platform); | ||
|
||
public function convertToDatabaseValue($value, AbstractPlatform $platform); | ||
} |
7 changes: 7 additions & 0 deletions
7
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonImmutableType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Carbon\Doctrine; | ||
|
||
class CarbonImmutableType extends DateTimeImmutableType implements CarbonDoctrineType | ||
{ | ||
} |
7 changes: 7 additions & 0 deletions
7
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
|
||
namespace Carbon\Doctrine; | ||
|
||
class CarbonType extends DateTimeType implements CarbonDoctrineType | ||
{ | ||
} |
141 changes: 141 additions & 0 deletions
141
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/CarbonTypeConverter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
<?php | ||
|
||
namespace Carbon\Doctrine; | ||
|
||
use Carbon\Carbon; | ||
use Carbon\CarbonInterface; | ||
use DateTimeInterface; | ||
use Doctrine\DBAL\Platforms\AbstractPlatform; | ||
use Doctrine\DBAL\Platforms\DB2Platform; | ||
use Doctrine\DBAL\Platforms\OraclePlatform; | ||
use Doctrine\DBAL\Platforms\SqlitePlatform; | ||
use Doctrine\DBAL\Platforms\SQLServerPlatform; | ||
use Doctrine\DBAL\Types\ConversionException; | ||
use Exception; | ||
|
||
/** | ||
* @template T of CarbonInterface | ||
*/ | ||
trait CarbonTypeConverter | ||
{ | ||
/** | ||
* This property differentiates types installed by carbonphp/carbon-doctrine-types | ||
* from the ones embedded previously in nesbot/carbon source directly. | ||
* | ||
* @readonly | ||
*/ | ||
public bool $external = true; | ||
|
||
/** | ||
* @return class-string<T> | ||
*/ | ||
protected function getCarbonClassName(): string | ||
{ | ||
return Carbon::class; | ||
} | ||
|
||
public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform): string | ||
{ | ||
$precision = min( | ||
$fieldDeclaration['precision'] ?? DateTimeDefaultPrecision::get(), | ||
$this->getMaximumPrecision($platform), | ||
); | ||
|
||
$type = parent::getSQLDeclaration($fieldDeclaration, $platform); | ||
|
||
if (!$precision) { | ||
return $type; | ||
} | ||
|
||
if (str_contains($type, '(')) { | ||
return preg_replace('/\(\d+\)/', "($precision)", $type); | ||
} | ||
|
||
[$before, $after] = explode(' ', "$type "); | ||
|
||
return trim("$before($precision) $after"); | ||
} | ||
|
||
/** | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
* | ||
* @return T|null | ||
*/ | ||
public function convertToPHPValue($value, AbstractPlatform $platform) | ||
{ | ||
$class = $this->getCarbonClassName(); | ||
|
||
if ($value === null || is_a($value, $class)) { | ||
return $value; | ||
} | ||
|
||
if ($value instanceof DateTimeInterface) { | ||
return $class::instance($value); | ||
} | ||
|
||
$date = null; | ||
$error = null; | ||
|
||
try { | ||
$date = $class::parse($value); | ||
} catch (Exception $exception) { | ||
$error = $exception; | ||
} | ||
|
||
if (!$date) { | ||
throw ConversionException::conversionFailedFormat( | ||
$value, | ||
$this->getTypeName(), | ||
'Y-m-d H:i:s.u or any format supported by '.$class.'::parse()', | ||
$error | ||
); | ||
} | ||
|
||
return $date; | ||
} | ||
|
||
/** | ||
* @SuppressWarnings(PHPMD.UnusedFormalParameter) | ||
*/ | ||
public function convertToDatabaseValue($value, AbstractPlatform $platform): ?string | ||
{ | ||
if ($value === null) { | ||
return $value; | ||
} | ||
|
||
if ($value instanceof DateTimeInterface) { | ||
return $value->format('Y-m-d H:i:s.u'); | ||
} | ||
|
||
throw ConversionException::conversionFailedInvalidType( | ||
$value, | ||
$this->getTypeName(), | ||
['null', 'DateTime', 'Carbon'] | ||
); | ||
} | ||
|
||
private function getTypeName(): string | ||
{ | ||
$chunks = explode('\\', static::class); | ||
$type = preg_replace('/Type$/', '', end($chunks)); | ||
|
||
return strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $type)); | ||
} | ||
|
||
private function getMaximumPrecision(AbstractPlatform $platform): int | ||
{ | ||
if ($platform instanceof DB2Platform) { | ||
return 12; | ||
} | ||
|
||
if ($platform instanceof OraclePlatform) { | ||
return 9; | ||
} | ||
|
||
if ($platform instanceof SQLServerPlatform || $platform instanceof SqlitePlatform) { | ||
return 3; | ||
} | ||
|
||
return 6; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeDefaultPrecision.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Carbon\Doctrine; | ||
|
||
class DateTimeDefaultPrecision | ||
{ | ||
private static $precision = 6; | ||
|
||
/** | ||
* Change the default Doctrine datetime and datetime_immutable precision. | ||
* | ||
* @param int $precision | ||
*/ | ||
public static function set(int $precision): void | ||
{ | ||
self::$precision = $precision; | ||
} | ||
|
||
/** | ||
* Get the default Doctrine datetime and datetime_immutable precision. | ||
* | ||
* @return int | ||
*/ | ||
public static function get(): int | ||
{ | ||
return self::$precision; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeImmutableType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Carbon\Doctrine; | ||
|
||
use Carbon\CarbonImmutable; | ||
use Doctrine\DBAL\Types\VarDateTimeImmutableType; | ||
|
||
class DateTimeImmutableType extends VarDateTimeImmutableType implements CarbonDoctrineType | ||
{ | ||
/** @use CarbonTypeConverter<CarbonImmutable> */ | ||
use CarbonTypeConverter; | ||
|
||
/** | ||
* @return class-string<CarbonImmutable> | ||
*/ | ||
protected function getCarbonClassName(): string | ||
{ | ||
return CarbonImmutable::class; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
vendor/carbonphp/carbon-doctrine-types/src/Carbon/Doctrine/DateTimeType.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace Carbon\Doctrine; | ||
|
||
use Carbon\Carbon; | ||
use Doctrine\DBAL\Types\VarDateTimeType; | ||
|
||
class DateTimeType extends VarDateTimeType implements CarbonDoctrineType | ||
{ | ||
/** @use CarbonTypeConverter<Carbon> */ | ||
use CarbonTypeConverter; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.