Browse Source

quote

master
chuan 3 months ago
parent
commit
5ffcf8b198
  1. 79
      app/admin/controller/Config.php
  2. 62
      app/admin/controller/Test.php
  3. 6
      app/admin/route/app.php
  4. 23
      app/utility/MongoConnection.php
  5. 4
      composer.json
  6. 84
      composer.lock
  7. 1
      vendor/composer/autoload_files.php
  8. 1
      vendor/composer/autoload_psr4.php
  9. 6
      vendor/composer/autoload_static.php
  10. 85
      vendor/composer/installed.json
  11. 19
      vendor/composer/installed.php
  12. 202
      vendor/mongodb/mongodb/LICENSE
  13. 65
      vendor/mongodb/mongodb/composer.json
  14. 85
      vendor/mongodb/mongodb/sbom.json
  15. 44
      vendor/mongodb/mongodb/src/Builder/Accumulator.php
  16. 127
      vendor/mongodb/mongodb/src/Builder/Accumulator/AccumulatorAccumulator.php
  17. 44
      vendor/mongodb/mongodb/src/Builder/Accumulator/AddToSetAccumulator.php
  18. 50
      vendor/mongodb/mongodb/src/Builder/Accumulator/AvgAccumulator.php
  19. 52
      vendor/mongodb/mongodb/src/Builder/Accumulator/BottomAccumulator.php
  20. 68
      vendor/mongodb/mongodb/src/Builder/Accumulator/BottomNAccumulator.php
  21. 32
      vendor/mongodb/mongodb/src/Builder/Accumulator/CountAccumulator.php
  22. 60
      vendor/mongodb/mongodb/src/Builder/Accumulator/CovariancePopAccumulator.php
  23. 60
      vendor/mongodb/mongodb/src/Builder/Accumulator/CovarianceSampAccumulator.php
  24. 30
      vendor/mongodb/mongodb/src/Builder/Accumulator/DenseRankAccumulator.php
  25. 66
      vendor/mongodb/mongodb/src/Builder/Accumulator/DerivativeAccumulator.php
  26. 30
      vendor/mongodb/mongodb/src/Builder/Accumulator/DocumentNumberAccumulator.php
  27. 73
      vendor/mongodb/mongodb/src/Builder/Accumulator/ExpMovingAvgAccumulator.php
  28. 554
      vendor/mongodb/mongodb/src/Builder/Accumulator/FactoryTrait.php
  29. 44
      vendor/mongodb/mongodb/src/Builder/Accumulator/FirstAccumulator.php
  30. 60
      vendor/mongodb/mongodb/src/Builder/Accumulator/FirstNAccumulator.php
  31. 66
      vendor/mongodb/mongodb/src/Builder/Accumulator/IntegralAccumulator.php
  32. 44
      vendor/mongodb/mongodb/src/Builder/Accumulator/LastAccumulator.php
  33. 69
      vendor/mongodb/mongodb/src/Builder/Accumulator/LastNAccumulator.php
  34. 50
      vendor/mongodb/mongodb/src/Builder/Accumulator/LinearFillAccumulator.php
  35. 44
      vendor/mongodb/mongodb/src/Builder/Accumulator/LocfAccumulator.php
  36. 44
      vendor/mongodb/mongodb/src/Builder/Accumulator/MaxAccumulator.php
  37. 67
      vendor/mongodb/mongodb/src/Builder/Accumulator/MaxNAccumulator.php
  38. 59
      vendor/mongodb/mongodb/src/Builder/Accumulator/MedianAccumulator.php
  39. 49
      vendor/mongodb/mongodb/src/Builder/Accumulator/MergeObjectsAccumulator.php
  40. 44
      vendor/mongodb/mongodb/src/Builder/Accumulator/MinAccumulator.php
  41. 67
      vendor/mongodb/mongodb/src/Builder/Accumulator/MinNAccumulator.php
  42. 87
      vendor/mongodb/mongodb/src/Builder/Accumulator/PercentileAccumulator.php
  43. 44
      vendor/mongodb/mongodb/src/Builder/Accumulator/PushAccumulator.php
  44. 30
      vendor/mongodb/mongodb/src/Builder/Accumulator/RankAccumulator.php
  45. 71
      vendor/mongodb/mongodb/src/Builder/Accumulator/ShiftAccumulator.php
  46. 51
      vendor/mongodb/mongodb/src/Builder/Accumulator/StdDevPopAccumulator.php
  47. 51
      vendor/mongodb/mongodb/src/Builder/Accumulator/StdDevSampAccumulator.php
  48. 50
      vendor/mongodb/mongodb/src/Builder/Accumulator/SumAccumulator.php
  49. 53
      vendor/mongodb/mongodb/src/Builder/Accumulator/TopAccumulator.php
  50. 68
      vendor/mongodb/mongodb/src/Builder/Accumulator/TopNAccumulator.php
  51. 109
      vendor/mongodb/mongodb/src/Builder/BuilderEncoder.php
  52. 57
      vendor/mongodb/mongodb/src/Builder/Encoder/CombinedFieldQueryEncoder.php
  53. 36
      vendor/mongodb/mongodb/src/Builder/Encoder/DateTimeEncoder.php
  54. 35
      vendor/mongodb/mongodb/src/Builder/Encoder/DictionaryEncoder.php
  55. 34
      vendor/mongodb/mongodb/src/Builder/Encoder/FieldPathEncoder.php
  56. 126
      vendor/mongodb/mongodb/src/Builder/Encoder/OperatorEncoder.php
  57. 65
      vendor/mongodb/mongodb/src/Builder/Encoder/OutputWindowEncoder.php
  58. 42
      vendor/mongodb/mongodb/src/Builder/Encoder/PipelineEncoder.php
  59. 62
      vendor/mongodb/mongodb/src/Builder/Encoder/QueryEncoder.php
  60. 59
      vendor/mongodb/mongodb/src/Builder/Encoder/RecursiveEncode.php
  61. 35
      vendor/mongodb/mongodb/src/Builder/Encoder/VariableEncoder.php
  62. 21
      vendor/mongodb/mongodb/src/Builder/Expression.php
  63. 46
      vendor/mongodb/mongodb/src/Builder/Expression/AbsOperator.php
  64. 52
      vendor/mongodb/mongodb/src/Builder/Expression/AcosOperator.php
  65. 52
      vendor/mongodb/mongodb/src/Builder/Expression/AcoshOperator.php
  66. 53
      vendor/mongodb/mongodb/src/Builder/Expression/AddOperator.php
  67. 52
      vendor/mongodb/mongodb/src/Builder/Expression/AllElementsTrueOperator.php
  68. 55
      vendor/mongodb/mongodb/src/Builder/Expression/AndOperator.php
  69. 52
      vendor/mongodb/mongodb/src/Builder/Expression/AnyElementTrueOperator.php
  70. 63
      vendor/mongodb/mongodb/src/Builder/Expression/ArrayElemAtOperator.php
  71. 29
      vendor/mongodb/mongodb/src/Builder/Expression/ArrayFieldPath.php
  72. 52
      vendor/mongodb/mongodb/src/Builder/Expression/ArrayToObjectOperator.php
  73. 52
      vendor/mongodb/mongodb/src/Builder/Expression/AsinOperator.php
  74. 52
      vendor/mongodb/mongodb/src/Builder/Expression/AsinhOperator.php
  75. 63
      vendor/mongodb/mongodb/src/Builder/Expression/Atan2Operator.php
  76. 52
      vendor/mongodb/mongodb/src/Builder/Expression/AtanOperator.php
  77. 52
      vendor/mongodb/mongodb/src/Builder/Expression/AtanhOperator.php
  78. 51
      vendor/mongodb/mongodb/src/Builder/Expression/AvgOperator.php
  79. 29
      vendor/mongodb/mongodb/src/Builder/Expression/BinDataFieldPath.php
  80. 37
      vendor/mongodb/mongodb/src/Builder/Expression/BinarySizeOperator.php
  81. 50
      vendor/mongodb/mongodb/src/Builder/Expression/BitAndOperator.php
  82. 46
      vendor/mongodb/mongodb/src/Builder/Expression/BitNotOperator.php
  83. 50
      vendor/mongodb/mongodb/src/Builder/Expression/BitOrOperator.php
  84. 50
      vendor/mongodb/mongodb/src/Builder/Expression/BitXorOperator.php
  85. 29
      vendor/mongodb/mongodb/src/Builder/Expression/BoolFieldPath.php
  86. 48
      vendor/mongodb/mongodb/src/Builder/Expression/BsonSizeOperator.php
  87. 56
      vendor/mongodb/mongodb/src/Builder/Expression/CaseOperator.php
  88. 46
      vendor/mongodb/mongodb/src/Builder/Expression/CeilOperator.php
  89. 47
      vendor/mongodb/mongodb/src/Builder/Expression/CmpOperator.php
  90. 50
      vendor/mongodb/mongodb/src/Builder/Expression/ConcatArraysOperator.php
  91. 48
      vendor/mongodb/mongodb/src/Builder/Expression/ConcatOperator.php
  92. 61
      vendor/mongodb/mongodb/src/Builder/Expression/CondOperator.php
  93. 69
      vendor/mongodb/mongodb/src/Builder/Expression/ConvertOperator.php
  94. 50
      vendor/mongodb/mongodb/src/Builder/Expression/CosOperator.php
  95. 50
      vendor/mongodb/mongodb/src/Builder/Expression/CoshOperator.php
  96. 74
      vendor/mongodb/mongodb/src/Builder/Expression/DateAddOperator.php
  97. 86
      vendor/mongodb/mongodb/src/Builder/Expression/DateDiffOperator.php
  98. 29
      vendor/mongodb/mongodb/src/Builder/Expression/DateFieldPath.php
  99. 157
      vendor/mongodb/mongodb/src/Builder/Expression/DateFromPartsOperator.php
  100. 85
      vendor/mongodb/mongodb/src/Builder/Expression/DateFromStringOperator.php

79
app/admin/controller/Config.php

@ -3,6 +3,8 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\service\ConfigService; use app\admin\service\ConfigService;
use app\utility\MongoConnection;
use think\facade\Cache;
use think\facade\Filesystem; use think\facade\Filesystem;
use app\model\ConfigModel; use app\model\ConfigModel;
@ -90,4 +92,81 @@ class Config extends AdminBaseController
$returnData = (new ConfigService())->editSmsTemplate($this->request->param()); $returnData = (new ConfigService())->editSmsTemplate($this->request->param());
return json($returnData); return json($returnData);
} }
// 获取行情数据列表
public function quoteList()
{
$params = $this->request->param();
if (!isset($params['page']) || !isset($params['page_size'])) {
return json([
'code' => 400,
'message' => '缺少参数',
'data' => []
]);
}
// 分页计算
$page = $params['page'];
$pageSize = $params['page_size'];
$options = [
'skip' => ($page - 1) * $pageSize,
'limit' => $pageSize,
'sort' => ['_id' => -1], // 按创建时间倒序
];
// 构造查询条件
$filter = [];
if (!empty($params['name'])) {
// 使用正则表达式进行模糊匹配(i 表示不区分大小写)
$filter['Name'] = [
'$regex' => $params['name'],
'$options' => 'i'
];
}
// 查询数据
$client = MongoConnection::getClient();
$collection = $client->selectCollection('bourse', 'stockListBak');
$cursor = $collection->find($filter, $options);
$results = iterator_to_array($cursor); // 将 BSON 文档转换为数组
$total = $collection->countDocuments($filter);
$list = [];
foreach ($results as $item) {
$arr = (array)$item;
$list[] = $arr;
}
return json([
'code' => 400,
'message' => '缺少参数',
'data' => [
'total' => $total,
'page' => $page,
'pageSize' => $pageSize,
'list' => $list,
]
]);
}
// 行情数据置顶
public function quoteTopData()
{
$params = $this->request->param();
if (empty($params['id'])) {
return json([
'code' => 400,
'message' => '缺少参数',
'data' => []
]);
}
$res = Cache::store('redis')->lPush(MongoConnection::QUOTE_TOP_DATA_LIST_KEY, trim($params['id']));
return json([
'code' => 0,
'message' => 'ok',
'data' => [$res]
]);
}
} }

62
app/admin/controller/Test.php

@ -1,10 +1,9 @@
<?php <?php
namespace app\admin\controller; namespace app\admin\controller;
use app\model\AdminModel; use app\utility\MongoConnection;
use app\model\UserAccessLogModel; use MongoDB\BSON\Regex;
use app\model\UserModel; use think\facade\Cache;
use app\model\UserNoModel;
class Test extends AdminBaseController class Test extends AdminBaseController
{ {
@ -29,4 +28,59 @@ class Test extends AdminBaseController
'app_number' => $appNumber 'app_number' => $appNumber
]]); ]]);
} }
public function testMongo()
{
$client = MongoConnection::getClient();
$collection = $client->selectCollection('bourse', 'stockListBak');
// 分页计算
$page = 1;
$pageSize = 10;
$options = [
'skip' => ($page - 1) * $pageSize,
'limit' => $pageSize,
'sort' => ['_id' => -1], // 按创建时间倒序
];
// 构造查询条件
$filter = [];
$filterName = 'xxx';
if (!empty($filterName)) {
// 使用正则表达式进行模糊匹配(i 表示不区分大小写)
$filter['Name'] = [
'$regex' => 'POP',
'$options' => 'i' // i = ignore case
];
}
// 查询数据
$cursor = $collection->find($filter, $options);
$total = $collection->countDocuments($filter);
// 将 BSON 文档转换为数组
$results = iterator_to_array($cursor);
$data = [];
foreach ($results as $item) {
$arr = (array)$item;
$data[] = $arr;
if ($arr['Name'] == "POPULAR FOUNDATIONS LIMITED") {
$oidArr = (array)$arr['_id'];
echo "oid===".$oidArr['oid'];
// 将目标缓存到redis队列中
$res = Cache::store('redis')->lPush('STOCK_MARKET_TOP_DATA', $oidArr['oid']);
echo "cache res==";
var_dump($res);
echo PHP_EOL;
}
}
return json( [
'total' => $total,
'page' => $page,
'pageSize' => $pageSize,
'data' => $data
]);
}
} }

6
app/admin/route/app.php

@ -12,7 +12,7 @@ $header = [
// 需要登陆的接口 使用中间件校验 请求路径 XwkjlLbDcG/test // 需要登陆的接口 使用中间件校验 请求路径 XwkjlLbDcG/test
//Route::get('/test', 'Test/index'); //Route::get('/test', 'Test/index');
Route::post('/test', 'Test/index'); Route::post('/test', 'Test/testMongo');
Route::post('/test_upload', 'Upload/uploadVideo'); Route::post('/test_upload', 'Upload/uploadVideo');
Route::post('test_api', 'Index/dailyUserRegistration'); Route::post('test_api', 'Index/dailyUserRegistration');
Route::group('/', function () { Route::group('/', function () {
@ -28,6 +28,10 @@ Route::group('/', function () {
Route::post('config/sms_template_list', 'Config/smsTemplateList'); //获取短信模板列表 Route::post('config/sms_template_list', 'Config/smsTemplateList'); //获取短信模板列表
Route::post('config/edit_sms_template', 'Config/editSmsTemplate'); //编辑短信模板 Route::post('config/edit_sms_template', 'Config/editSmsTemplate'); //编辑短信模板
// 行情数据列表
Route::post('config/quote_list', 'Config/quoteList'); // 获取行情数据列表
Route::post('config/quote_top_data', 'Config/quoteTopData'); // 置顶某条行情数据(这里是将其加入缓存,由go服务那边去过滤处理)
// 消息推送 // 消息推送
Route::post('notice/popup', 'Notice/popUp'); // 弹窗推送消息 Route::post('notice/popup', 'Notice/popUp'); // 弹窗推送消息
Route::post('notice/push_message', 'Notice/pushMessage'); // 使用Pusher推送系统级消息 Route::post('notice/push_message', 'Notice/pushMessage'); // 使用Pusher推送系统级消息

23
app/utility/MongoConnection.php

@ -0,0 +1,23 @@
<?php
namespace app\utility;
use MongoDB\Client;
class MongoConnection
{
const QUOTE_TOP_DATA_LIST_KEY = 'QUOTE_TOP_DATA_LIST';
private static $client = null;
public static function getClient() {
if (self::$client === null) {
$uri = "mongodb://".env('MONGODB.USERNAME').':'.env('MONGODB.PASSWORD').'@'.env('MONGODB.HOST').":".env('MONGODB.PORT');
self::$client = new Client($uri, [
'maxPoolSize' => 200, // 设置连接池最大连接数
'minPoolSize' => 10, // 设置连接池最小连接数(可选)
'serverSelectionTimeoutMS' => 5000, // 超时设置(防止请求挂死) 单位是毫秒
]);
}
return self::$client;
}
}

4
composer.json

@ -37,7 +37,9 @@
"ext-json": "*", "ext-json": "*",
"aws/aws-sdk-php": "^3.337", "aws/aws-sdk-php": "^3.337",
"workerman/gatewayclient": "^3.1", "workerman/gatewayclient": "^3.1",
"pusher/pusher-push-notifications": "^2.0" "pusher/pusher-push-notifications": "^2.0",
"mongodb/mongodb": "^1.21",
"ext-mongodb": "*"
}, },
"require-dev": { "require-dev": {
"symfony/var-dumper": "^4.2", "symfony/var-dumper": "^4.2",

84
composer.lock

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "060b4e88568c2f7d16da36058884c54d", "content-hash": "ce65030475f43004bd1110c2ef9dadce",
"packages": [ "packages": [
{ {
"name": "adbario/php-dot-notation", "name": "adbario/php-dot-notation",
@ -1924,6 +1924,88 @@
}, },
"time": "2024-11-14T23:14:52+00:00" "time": "2024-11-14T23:14:52+00:00"
}, },
{
"name": "mongodb/mongodb",
"version": "1.21.1",
"source": {
"type": "git",
"url": "https://github.com/mongodb/mongo-php-library.git",
"reference": "37bc8df3a67ddf8380704a5ba5dbd00e92ec1f6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/37bc8df3a67ddf8380704a5ba5dbd00e92ec1f6a",
"reference": "37bc8df3a67ddf8380704a5ba5dbd00e92ec1f6a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"composer-runtime-api": "^2.0",
"ext-mongodb": "^1.21.0",
"php": "^8.1",
"psr/log": "^1.1.4|^2|^3"
},
"replace": {
"mongodb/builder": "*"
},
"require-dev": {
"doctrine/coding-standard": "^12.0",
"phpunit/phpunit": "^10.5.35",
"rector/rector": "^1.2",
"squizlabs/php_codesniffer": "^3.7",
"vimeo/psalm": "6.5.*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"MongoDB\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Andreas Braun",
"email": "andreas.braun@mongodb.com"
},
{
"name": "Jeremy Mikola",
"email": "jmikola@gmail.com"
},
{
"name": "Jérôme Tamarelle",
"email": "jerome.tamarelle@mongodb.com"
}
],
"description": "MongoDB driver library",
"homepage": "https://jira.mongodb.org/browse/PHPLIB",
"keywords": [
"database",
"driver",
"mongodb",
"persistence"
],
"support": {
"issues": "https://github.com/mongodb/mongo-php-library/issues",
"source": "https://github.com/mongodb/mongo-php-library/tree/1.21.1"
},
"time": "2025-02-28T17:24:20+00:00"
},
{ {
"name": "mtdowling/jmespath.php", "name": "mtdowling/jmespath.php",
"version": "2.7.0", "version": "2.7.0",

1
vendor/composer/autoload_files.php

@ -21,6 +21,7 @@ return array(
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'66453932bc1be9fb2f910a27947d11b6' => $vendorDir . '/alibabacloud/client/src/Functions.php', '66453932bc1be9fb2f910a27947d11b6' => $vendorDir . '/alibabacloud/client/src/Functions.php',
'8a9dc1de0ca7e01f3e08231539562f61' => $vendorDir . '/aws/aws-sdk-php/src/functions.php', '8a9dc1de0ca7e01f3e08231539562f61' => $vendorDir . '/aws/aws-sdk-php/src/functions.php',
'3a37ebac017bc098e9a86b35401e7a68' => $vendorDir . '/mongodb/mongodb/src/functions.php',
'667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php', '667aeda72477189d0494fecd327c3641' => $vendorDir . '/symfony/var-dumper/Resources/functions/dump.php',
'cc56288302d9df745d97c934d6a6e5f0' => $vendorDir . '/topthink/think-queue/src/common.php', 'cc56288302d9df745d97c934d6a6e5f0' => $vendorDir . '/topthink/think-queue/src/common.php',
); );

1
vendor/composer/autoload_psr4.php

@ -35,6 +35,7 @@ return array(
'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'), 'Psr\\Cache\\' => array($vendorDir . '/psr/cache/src'),
'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'), 'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'),
'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'), 'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'),
'MongoDB\\' => array($vendorDir . '/mongodb/mongodb/src'),
'MaxMind\\WebService\\' => array($vendorDir . '/maxmind/web-service-common/src/WebService'), 'MaxMind\\WebService\\' => array($vendorDir . '/maxmind/web-service-common/src/WebService'),
'MaxMind\\Exception\\' => array($vendorDir . '/maxmind/web-service-common/src/Exception'), 'MaxMind\\Exception\\' => array($vendorDir . '/maxmind/web-service-common/src/Exception'),
'MaxMind\\Db\\' => array($vendorDir . '/maxmind-db/reader/src/MaxMind/Db'), 'MaxMind\\Db\\' => array($vendorDir . '/maxmind-db/reader/src/MaxMind/Db'),

6
vendor/composer/autoload_static.php

@ -22,6 +22,7 @@ class ComposerStaticInitdd94061c596fec45ed08426e6d417237
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php', 'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
'66453932bc1be9fb2f910a27947d11b6' => __DIR__ . '/..' . '/alibabacloud/client/src/Functions.php', '66453932bc1be9fb2f910a27947d11b6' => __DIR__ . '/..' . '/alibabacloud/client/src/Functions.php',
'8a9dc1de0ca7e01f3e08231539562f61' => __DIR__ . '/..' . '/aws/aws-sdk-php/src/functions.php', '8a9dc1de0ca7e01f3e08231539562f61' => __DIR__ . '/..' . '/aws/aws-sdk-php/src/functions.php',
'3a37ebac017bc098e9a86b35401e7a68' => __DIR__ . '/..' . '/mongodb/mongodb/src/functions.php',
'667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php', '667aeda72477189d0494fecd327c3641' => __DIR__ . '/..' . '/symfony/var-dumper/Resources/functions/dump.php',
'cc56288302d9df745d97c934d6a6e5f0' => __DIR__ . '/..' . '/topthink/think-queue/src/common.php', 'cc56288302d9df745d97c934d6a6e5f0' => __DIR__ . '/..' . '/topthink/think-queue/src/common.php',
); );
@ -85,6 +86,7 @@ class ComposerStaticInitdd94061c596fec45ed08426e6d417237
), ),
'M' => 'M' =>
array ( array (
'MongoDB\\' => 8,
'MaxMind\\WebService\\' => 19, 'MaxMind\\WebService\\' => 19,
'MaxMind\\Exception\\' => 18, 'MaxMind\\Exception\\' => 18,
'MaxMind\\Db\\' => 11, 'MaxMind\\Db\\' => 11,
@ -254,6 +256,10 @@ class ComposerStaticInitdd94061c596fec45ed08426e6d417237
array ( array (
0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src', 0 => __DIR__ . '/..' . '/phpmailer/phpmailer/src',
), ),
'MongoDB\\' =>
array (
0 => __DIR__ . '/..' . '/mongodb/mongodb/src',
),
'MaxMind\\WebService\\' => 'MaxMind\\WebService\\' =>
array ( array (
0 => __DIR__ . '/..' . '/maxmind/web-service-common/src/WebService', 0 => __DIR__ . '/..' . '/maxmind/web-service-common/src/WebService',

85
vendor/composer/installed.json

@ -1927,6 +1927,91 @@
}, },
"install-path": "../maxmind/web-service-common" "install-path": "../maxmind/web-service-common"
}, },
{
"name": "mongodb/mongodb",
"version": "1.21.1",
"version_normalized": "1.21.1.0",
"source": {
"type": "git",
"url": "https://github.com/mongodb/mongo-php-library.git",
"reference": "37bc8df3a67ddf8380704a5ba5dbd00e92ec1f6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/37bc8df3a67ddf8380704a5ba5dbd00e92ec1f6a",
"reference": "37bc8df3a67ddf8380704a5ba5dbd00e92ec1f6a",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"composer-runtime-api": "^2.0",
"ext-mongodb": "^1.21.0",
"php": "^8.1",
"psr/log": "^1.1.4|^2|^3"
},
"replace": {
"mongodb/builder": "*"
},
"require-dev": {
"doctrine/coding-standard": "^12.0",
"phpunit/phpunit": "^10.5.35",
"rector/rector": "^1.2",
"squizlabs/php_codesniffer": "^3.7",
"vimeo/psalm": "6.5.*"
},
"time": "2025-02-28T17:24:20+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"MongoDB\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Andreas Braun",
"email": "andreas.braun@mongodb.com"
},
{
"name": "Jeremy Mikola",
"email": "jmikola@gmail.com"
},
{
"name": "Jérôme Tamarelle",
"email": "jerome.tamarelle@mongodb.com"
}
],
"description": "MongoDB driver library",
"homepage": "https://jira.mongodb.org/browse/PHPLIB",
"keywords": [
"database",
"driver",
"mongodb",
"persistence"
],
"support": {
"issues": "https://github.com/mongodb/mongo-php-library/issues",
"source": "https://github.com/mongodb/mongo-php-library/tree/1.21.1"
},
"install-path": "../mongodb/mongodb"
},
{ {
"name": "mtdowling/jmespath.php", "name": "mtdowling/jmespath.php",
"version": "2.7.0", "version": "2.7.0",

19
vendor/composer/installed.php

@ -3,7 +3,7 @@
'name' => 'topthink/think', 'name' => 'topthink/think',
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '1192d0618a9dbdb678eb70e99b050efbe932cbcf', 'reference' => 'ba177235a471c2287f0d0ca76391e63ae146cc1f',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -235,6 +235,21 @@
'aliases' => array(), 'aliases' => array(),
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'mongodb/builder' => array(
'dev_requirement' => false,
'replaced' => array(
0 => '*',
),
),
'mongodb/mongodb' => array(
'pretty_version' => '1.21.1',
'version' => '1.21.1.0',
'reference' => '37bc8df3a67ddf8380704a5ba5dbd00e92ec1f6a',
'type' => 'library',
'install_path' => __DIR__ . '/../mongodb/mongodb',
'aliases' => array(),
'dev_requirement' => false,
),
'mtdowling/jmespath.php' => array( 'mtdowling/jmespath.php' => array(
'pretty_version' => '2.7.0', 'pretty_version' => '2.7.0',
'version' => '2.7.0.0', 'version' => '2.7.0.0',
@ -538,7 +553,7 @@
'topthink/think' => array( 'topthink/think' => array(
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => '1192d0618a9dbdb678eb70e99b050efbe932cbcf', 'reference' => 'ba177235a471c2287f0d0ca76391e63ae146cc1f',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),

202
vendor/mongodb/mongodb/LICENSE

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

65
vendor/mongodb/mongodb/composer.json

@ -0,0 +1,65 @@
{
"name": "mongodb/mongodb",
"description": "MongoDB driver library",
"keywords": ["database", "driver", "mongodb", "persistence"],
"homepage": "https://jira.mongodb.org/browse/PHPLIB",
"license": "Apache-2.0",
"authors": [
{ "name": "Andreas Braun", "email": "andreas.braun@mongodb.com" },
{ "name": "Jeremy Mikola", "email": "jmikola@gmail.com" },
{ "name": "Jérôme Tamarelle", "email": "jerome.tamarelle@mongodb.com" }
],
"require": {
"php": "^8.1",
"ext-mongodb": "^1.21.0",
"composer-runtime-api": "^2.0",
"psr/log": "^1.1.4|^2|^3"
},
"require-dev": {
"doctrine/coding-standard": "^12.0",
"phpunit/phpunit": "^10.5.35",
"rector/rector": "^1.2",
"squizlabs/php_codesniffer": "^3.7",
"vimeo/psalm": "6.5.*"
},
"replace": {
"mongodb/builder": "*"
},
"autoload": {
"psr-4": { "MongoDB\\": "src/" },
"files": [ "src/functions.php" ]
},
"autoload-dev": {
"psr-4": {
"MongoDB\\Tests\\": "tests/"
}
},
"scripts": {
"pre-install-cmd": "git submodule update --init",
"pre-update-cmd": "git submodule update --init",
"bench": "cd benchmark && composer update && vendor/bin/phpbench run --report=aggregate",
"checks": [
"@check:cs",
"@check:psalm",
"@check:rector"
],
"check:cs": "phpcs",
"check:psalm": "psalm",
"check:rector": "rector --ansi --dry-run",
"fix:cs": "phpcbf",
"fix:psalm:baseline": "psalm --set-baseline=psalm-baseline.xml",
"fix:rector": "rector process --ansi",
"test": "phpunit"
},
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
},
"sort-packages": true
}
}

85
vendor/mongodb/mongodb/sbom.json

@ -0,0 +1,85 @@
{
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:dc42a43b-4ace-4c42-9a6e-0b9e28fdd100",
"version": 1,
"metadata": {
"timestamp": "2024-05-08T09:51:01Z",
"tools": [
{
"name": "composer",
"version": "2.7.6"
},
{
"vendor": "cyclonedx",
"name": "cyclonedx-php-composer",
"version": "v5.2.0",
"externalReferences": [
{
"type": "distribution",
"url": "https://api.github.com/repos/CycloneDX/cyclonedx-php-composer/zipball/f3a3cdc1a9e34bf1d5748e4279a24569cbf31fed",
"comment": "dist reference: f3a3cdc1a9e34bf1d5748e4279a24569cbf31fed"
},
{
"type": "vcs",
"url": "https://github.com/CycloneDX/cyclonedx-php-composer.git",
"comment": "source reference: f3a3cdc1a9e34bf1d5748e4279a24569cbf31fed"
},
{
"type": "website",
"url": "https://github.com/CycloneDX/cyclonedx-php-composer/#readme",
"comment": "as detected from Composer manifest 'homepage'"
},
{
"type": "issue-tracker",
"url": "https://github.com/CycloneDX/cyclonedx-php-composer/issues",
"comment": "as detected from Composer manifest 'support.issues'"
},
{
"type": "vcs",
"url": "https://github.com/CycloneDX/cyclonedx-php-composer/",
"comment": "as detected from Composer manifest 'support.source'"
}
]
},
{
"vendor": "cyclonedx",
"name": "cyclonedx-library",
"version": "v3.3.1",
"externalReferences": [
{
"type": "distribution",
"url": "https://api.github.com/repos/CycloneDX/cyclonedx-php-library/zipball/cad0f92b36c85f36b3d3c11ff96002af5f20cd10",
"comment": "dist reference: cad0f92b36c85f36b3d3c11ff96002af5f20cd10"
},
{
"type": "vcs",
"url": "https://github.com/CycloneDX/cyclonedx-php-library.git",
"comment": "source reference: cad0f92b36c85f36b3d3c11ff96002af5f20cd10"
},
{
"type": "website",
"url": "https://github.com/CycloneDX/cyclonedx-php-library/#readme",
"comment": "as detected from Composer manifest 'homepage'"
},
{
"type": "documentation",
"url": "https://cyclonedx-php-library.readthedocs.io",
"comment": "as detected from Composer manifest 'support.docs'"
},
{
"type": "issue-tracker",
"url": "https://github.com/CycloneDX/cyclonedx-php-library/issues",
"comment": "as detected from Composer manifest 'support.issues'"
},
{
"type": "vcs",
"url": "https://github.com/CycloneDX/cyclonedx-php-library/",
"comment": "as detected from Composer manifest 'support.source'"
}
]
}
]
}
}

44
vendor/mongodb/mongodb/src/Builder/Accumulator.php

@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder;
use MongoDB\BSON\Document;
use MongoDB\BSON\Serializable;
use MongoDB\Builder\Type\Optional;
use MongoDB\Builder\Type\OutputWindow;
use MongoDB\Builder\Type\TimeUnit;
use MongoDB\Builder\Type\WindowInterface;
use stdClass;
/**
* Factories for Aggregation Pipeline Accumulator and Window Operators
*
* @see https://www.mongodb.com/docs/v3.4/reference/operator/aggregation-group/
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/
*/
final class Accumulator
{
use Accumulator\FactoryTrait;
/**
* @param Document|Serializable|WindowInterface|array<string, mixed>|stdClass $operator Window operator to use in the $setWindowFields stage.
* @param Optional|array{string|int,string|int} $documents A window where the lower and upper boundaries are specified relative to the position of the current document read from the collection.
* @param Optional|array{string|numeric,string|numeric} $range Arguments passed to the init function.
* @param Optional|non-empty-string $unit Specifies the units for time range window boundaries. If omitted, default numeric range window boundaries are used.
*/
public static function outputWindow(
Document|Serializable|WindowInterface|stdClass|array $operator,
Optional|array $documents = Optional::Undefined,
Optional|array $range = Optional::Undefined,
Optional|TimeUnit|string $unit = Optional::Undefined,
): OutputWindow {
return new OutputWindow($operator, $documents, $range, $unit);
}
private function __construct()
{
// This class cannot be instantiated
}
}

127
vendor/mongodb/mongodb/src/Builder/Accumulator/AccumulatorAccumulator.php

@ -0,0 +1,127 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Javascript;
use MongoDB\BSON\PackedArray;
use MongoDB\Builder\Expression\ResolvesToArray;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\Optional;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\BSONArray;
use function array_is_list;
use function is_array;
use function is_string;
use function str_starts_with;
/**
* Defines a custom accumulator function.
* New in MongoDB 4.4.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/
* @internal
*/
final class AccumulatorAccumulator implements AccumulatorInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$accumulator';
public const PROPERTIES = [
'init' => 'init',
'accumulate' => 'accumulate',
'accumulateArgs' => 'accumulateArgs',
'merge' => 'merge',
'lang' => 'lang',
'initArgs' => 'initArgs',
'finalize' => 'finalize',
];
/** @var Javascript|string $init Function used to initialize the state. The init function receives its arguments from the initArgs array expression. You can specify the function definition as either BSON type Code or String. */
public readonly Javascript|string $init;
/** @var Javascript|string $accumulate Function used to accumulate documents. The accumulate function receives its arguments from the current state and accumulateArgs array expression. The result of the accumulate function becomes the new state. You can specify the function definition as either BSON type Code or String. */
public readonly Javascript|string $accumulate;
/** @var BSONArray|PackedArray|ResolvesToArray|array|string $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. */
public readonly PackedArray|ResolvesToArray|BSONArray|array|string $accumulateArgs;
/** @var Javascript|string $merge Function used to merge two internal states. merge must be either a String or Code BSON type. merge returns the combined result of the two merged states. For information on when the merge function is called, see Merge Two States with $merge. */
public readonly Javascript|string $merge;
/** @var string $lang The language used in the $accumulator code. */
public readonly string $lang;
/** @var Optional|BSONArray|PackedArray|ResolvesToArray|array|string $initArgs Arguments passed to the init function. */
public readonly Optional|PackedArray|ResolvesToArray|BSONArray|array|string $initArgs;
/** @var Optional|Javascript|string $finalize Function used to update the result of the accumulation. */
public readonly Optional|Javascript|string $finalize;
/**
* @param Javascript|string $init Function used to initialize the state. The init function receives its arguments from the initArgs array expression. You can specify the function definition as either BSON type Code or String.
* @param Javascript|string $accumulate Function used to accumulate documents. The accumulate function receives its arguments from the current state and accumulateArgs array expression. The result of the accumulate function becomes the new state. You can specify the function definition as either BSON type Code or String.
* @param BSONArray|PackedArray|ResolvesToArray|array|string $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function.
* @param Javascript|string $merge Function used to merge two internal states. merge must be either a String or Code BSON type. merge returns the combined result of the two merged states. For information on when the merge function is called, see Merge Two States with $merge.
* @param string $lang The language used in the $accumulator code.
* @param Optional|BSONArray|PackedArray|ResolvesToArray|array|string $initArgs Arguments passed to the init function.
* @param Optional|Javascript|string $finalize Function used to update the result of the accumulation.
*/
public function __construct(
Javascript|string $init,
Javascript|string $accumulate,
PackedArray|ResolvesToArray|BSONArray|array|string $accumulateArgs,
Javascript|string $merge,
string $lang,
Optional|PackedArray|ResolvesToArray|BSONArray|array|string $initArgs = Optional::Undefined,
Optional|Javascript|string $finalize = Optional::Undefined,
) {
if (is_string($init)) {
$init = new Javascript($init);
}
$this->init = $init;
if (is_string($accumulate)) {
$accumulate = new Javascript($accumulate);
}
$this->accumulate = $accumulate;
if (is_string($accumulateArgs) && ! str_starts_with($accumulateArgs, '$')) {
throw new InvalidArgumentException('Argument $accumulateArgs can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
if (is_array($accumulateArgs) && ! array_is_list($accumulateArgs)) {
throw new InvalidArgumentException('Expected $accumulateArgs argument to be a list, got an associative array.');
}
$this->accumulateArgs = $accumulateArgs;
if (is_string($merge)) {
$merge = new Javascript($merge);
}
$this->merge = $merge;
$this->lang = $lang;
if (is_string($initArgs) && ! str_starts_with($initArgs, '$')) {
throw new InvalidArgumentException('Argument $initArgs can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
if (is_array($initArgs) && ! array_is_list($initArgs)) {
throw new InvalidArgumentException('Expected $initArgs argument to be a list, got an associative array.');
}
$this->initArgs = $initArgs;
if (is_string($finalize)) {
$finalize = new Javascript($finalize);
}
$this->finalize = $finalize;
}
}

44
vendor/mongodb/mongodb/src/Builder/Accumulator/AddToSetAccumulator.php

@ -0,0 +1,44 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use stdClass;
/**
* Returns an array of unique expression values for each group. Order of the array elements is undefined.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/
* @internal
*/
final class AddToSetAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$addToSet';
public const PROPERTIES = ['expression' => 'expression'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
) {
$this->expression = $expression;
}
}

50
vendor/mongodb/mongodb/src/Builder/Accumulator/AvgAccumulator.php

@ -0,0 +1,50 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns an average of numerical values. Ignores non-numeric values.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/
* @internal
*/
final class AvgAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$avg';
public const PROPERTIES = ['expression' => 'expression'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

52
vendor/mongodb/mongodb/src/Builder/Accumulator/BottomAccumulator.php

@ -0,0 +1,52 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Document;
use MongoDB\BSON\Serializable;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use stdClass;
/**
* Returns the bottom element within a group according to the specified sort order.
* New in MongoDB 5.2: Available in the $group and $setWindowFields stages.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottom/
* @internal
*/
final class BottomAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$bottom';
public const PROPERTIES = ['sortBy' => 'sortBy', 'output' => 'output'];
/** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */
public readonly Document|Serializable|stdClass|array $sortBy;
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output;
/**
* @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression.
*/
public function __construct(
Document|Serializable|stdClass|array $sortBy,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output,
) {
$this->sortBy = $sortBy;
$this->output = $output;
}
}

68
vendor/mongodb/mongodb/src/Builder/Accumulator/BottomNAccumulator.php

@ -0,0 +1,68 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Document;
use MongoDB\BSON\Serializable;
use MongoDB\BSON\Type;
use MongoDB\Builder\Expression\ResolvesToInt;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use stdClass;
use function is_string;
use function str_starts_with;
/**
* Returns an aggregation of the bottom n elements within a group, according to the specified sort order. If the group contains fewer than n elements, $bottomN returns all elements in the group.
* New in MongoDB 5.2.
* Available in the $group and $setWindowFields stages.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN/
* @internal
*/
final class BottomNAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$bottomN';
public const PROPERTIES = ['n' => 'n', 'sortBy' => 'sortBy', 'output' => 'output'];
/** @var ResolvesToInt|int|string $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. */
public readonly ResolvesToInt|int|string $n;
/** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */
public readonly Document|Serializable|stdClass|array $sortBy;
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output;
/**
* @param ResolvesToInt|int|string $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group.
* @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression.
*/
public function __construct(
ResolvesToInt|int|string $n,
Document|Serializable|stdClass|array $sortBy,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output,
) {
if (is_string($n) && ! str_starts_with($n, '$')) {
throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->n = $n;
$this->sortBy = $sortBy;
$this->output = $output;
}
}

32
vendor/mongodb/mongodb/src/Builder/Accumulator/CountAccumulator.php

@ -0,0 +1,32 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
/**
* Returns the number of documents in the group or window.
* Distinct from the $count pipeline stage.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/count-accumulator/
* @internal
*/
final class CountAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$count';
public function __construct()
{
}
}

60
vendor/mongodb/mongodb/src/Builder/Accumulator/CovariancePopAccumulator.php

@ -0,0 +1,60 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the population covariance of two numeric expressions.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/covariancePop/
* @internal
*/
final class CovariancePopAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Array;
public const NAME = '$covariancePop';
public const PROPERTIES = ['expression1' => 'expression1', 'expression2' => 'expression2'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression1;
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression2;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression1
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression2
*/
public function __construct(
Decimal128|Int64|ResolvesToNumber|float|int|string $expression1,
Decimal128|Int64|ResolvesToNumber|float|int|string $expression2,
) {
if (is_string($expression1) && ! str_starts_with($expression1, '$')) {
throw new InvalidArgumentException('Argument $expression1 can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression1 = $expression1;
if (is_string($expression2) && ! str_starts_with($expression2, '$')) {
throw new InvalidArgumentException('Argument $expression2 can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression2 = $expression2;
}
}

60
vendor/mongodb/mongodb/src/Builder/Accumulator/CovarianceSampAccumulator.php

@ -0,0 +1,60 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the sample covariance of two numeric expressions.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/covarianceSamp/
* @internal
*/
final class CovarianceSampAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Array;
public const NAME = '$covarianceSamp';
public const PROPERTIES = ['expression1' => 'expression1', 'expression2' => 'expression2'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression1;
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression2;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression1
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression2
*/
public function __construct(
Decimal128|Int64|ResolvesToNumber|float|int|string $expression1,
Decimal128|Int64|ResolvesToNumber|float|int|string $expression2,
) {
if (is_string($expression1) && ! str_starts_with($expression1, '$')) {
throw new InvalidArgumentException('Argument $expression1 can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression1 = $expression1;
if (is_string($expression2) && ! str_starts_with($expression2, '$')) {
throw new InvalidArgumentException('Argument $expression2 can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression2 = $expression2;
}
}

30
vendor/mongodb/mongodb/src/Builder/Accumulator/DenseRankAccumulator.php

@ -0,0 +1,30 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
/**
* Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition. There are no gaps in the ranks. Ties receive the same rank.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/denseRank/
* @internal
*/
final class DenseRankAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$denseRank';
public function __construct()
{
}
}

66
vendor/mongodb/mongodb/src/Builder/Accumulator/DerivativeAccumulator.php

@ -0,0 +1,66 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\BSON\UTCDateTime;
use MongoDB\Builder\Expression\ResolvesToDate;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Expression\ResolvesToString;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\Optional;
use MongoDB\Builder\Type\TimeUnit;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the average rate of change within the specified window.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/derivative/
* @internal
*/
final class DerivativeAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$derivative';
public const PROPERTIES = ['input' => 'input', 'unit' => 'unit'];
/** @var DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input */
public readonly DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input;
/**
* @var Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond".
* If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field.
*/
public readonly Optional|ResolvesToString|TimeUnit|string $unit;
/**
* @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input
* @param Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond".
* If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field.
*/
public function __construct(
DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input,
Optional|ResolvesToString|TimeUnit|string $unit = Optional::Undefined,
) {
if (is_string($input) && ! str_starts_with($input, '$')) {
throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->input = $input;
$this->unit = $unit;
}
}

30
vendor/mongodb/mongodb/src/Builder/Accumulator/DocumentNumberAccumulator.php

@ -0,0 +1,30 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
/**
* Returns the position of a document (known as the document number) in the $setWindowFields stage partition. Ties result in different adjacent document numbers.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/documentNumber/
* @internal
*/
final class DocumentNumberAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$documentNumber';
public function __construct()
{
}
}

73
vendor/mongodb/mongodb/src/Builder/Accumulator/ExpMovingAvgAccumulator.php

@ -0,0 +1,73 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\Optional;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the exponential moving average for the numeric expression.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/expMovingAvg/
* @internal
*/
final class ExpMovingAvgAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$expMovingAvg';
public const PROPERTIES = ['input' => 'input', 'N' => 'N', 'alpha' => 'alpha'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $input */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $input;
/**
* @var Optional|int $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight.
* You must specify either N or alpha. You cannot specify both.
* The N value is used in this formula to calculate the current result based on the expression value from the current document being read and the previous result of the calculation:
*/
public readonly Optional|int $N;
/**
* @var Optional|Int64|float|int $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation.
* You must specify either N or alpha. You cannot specify both.
*/
public readonly Optional|Int64|float|int $alpha;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $input
* @param Optional|int $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight.
* You must specify either N or alpha. You cannot specify both.
* The N value is used in this formula to calculate the current result based on the expression value from the current document being read and the previous result of the calculation:
* @param Optional|Int64|float|int $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation.
* You must specify either N or alpha. You cannot specify both.
*/
public function __construct(
Decimal128|Int64|ResolvesToNumber|float|int|string $input,
Optional|int $N = Optional::Undefined,
Optional|Int64|float|int $alpha = Optional::Undefined,
) {
if (is_string($input) && ! str_starts_with($input, '$')) {
throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->input = $input;
$this->N = $N;
$this->alpha = $alpha;
}
}

554
vendor/mongodb/mongodb/src/Builder/Accumulator/FactoryTrait.php

@ -0,0 +1,554 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Document;
use MongoDB\BSON\Int64;
use MongoDB\BSON\Javascript;
use MongoDB\BSON\PackedArray;
use MongoDB\BSON\Serializable;
use MongoDB\BSON\Type;
use MongoDB\BSON\UTCDateTime;
use MongoDB\Builder\Expression\ResolvesToArray;
use MongoDB\Builder\Expression\ResolvesToDate;
use MongoDB\Builder\Expression\ResolvesToInt;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Expression\ResolvesToObject;
use MongoDB\Builder\Expression\ResolvesToString;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\Optional;
use MongoDB\Builder\Type\TimeUnit;
use MongoDB\Model\BSONArray;
use stdClass;
/**
* @internal
*/
trait FactoryTrait
{
/**
* Defines a custom accumulator function.
* New in MongoDB 4.4.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/
* @param Javascript|string $init Function used to initialize the state. The init function receives its arguments from the initArgs array expression. You can specify the function definition as either BSON type Code or String.
* @param Javascript|string $accumulate Function used to accumulate documents. The accumulate function receives its arguments from the current state and accumulateArgs array expression. The result of the accumulate function becomes the new state. You can specify the function definition as either BSON type Code or String.
* @param BSONArray|PackedArray|ResolvesToArray|array|string $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function.
* @param Javascript|string $merge Function used to merge two internal states. merge must be either a String or Code BSON type. merge returns the combined result of the two merged states. For information on when the merge function is called, see Merge Two States with $merge.
* @param string $lang The language used in the $accumulator code.
* @param Optional|BSONArray|PackedArray|ResolvesToArray|array|string $initArgs Arguments passed to the init function.
* @param Optional|Javascript|string $finalize Function used to update the result of the accumulation.
*/
public static function accumulator(
Javascript|string $init,
Javascript|string $accumulate,
PackedArray|ResolvesToArray|BSONArray|array|string $accumulateArgs,
Javascript|string $merge,
string $lang,
Optional|PackedArray|ResolvesToArray|BSONArray|array|string $initArgs = Optional::Undefined,
Optional|Javascript|string $finalize = Optional::Undefined,
): AccumulatorAccumulator {
return new AccumulatorAccumulator($init, $accumulate, $accumulateArgs, $merge, $lang, $initArgs, $finalize);
}
/**
* Returns an array of unique expression values for each group. Order of the array elements is undefined.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public static function addToSet(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
): AddToSetAccumulator {
return new AddToSetAccumulator($expression);
}
/**
* Returns an average of numerical values. Ignores non-numeric values.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression
*/
public static function avg(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): AvgAccumulator
{
return new AvgAccumulator($expression);
}
/**
* Returns the bottom element within a group according to the specified sort order.
* New in MongoDB 5.2: Available in the $group and $setWindowFields stages.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottom/
* @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression.
*/
public static function bottom(
Document|Serializable|stdClass|array $sortBy,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output,
): BottomAccumulator {
return new BottomAccumulator($sortBy, $output);
}
/**
* Returns an aggregation of the bottom n elements within a group, according to the specified sort order. If the group contains fewer than n elements, $bottomN returns all elements in the group.
* New in MongoDB 5.2.
* Available in the $group and $setWindowFields stages.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN/
* @param ResolvesToInt|int|string $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group.
* @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression.
*/
public static function bottomN(
ResolvesToInt|int|string $n,
Document|Serializable|stdClass|array $sortBy,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output,
): BottomNAccumulator {
return new BottomNAccumulator($n, $sortBy, $output);
}
/**
* Returns the number of documents in the group or window.
* Distinct from the $count pipeline stage.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/count-accumulator/
*/
public static function count(): CountAccumulator
{
return new CountAccumulator();
}
/**
* Returns the population covariance of two numeric expressions.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/covariancePop/
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression1
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression2
*/
public static function covariancePop(
Decimal128|Int64|ResolvesToNumber|float|int|string $expression1,
Decimal128|Int64|ResolvesToNumber|float|int|string $expression2,
): CovariancePopAccumulator {
return new CovariancePopAccumulator($expression1, $expression2);
}
/**
* Returns the sample covariance of two numeric expressions.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/covarianceSamp/
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression1
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression2
*/
public static function covarianceSamp(
Decimal128|Int64|ResolvesToNumber|float|int|string $expression1,
Decimal128|Int64|ResolvesToNumber|float|int|string $expression2,
): CovarianceSampAccumulator {
return new CovarianceSampAccumulator($expression1, $expression2);
}
/**
* Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition. There are no gaps in the ranks. Ties receive the same rank.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/denseRank/
*/
public static function denseRank(): DenseRankAccumulator
{
return new DenseRankAccumulator();
}
/**
* Returns the average rate of change within the specified window.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/derivative/
* @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input
* @param Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond".
* If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field.
*/
public static function derivative(
DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input,
Optional|ResolvesToString|TimeUnit|string $unit = Optional::Undefined,
): DerivativeAccumulator {
return new DerivativeAccumulator($input, $unit);
}
/**
* Returns the position of a document (known as the document number) in the $setWindowFields stage partition. Ties result in different adjacent document numbers.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/documentNumber/
*/
public static function documentNumber(): DocumentNumberAccumulator
{
return new DocumentNumberAccumulator();
}
/**
* Returns the exponential moving average for the numeric expression.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/expMovingAvg/
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $input
* @param Optional|int $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight.
* You must specify either N or alpha. You cannot specify both.
* The N value is used in this formula to calculate the current result based on the expression value from the current document being read and the previous result of the calculation:
* @param Optional|Int64|float|int $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation.
* You must specify either N or alpha. You cannot specify both.
*/
public static function expMovingAvg(
Decimal128|Int64|ResolvesToNumber|float|int|string $input,
Optional|int $N = Optional::Undefined,
Optional|Int64|float|int $alpha = Optional::Undefined,
): ExpMovingAvgAccumulator {
return new ExpMovingAvgAccumulator($input, $N, $alpha);
}
/**
* Returns the result of an expression for the first document in a group or window.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public static function first(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
): FirstAccumulator {
return new FirstAccumulator($expression);
}
/**
* Returns an aggregation of the first n elements within a group.
* The elements returned are meaningful only if in a specified sort order.
* If the group contains fewer than n elements, $firstN returns all elements in the group.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input An expression that resolves to the array from which to return n elements.
* @param ResolvesToInt|int|string $n A positive integral expression that is either a constant or depends on the _id value for $group.
*/
public static function firstN(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input,
ResolvesToInt|int|string $n,
): FirstNAccumulator {
return new FirstNAccumulator($input, $n);
}
/**
* Returns the approximation of the area under a curve.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/integral/
* @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input
* @param Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond".
* If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field.
*/
public static function integral(
DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input,
Optional|ResolvesToString|TimeUnit|string $unit = Optional::Undefined,
): IntegralAccumulator {
return new IntegralAccumulator($input, $unit);
}
/**
* Returns the result of an expression for the last document in a group or window.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public static function last(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
): LastAccumulator {
return new LastAccumulator($expression);
}
/**
* Returns an aggregation of the last n elements within a group.
* The elements returned are meaningful only if in a specified sort order.
* If the group contains fewer than n elements, $lastN returns all elements in the group.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/
* @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements.
* @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns.
*/
public static function lastN(
PackedArray|ResolvesToArray|BSONArray|array|string $input,
ResolvesToInt|int|string $n,
): LastNAccumulator {
return new LastNAccumulator($input, $n);
}
/**
* Fills null and missing fields in a window using linear interpolation based on surrounding field values.
* Available in the $setWindowFields stage.
* New in MongoDB 5.3.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/linearFill/
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression
*/
public static function linearFill(
Decimal128|Int64|ResolvesToNumber|float|int|string $expression,
): LinearFillAccumulator {
return new LinearFillAccumulator($expression);
}
/**
* Last observation carried forward. Sets values for null and missing fields in a window to the last non-null value for the field.
* Available in the $setWindowFields stage.
* New in MongoDB 5.2.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/locf/
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public static function locf(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
): LocfAccumulator {
return new LocfAccumulator($expression);
}
/**
* Returns the maximum value that results from applying an expression to each document.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public static function max(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
): MaxAccumulator {
return new MaxAccumulator($expression);
}
/**
* Returns the n largest values in an array. Distinct from the $maxN accumulator.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN/
* @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements.
* @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns.
*/
public static function maxN(
PackedArray|ResolvesToArray|BSONArray|array|string $input,
ResolvesToInt|int|string $n,
): MaxNAccumulator {
return new MaxNAccumulator($input, $n);
}
/**
* Returns an approximation of the median, the 50th percentile, as a scalar value.
* New in MongoDB 7.0.
* This operator is available as an accumulator in these stages:
* $group
* $setWindowFields
* It is also available as an aggregation expression.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it.
* @param string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'.
*/
public static function median(
Decimal128|Int64|ResolvesToNumber|float|int|string $input,
string $method,
): MedianAccumulator {
return new MedianAccumulator($input, $method);
}
/**
* Combines multiple documents into a single document.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/
* @param Document|ResolvesToObject|Serializable|array|stdClass|string $document Any valid expression that resolves to a document.
*/
public static function mergeObjects(
Document|Serializable|ResolvesToObject|stdClass|array|string $document,
): MergeObjectsAccumulator {
return new MergeObjectsAccumulator($document);
}
/**
* Returns the minimum value that results from applying an expression to each document.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public static function min(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
): MinAccumulator {
return new MinAccumulator($expression);
}
/**
* Returns the n smallest values in an array. Distinct from the $minN accumulator.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN/
* @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements.
* @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns.
*/
public static function minN(
PackedArray|ResolvesToArray|BSONArray|array|string $input,
ResolvesToInt|int|string $n,
): MinNAccumulator {
return new MinNAccumulator($input, $n);
}
/**
* Returns an array of scalar values that correspond to specified percentile values.
* New in MongoDB 7.0.
*
* This operator is available as an accumulator in these stages:
* $group
*
* $setWindowFields
*
* It is also available as an aggregation expression.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it.
* @param BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive.
* $percentile returns results in the same order as the elements in p.
* @param string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'.
*/
public static function percentile(
Decimal128|Int64|ResolvesToNumber|float|int|string $input,
PackedArray|ResolvesToArray|BSONArray|array|string $p,
string $method,
): PercentileAccumulator {
return new PercentileAccumulator($input, $p, $method);
}
/**
* Returns an array of values that result from applying an expression to each document.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/push/
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public static function push(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
): PushAccumulator {
return new PushAccumulator($expression);
}
/**
* Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/rank/
*/
public static function rank(): RankAccumulator
{
return new RankAccumulator();
}
/**
* Returns the value from an expression applied to a document in a specified position relative to the current document in the $setWindowFields stage partition.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/shift/
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Specifies an expression to evaluate and return in the output.
* @param int $by Specifies an integer with a numeric document position relative to the current document in the output.
* For example:
* 1 specifies the document position after the current document.
* -1 specifies the document position before the current document.
* -2 specifies the document position that is two positions before the current document.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default Specifies an optional default expression to evaluate if the document position is outside of the implicit $setWindowFields stage window. The implicit window contains all the documents in the partition.
* The default expression must evaluate to a constant value.
* If you do not specify a default expression, $shift returns null for documents whose positions are outside of the implicit $setWindowFields stage window.
*/
public static function shift(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output,
int $by,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default,
): ShiftAccumulator {
return new ShiftAccumulator($output, $by, $default);
}
/**
* Calculates the population standard deviation of the input values. Use if the values encompass the entire population of data you want to represent and do not wish to generalize about a larger population. $stdDevPop ignores non-numeric values.
* If the values represent only a sample of a population of data from which to generalize about the population, use $stdDevSamp instead.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression
*/
public static function stdDevPop(
Decimal128|Int64|ResolvesToNumber|float|int|string $expression,
): StdDevPopAccumulator {
return new StdDevPopAccumulator($expression);
}
/**
* Calculates the sample standard deviation of the input values. Use if the values encompass a sample of a population of data from which to generalize about the population. $stdDevSamp ignores non-numeric values.
* If the values represent the entire population of data or you do not wish to generalize about a larger population, use $stdDevPop instead.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression
*/
public static function stdDevSamp(
Decimal128|Int64|ResolvesToNumber|float|int|string $expression,
): StdDevSampAccumulator {
return new StdDevSampAccumulator($expression);
}
/**
* Returns a sum of numerical values. Ignores non-numeric values.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression
*/
public static function sum(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): SumAccumulator
{
return new SumAccumulator($expression);
}
/**
* Returns the top element within a group according to the specified sort order.
* New in MongoDB 5.2.
*
* Available in the $group and $setWindowFields stages.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/top/
* @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression.
*/
public static function top(
Document|Serializable|stdClass|array $sortBy,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output,
): TopAccumulator {
return new TopAccumulator($sortBy, $output);
}
/**
* Returns an aggregation of the top n fields within a group, according to the specified sort order.
* New in MongoDB 5.2.
*
* Available in the $group and $setWindowFields stages.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN/
* @param ResolvesToInt|int|string $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group.
* @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression.
*/
public static function topN(
ResolvesToInt|int|string $n,
Document|Serializable|stdClass|array $sortBy,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output,
): TopNAccumulator {
return new TopNAccumulator($n, $sortBy, $output);
}
}

44
vendor/mongodb/mongodb/src/Builder/Accumulator/FirstAccumulator.php

@ -0,0 +1,44 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use stdClass;
/**
* Returns the result of an expression for the first document in a group or window.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/
* @internal
*/
final class FirstAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$first';
public const PROPERTIES = ['expression' => 'expression'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
) {
$this->expression = $expression;
}
}

60
vendor/mongodb/mongodb/src/Builder/Accumulator/FirstNAccumulator.php

@ -0,0 +1,60 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Expression\ResolvesToInt;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use stdClass;
use function is_string;
use function str_starts_with;
/**
* Returns an aggregation of the first n elements within a group.
* The elements returned are meaningful only if in a specified sort order.
* If the group contains fewer than n elements, $firstN returns all elements in the group.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/
* @internal
*/
final class FirstNAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$firstN';
public const PROPERTIES = ['input' => 'input', 'n' => 'n'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input An expression that resolves to the array from which to return n elements. */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input;
/** @var ResolvesToInt|int|string $n A positive integral expression that is either a constant or depends on the _id value for $group. */
public readonly ResolvesToInt|int|string $n;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input An expression that resolves to the array from which to return n elements.
* @param ResolvesToInt|int|string $n A positive integral expression that is either a constant or depends on the _id value for $group.
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input,
ResolvesToInt|int|string $n,
) {
$this->input = $input;
if (is_string($n) && ! str_starts_with($n, '$')) {
throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->n = $n;
}
}

66
vendor/mongodb/mongodb/src/Builder/Accumulator/IntegralAccumulator.php

@ -0,0 +1,66 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\BSON\UTCDateTime;
use MongoDB\Builder\Expression\ResolvesToDate;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Expression\ResolvesToString;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\Optional;
use MongoDB\Builder\Type\TimeUnit;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the approximation of the area under a curve.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/integral/
* @internal
*/
final class IntegralAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$integral';
public const PROPERTIES = ['input' => 'input', 'unit' => 'unit'];
/** @var DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input */
public readonly DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input;
/**
* @var Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond".
* If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field.
*/
public readonly Optional|ResolvesToString|TimeUnit|string $unit;
/**
* @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input
* @param Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond".
* If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field.
*/
public function __construct(
DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input,
Optional|ResolvesToString|TimeUnit|string $unit = Optional::Undefined,
) {
if (is_string($input) && ! str_starts_with($input, '$')) {
throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->input = $input;
$this->unit = $unit;
}
}

44
vendor/mongodb/mongodb/src/Builder/Accumulator/LastAccumulator.php

@ -0,0 +1,44 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use stdClass;
/**
* Returns the result of an expression for the last document in a group or window.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/
* @internal
*/
final class LastAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$last';
public const PROPERTIES = ['expression' => 'expression'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
) {
$this->expression = $expression;
}
}

69
vendor/mongodb/mongodb/src/Builder/Accumulator/LastNAccumulator.php

@ -0,0 +1,69 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\PackedArray;
use MongoDB\Builder\Expression\ResolvesToArray;
use MongoDB\Builder\Expression\ResolvesToInt;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\BSONArray;
use function array_is_list;
use function is_array;
use function is_string;
use function str_starts_with;
/**
* Returns an aggregation of the last n elements within a group.
* The elements returned are meaningful only if in a specified sort order.
* If the group contains fewer than n elements, $lastN returns all elements in the group.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/
* @internal
*/
final class LastNAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$lastN';
public const PROPERTIES = ['input' => 'input', 'n' => 'n'];
/** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */
public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input;
/** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */
public readonly ResolvesToInt|int|string $n;
/**
* @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements.
* @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns.
*/
public function __construct(
PackedArray|ResolvesToArray|BSONArray|array|string $input,
ResolvesToInt|int|string $n,
) {
if (is_string($input) && ! str_starts_with($input, '$')) {
throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
if (is_array($input) && ! array_is_list($input)) {
throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.');
}
$this->input = $input;
if (is_string($n) && ! str_starts_with($n, '$')) {
throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->n = $n;
}
}

50
vendor/mongodb/mongodb/src/Builder/Accumulator/LinearFillAccumulator.php

@ -0,0 +1,50 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Fills null and missing fields in a window using linear interpolation based on surrounding field values.
* Available in the $setWindowFields stage.
* New in MongoDB 5.3.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/linearFill/
* @internal
*/
final class LinearFillAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$linearFill';
public const PROPERTIES = ['expression' => 'expression'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

44
vendor/mongodb/mongodb/src/Builder/Accumulator/LocfAccumulator.php

@ -0,0 +1,44 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use stdClass;
/**
* Last observation carried forward. Sets values for null and missing fields in a window to the last non-null value for the field.
* Available in the $setWindowFields stage.
* New in MongoDB 5.2.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/locf/
* @internal
*/
final class LocfAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$locf';
public const PROPERTIES = ['expression' => 'expression'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
) {
$this->expression = $expression;
}
}

44
vendor/mongodb/mongodb/src/Builder/Accumulator/MaxAccumulator.php

@ -0,0 +1,44 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use stdClass;
/**
* Returns the maximum value that results from applying an expression to each document.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/
* @internal
*/
final class MaxAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$max';
public const PROPERTIES = ['expression' => 'expression'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
) {
$this->expression = $expression;
}
}

67
vendor/mongodb/mongodb/src/Builder/Accumulator/MaxNAccumulator.php

@ -0,0 +1,67 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\PackedArray;
use MongoDB\Builder\Expression\ResolvesToArray;
use MongoDB\Builder\Expression\ResolvesToInt;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\BSONArray;
use function array_is_list;
use function is_array;
use function is_string;
use function str_starts_with;
/**
* Returns the n largest values in an array. Distinct from the $maxN accumulator.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN/
* @internal
*/
final class MaxNAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$maxN';
public const PROPERTIES = ['input' => 'input', 'n' => 'n'];
/** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. */
public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input;
/** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */
public readonly ResolvesToInt|int|string $n;
/**
* @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements.
* @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns.
*/
public function __construct(
PackedArray|ResolvesToArray|BSONArray|array|string $input,
ResolvesToInt|int|string $n,
) {
if (is_string($input) && ! str_starts_with($input, '$')) {
throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
if (is_array($input) && ! array_is_list($input)) {
throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.');
}
$this->input = $input;
if (is_string($n) && ! str_starts_with($n, '$')) {
throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->n = $n;
}
}

59
vendor/mongodb/mongodb/src/Builder/Accumulator/MedianAccumulator.php

@ -0,0 +1,59 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns an approximation of the median, the 50th percentile, as a scalar value.
* New in MongoDB 7.0.
* This operator is available as an accumulator in these stages:
* $group
* $setWindowFields
* It is also available as an aggregation expression.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/
* @internal
*/
final class MedianAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$median';
public const PROPERTIES = ['input' => 'input', 'method' => 'method'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $input;
/** @var string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */
public readonly string $method;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it.
* @param string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'.
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $input, string $method)
{
if (is_string($input) && ! str_starts_with($input, '$')) {
throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->input = $input;
$this->method = $method;
}
}

49
vendor/mongodb/mongodb/src/Builder/Accumulator/MergeObjectsAccumulator.php

@ -0,0 +1,49 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Document;
use MongoDB\BSON\Serializable;
use MongoDB\Builder\Expression\ResolvesToObject;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use stdClass;
use function is_string;
use function str_starts_with;
/**
* Combines multiple documents into a single document.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/
* @internal
*/
final class MergeObjectsAccumulator implements AccumulatorInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$mergeObjects';
public const PROPERTIES = ['document' => 'document'];
/** @var Document|ResolvesToObject|Serializable|array|stdClass|string $document Any valid expression that resolves to a document. */
public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $document;
/**
* @param Document|ResolvesToObject|Serializable|array|stdClass|string $document Any valid expression that resolves to a document.
*/
public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string $document)
{
if (is_string($document) && ! str_starts_with($document, '$')) {
throw new InvalidArgumentException('Argument $document can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->document = $document;
}
}

44
vendor/mongodb/mongodb/src/Builder/Accumulator/MinAccumulator.php

@ -0,0 +1,44 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use stdClass;
/**
* Returns the minimum value that results from applying an expression to each document.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/
* @internal
*/
final class MinAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$min';
public const PROPERTIES = ['expression' => 'expression'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
) {
$this->expression = $expression;
}
}

67
vendor/mongodb/mongodb/src/Builder/Accumulator/MinNAccumulator.php

@ -0,0 +1,67 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\PackedArray;
use MongoDB\Builder\Expression\ResolvesToArray;
use MongoDB\Builder\Expression\ResolvesToInt;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\BSONArray;
use function array_is_list;
use function is_array;
use function is_string;
use function str_starts_with;
/**
* Returns the n smallest values in an array. Distinct from the $minN accumulator.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN/
* @internal
*/
final class MinNAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$minN';
public const PROPERTIES = ['input' => 'input', 'n' => 'n'];
/** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. */
public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input;
/** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */
public readonly ResolvesToInt|int|string $n;
/**
* @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements.
* @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns.
*/
public function __construct(
PackedArray|ResolvesToArray|BSONArray|array|string $input,
ResolvesToInt|int|string $n,
) {
if (is_string($input) && ! str_starts_with($input, '$')) {
throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
if (is_array($input) && ! array_is_list($input)) {
throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.');
}
$this->input = $input;
if (is_string($n) && ! str_starts_with($n, '$')) {
throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->n = $n;
}
}

87
vendor/mongodb/mongodb/src/Builder/Accumulator/PercentileAccumulator.php

@ -0,0 +1,87 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\BSON\PackedArray;
use MongoDB\Builder\Expression\ResolvesToArray;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\BSONArray;
use function array_is_list;
use function is_array;
use function is_string;
use function str_starts_with;
/**
* Returns an array of scalar values that correspond to specified percentile values.
* New in MongoDB 7.0.
*
* This operator is available as an accumulator in these stages:
* $group
*
* $setWindowFields
*
* It is also available as an aggregation expression.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/
* @internal
*/
final class PercentileAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$percentile';
public const PROPERTIES = ['input' => 'input', 'p' => 'p', 'method' => 'method'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $input;
/**
* @var BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive.
* $percentile returns results in the same order as the elements in p.
*/
public readonly PackedArray|ResolvesToArray|BSONArray|array|string $p;
/** @var string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */
public readonly string $method;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it.
* @param BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive.
* $percentile returns results in the same order as the elements in p.
* @param string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'.
*/
public function __construct(
Decimal128|Int64|ResolvesToNumber|float|int|string $input,
PackedArray|ResolvesToArray|BSONArray|array|string $p,
string $method,
) {
if (is_string($input) && ! str_starts_with($input, '$')) {
throw new InvalidArgumentException('Argument $input can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->input = $input;
if (is_string($p) && ! str_starts_with($p, '$')) {
throw new InvalidArgumentException('Argument $p can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
if (is_array($p) && ! array_is_list($p)) {
throw new InvalidArgumentException('Expected $p argument to be a list, got an associative array.');
}
$this->p = $p;
$this->method = $method;
}
}

44
vendor/mongodb/mongodb/src/Builder/Accumulator/PushAccumulator.php

@ -0,0 +1,44 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use stdClass;
/**
* Returns an array of values that result from applying an expression to each document.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/push/
* @internal
*/
final class PushAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$push';
public const PROPERTIES = ['expression' => 'expression'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression,
) {
$this->expression = $expression;
}
}

30
vendor/mongodb/mongodb/src/Builder/Accumulator/RankAccumulator.php

@ -0,0 +1,30 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
/**
* Returns the document position (known as the rank) relative to other documents in the $setWindowFields stage partition.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/rank/
* @internal
*/
final class RankAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$rank';
public function __construct()
{
}
}

71
vendor/mongodb/mongodb/src/Builder/Accumulator/ShiftAccumulator.php

@ -0,0 +1,71 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use stdClass;
/**
* Returns the value from an expression applied to a document in a specified position relative to the current document in the $setWindowFields stage partition.
* New in MongoDB 5.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/shift/
* @internal
*/
final class ShiftAccumulator implements WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$shift';
public const PROPERTIES = ['output' => 'output', 'by' => 'by', 'default' => 'default'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Specifies an expression to evaluate and return in the output. */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output;
/**
* @var int $by Specifies an integer with a numeric document position relative to the current document in the output.
* For example:
* 1 specifies the document position after the current document.
* -1 specifies the document position before the current document.
* -2 specifies the document position that is two positions before the current document.
*/
public readonly int $by;
/**
* @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default Specifies an optional default expression to evaluate if the document position is outside of the implicit $setWindowFields stage window. The implicit window contains all the documents in the partition.
* The default expression must evaluate to a constant value.
* If you do not specify a default expression, $shift returns null for documents whose positions are outside of the implicit $setWindowFields stage window.
*/
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Specifies an expression to evaluate and return in the output.
* @param int $by Specifies an integer with a numeric document position relative to the current document in the output.
* For example:
* 1 specifies the document position after the current document.
* -1 specifies the document position before the current document.
* -2 specifies the document position that is two positions before the current document.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default Specifies an optional default expression to evaluate if the document position is outside of the implicit $setWindowFields stage window. The implicit window contains all the documents in the partition.
* The default expression must evaluate to a constant value.
* If you do not specify a default expression, $shift returns null for documents whose positions are outside of the implicit $setWindowFields stage window.
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output,
int $by,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default,
) {
$this->output = $output;
$this->by = $by;
$this->default = $default;
}
}

51
vendor/mongodb/mongodb/src/Builder/Accumulator/StdDevPopAccumulator.php

@ -0,0 +1,51 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Calculates the population standard deviation of the input values. Use if the values encompass the entire population of data you want to represent and do not wish to generalize about a larger population. $stdDevPop ignores non-numeric values.
* If the values represent only a sample of a population of data from which to generalize about the population, use $stdDevSamp instead.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/
* @internal
*/
final class StdDevPopAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$stdDevPop';
public const PROPERTIES = ['expression' => 'expression'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

51
vendor/mongodb/mongodb/src/Builder/Accumulator/StdDevSampAccumulator.php

@ -0,0 +1,51 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Calculates the sample standard deviation of the input values. Use if the values encompass a sample of a population of data from which to generalize about the population. $stdDevSamp ignores non-numeric values.
* If the values represent the entire population of data or you do not wish to generalize about a larger population, use $stdDevPop instead.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/
* @internal
*/
final class StdDevSampAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$stdDevSamp';
public const PROPERTIES = ['expression' => 'expression'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

50
vendor/mongodb/mongodb/src/Builder/Accumulator/SumAccumulator.php

@ -0,0 +1,50 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Expression\ResolvesToNumber;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns a sum of numerical values. Ignores non-numeric values.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/
* @internal
*/
final class SumAccumulator implements AccumulatorInterface, WindowInterface, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$sum';
public const PROPERTIES = ['expression' => 'expression'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

53
vendor/mongodb/mongodb/src/Builder/Accumulator/TopAccumulator.php

@ -0,0 +1,53 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Document;
use MongoDB\BSON\Serializable;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use stdClass;
/**
* Returns the top element within a group according to the specified sort order.
* New in MongoDB 5.2.
*
* Available in the $group and $setWindowFields stages.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/top/
* @internal
*/
final class TopAccumulator implements AccumulatorInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$top';
public const PROPERTIES = ['sortBy' => 'sortBy', 'output' => 'output'];
/** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */
public readonly Document|Serializable|stdClass|array $sortBy;
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output;
/**
* @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression.
*/
public function __construct(
Document|Serializable|stdClass|array $sortBy,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output,
) {
$this->sortBy = $sortBy;
$this->output = $output;
}
}

68
vendor/mongodb/mongodb/src/Builder/Accumulator/TopNAccumulator.php

@ -0,0 +1,68 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Accumulator;
use DateTimeInterface;
use MongoDB\BSON\Document;
use MongoDB\BSON\Serializable;
use MongoDB\BSON\Type;
use MongoDB\Builder\Expression\ResolvesToInt;
use MongoDB\Builder\Type\AccumulatorInterface;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use stdClass;
use function is_string;
use function str_starts_with;
/**
* Returns an aggregation of the top n fields within a group, according to the specified sort order.
* New in MongoDB 5.2.
*
* Available in the $group and $setWindowFields stages.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN/
* @internal
*/
final class TopNAccumulator implements AccumulatorInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$topN';
public const PROPERTIES = ['n' => 'n', 'sortBy' => 'sortBy', 'output' => 'output'];
/** @var ResolvesToInt|int|string $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. */
public readonly ResolvesToInt|int|string $n;
/** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */
public readonly Document|Serializable|stdClass|array $sortBy;
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output;
/**
* @param ResolvesToInt|int|string $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group.
* @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression.
*/
public function __construct(
ResolvesToInt|int|string $n,
Document|Serializable|stdClass|array $sortBy,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output,
) {
if (is_string($n) && ! str_starts_with($n, '$')) {
throw new InvalidArgumentException('Argument $n can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->n = $n;
$this->sortBy = $sortBy;
$this->output = $output;
}
}

109
vendor/mongodb/mongodb/src/Builder/BuilderEncoder.php

@ -0,0 +1,109 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Encoder\CombinedFieldQueryEncoder;
use MongoDB\Builder\Encoder\DateTimeEncoder;
use MongoDB\Builder\Encoder\DictionaryEncoder;
use MongoDB\Builder\Encoder\FieldPathEncoder;
use MongoDB\Builder\Encoder\OperatorEncoder;
use MongoDB\Builder\Encoder\OutputWindowEncoder;
use MongoDB\Builder\Encoder\PipelineEncoder;
use MongoDB\Builder\Encoder\QueryEncoder;
use MongoDB\Builder\Encoder\VariableEncoder;
use MongoDB\Builder\Expression\Variable;
use MongoDB\Builder\Type\CombinedFieldQuery;
use MongoDB\Builder\Type\DictionaryInterface;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\FieldPathInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\OutputWindow;
use MongoDB\Builder\Type\QueryInterface;
use MongoDB\Builder\Type\QueryObject;
use MongoDB\Builder\Type\StageInterface;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Codec\Encoder;
use MongoDB\Exception\UnsupportedValueException;
use stdClass;
use WeakReference;
use function array_key_exists;
use function is_object;
/** @template-implements Encoder<Type|stdClass|array|string|int, Pipeline|StageInterface|ExpressionInterface|QueryInterface> */
final class BuilderEncoder implements Encoder
{
/** @template-use EncodeIfSupported<Type|stdClass|array|string|int, Pipeline|StageInterface|ExpressionInterface|QueryInterface> */
use EncodeIfSupported;
/** @var array<class-string, Encoder> */
private array $encoders;
/** @var array<class-string, Encoder|null> */
private array $cachedEncoders = [];
/** @param array<class-string, Encoder> $encoders */
public function __construct(array $encoders = [])
{
$self = WeakReference::create($this);
$this->encoders = $encoders + [
Pipeline::class => new PipelineEncoder($self),
Variable::class => new VariableEncoder(),
DictionaryInterface::class => new DictionaryEncoder(),
FieldPathInterface::class => new FieldPathEncoder(),
CombinedFieldQuery::class => new CombinedFieldQueryEncoder($self),
QueryObject::class => new QueryEncoder($self),
OutputWindow::class => new OutputWindowEncoder($self),
OperatorInterface::class => new OperatorEncoder($self),
DateTimeInterface::class => new DateTimeEncoder(),
];
}
/** @psalm-assert-if-true object $value */
public function canEncode(mixed $value): bool
{
if (! is_object($value)) {
return false;
}
return (bool) $this->getEncoderFor($value)?->canEncode($value);
}
public function encode(mixed $value): Type|stdClass|array|string|int
{
$encoder = $this->getEncoderFor($value);
if (! $encoder?->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}
return $encoder->encode($value);
}
private function getEncoderFor(object $value): Encoder|null
{
$valueClass = $value::class;
if (array_key_exists($valueClass, $this->cachedEncoders)) {
return $this->cachedEncoders[$valueClass];
}
// First attempt: match class name exactly
if (isset($this->encoders[$valueClass])) {
return $this->cachedEncoders[$valueClass] = $this->encoders[$valueClass];
}
// Second attempt: catch child classes
foreach ($this->encoders as $className => $encoder) {
if ($value instanceof $className) {
return $this->cachedEncoders[$valueClass] = $encoder;
}
}
return $this->cachedEncoders[$valueClass] = null;
}
}

57
vendor/mongodb/mongodb/src/Builder/Encoder/CombinedFieldQueryEncoder.php

@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder\Encoder;
use LogicException;
use MongoDB\Builder\Type\CombinedFieldQuery;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Codec\Encoder;
use MongoDB\Exception\UnsupportedValueException;
use stdClass;
use function get_debug_type;
use function get_object_vars;
use function is_array;
use function is_object;
use function sprintf;
/**
* @template-implements Encoder<stdClass, CombinedFieldQuery>
* @internal
*/
final class CombinedFieldQueryEncoder implements Encoder
{
/** @template-use EncodeIfSupported<stdClass, CombinedFieldQuery> */
use EncodeIfSupported;
use RecursiveEncode;
public function canEncode(mixed $value): bool
{
return $value instanceof CombinedFieldQuery;
}
public function encode(mixed $value): stdClass
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}
$result = new stdClass();
foreach ($value->fieldQueries as $filter) {
$filter = $this->recursiveEncode($filter);
if (is_object($filter)) {
$filter = get_object_vars($filter);
} elseif (! is_array($filter)) {
throw new LogicException(sprintf('Query filters must an array or an object. Got "%s"', get_debug_type($filter)));
}
foreach ($filter as $key => $filterValue) {
$result->{$key} = $filterValue;
}
}
return $result;
}
}

36
vendor/mongodb/mongodb/src/Builder/Encoder/DateTimeEncoder.php

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder\Encoder;
use DateTimeInterface;
use MongoDB\BSON\UTCDateTime;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Codec\Encoder;
use MongoDB\Exception\UnsupportedValueException;
/**
* @template-implements Encoder<UTCDateTime, DateTimeInterface>
* @internal
*/
final class DateTimeEncoder implements Encoder
{
/** @template-use EncodeIfSupported<UTCDateTime, DateTimeInterface> */
use EncodeIfSupported;
/** @psalm-assert-if-true DateTimeInterface $value */
public function canEncode(mixed $value): bool
{
return $value instanceof DateTimeInterface;
}
public function encode(mixed $value): UTCDateTime
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}
return new UTCDateTime($value);
}
}

35
vendor/mongodb/mongodb/src/Builder/Encoder/DictionaryEncoder.php

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder\Encoder;
use MongoDB\Builder\Type\DictionaryInterface;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Codec\Encoder;
use MongoDB\Exception\UnsupportedValueException;
use stdClass;
/**
* @template-implements Encoder<string|int|array|stdClass, DictionaryInterface>
* @internal
*/
final class DictionaryEncoder implements Encoder
{
/** @template-use EncodeIfSupported<string|int|array|stdClass, DictionaryInterface> */
use EncodeIfSupported;
public function canEncode(mixed $value): bool
{
return $value instanceof DictionaryInterface;
}
public function encode(mixed $value): string|int|array|stdClass
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}
return $value->getValue();
}
}

34
vendor/mongodb/mongodb/src/Builder/Encoder/FieldPathEncoder.php

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder\Encoder;
use MongoDB\Builder\Type\FieldPathInterface;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Codec\Encoder;
use MongoDB\Exception\UnsupportedValueException;
/**
* @template-implements Encoder<string, FieldPathInterface>
* @internal
*/
final class FieldPathEncoder implements Encoder
{
/** @template-use EncodeIfSupported<string, FieldPathInterface> */
use EncodeIfSupported;
public function canEncode(mixed $value): bool
{
return $value instanceof FieldPathInterface;
}
public function encode(mixed $value): string
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}
return '$' . $value->name;
}
}

126
vendor/mongodb/mongodb/src/Builder/Encoder/OperatorEncoder.php

@ -0,0 +1,126 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder\Encoder;
use LogicException;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\Optional;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Codec\Encoder;
use MongoDB\Exception\UnsupportedValueException;
use stdClass;
use function assert;
use function is_string;
use function sprintf;
/**
* @template-implements Encoder<stdClass, OperatorInterface>
* @internal
*/
final class OperatorEncoder implements Encoder
{
/** @template-use EncodeIfSupported<stdClass, OperatorInterface> */
use EncodeIfSupported;
use RecursiveEncode;
public function canEncode(mixed $value): bool
{
return $value instanceof OperatorInterface;
}
public function encode(mixed $value): stdClass
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}
return match ($value::ENCODE) {
Encode::Single => $this->encodeAsSingle($value),
Encode::Array => $this->encodeAsArray($value),
Encode::Object => $this->encodeAsObject($value),
default => throw new LogicException(sprintf('Class "%s" does not have a valid ENCODE constant.', $value::class)),
};
}
/**
* Encode the value as an array of properties, in the order they are defined in the class.
*/
private function encodeAsArray(OperatorInterface $value): stdClass
{
$result = [];
foreach ($value::PROPERTIES as $prop => $name) {
$val = $value->$prop;
// Skip optional arguments. For example, the $slice expression operator has an optional <position> argument
// in the middle of the array.
if ($val === Optional::Undefined) {
continue;
}
$result[] = $this->recursiveEncode($val);
}
return $this->wrap($value, $result);
}
/**
* Encode the value as an object with properties. Property names are
* mapped by the PROPERTIES constant.
*/
private function encodeAsObject(OperatorInterface $value): stdClass
{
$result = new stdClass();
foreach ($value::PROPERTIES as $prop => $name) {
$val = $value->$prop;
// Skip optional arguments. If they have a default value, it is resolved by the server.
if ($val === Optional::Undefined) {
continue;
}
// The name is null for arguments with "mergeObject: true" in the YAML file,
// the value properties are merged into the parent object.
if ($name === null) {
$val = $this->recursiveEncode($val);
foreach ($val as $k => $v) {
$result->{$k} = $v;
}
} else {
$result->{$name} = $this->recursiveEncode($val);
}
}
if ($value::NAME === null) {
return $result;
}
return $this->wrap($value, $result);
}
/**
* Get the unique property of the operator as value
*/
private function encodeAsSingle(OperatorInterface $value): stdClass
{
foreach ($value::PROPERTIES as $prop => $name) {
$result = $this->recursiveEncode($value->$prop);
return $this->wrap($value, $result);
}
throw new LogicException(sprintf('Class "%s" does not have a single property.', $value::class));
}
private function wrap(OperatorInterface $value, mixed $result): stdClass
{
assert(is_string($value::NAME));
$object = new stdClass();
$object->{$value::NAME} = $result;
return $object;
}
}

65
vendor/mongodb/mongodb/src/Builder/Encoder/OutputWindowEncoder.php

@ -0,0 +1,65 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder\Encoder;
use LogicException;
use MongoDB\Builder\Type\Optional;
use MongoDB\Builder\Type\OutputWindow;
use MongoDB\Builder\Type\WindowInterface;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Codec\Encoder;
use MongoDB\Exception\UnsupportedValueException;
use stdClass;
use function array_key_first;
use function get_debug_type;
use function MongoDB\is_first_key_operator;
use function sprintf;
/**
* @template-implements Encoder<stdClass, OutputWindow>
* @internal
*/
final class OutputWindowEncoder implements Encoder
{
/** @template-use EncodeIfSupported<stdClass, OutputWindow> */
use EncodeIfSupported;
use RecursiveEncode;
public function canEncode(mixed $value): bool
{
return $value instanceof OutputWindow;
}
public function encode(mixed $value): stdClass
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}
$result = $this->recursiveEncode($value->operator);
// Transform the result into an stdClass if a document is provided
if (! $value->operator instanceof WindowInterface) {
if (! is_first_key_operator($result)) {
$firstKey = array_key_first((array) $result);
throw new LogicException(sprintf('Expected OutputWindow::$operator to be an operator. Got "%s"', $firstKey ?? 'null'));
}
$result = (object) $result;
}
if (! $result instanceof stdClass) {
throw new LogicException(sprintf('Expected OutputWindow::$operator to be an stdClass, array or WindowInterface. Got "%s"', get_debug_type($result)));
}
if ($value->window !== Optional::Undefined) {
$result->window = $this->recursiveEncode($value->window);
}
return $result;
}
}

42
vendor/mongodb/mongodb/src/Builder/Encoder/PipelineEncoder.php

@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder\Encoder;
use MongoDB\Builder\Pipeline;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Codec\Encoder;
use MongoDB\Exception\UnsupportedValueException;
/**
* @template-implements Encoder<list<mixed>, Pipeline>
* @internal
*/
final class PipelineEncoder implements Encoder
{
/** @template-use EncodeIfSupported<list<mixed>, Pipeline> */
use EncodeIfSupported;
use RecursiveEncode;
/** @psalm-assert-if-true Pipeline $value */
public function canEncode(mixed $value): bool
{
return $value instanceof Pipeline;
}
/** @return list<mixed> */
public function encode(mixed $value): array
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}
$encoded = [];
foreach ($value->getIterator() as $stage) {
$encoded[] = $this->recursiveEncode($stage);
}
return $encoded;
}
}

62
vendor/mongodb/mongodb/src/Builder/Encoder/QueryEncoder.php

@ -0,0 +1,62 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder\Encoder;
use LogicException;
use MongoDB\Builder\Type\QueryInterface;
use MongoDB\Builder\Type\QueryObject;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Codec\Encoder;
use MongoDB\Exception\UnsupportedValueException;
use stdClass;
use function get_object_vars;
use function property_exists;
use function sprintf;
/**
* @template-implements Encoder<stdClass, QueryObject>
* @internal
*/
final class QueryEncoder implements Encoder
{
/** @template-use EncodeIfSupported<stdClass, QueryObject> */
use EncodeIfSupported;
use RecursiveEncode;
public function canEncode(mixed $value): bool
{
return $value instanceof QueryObject;
}
public function encode(mixed $value): stdClass
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}
$result = new stdClass();
foreach ($value->queries as $key => $value) {
if ($value instanceof QueryInterface) {
// The sub-objects is merged into the main object, replacing duplicate keys
foreach (get_object_vars($this->recursiveEncode($value)) as $subKey => $subValue) {
if (property_exists($result, $subKey)) {
throw new LogicException(sprintf('Duplicate key "%s" in query object', $subKey));
}
$result->{$subKey} = $subValue;
}
} else {
if (property_exists($result, (string) $key)) {
throw new LogicException(sprintf('Duplicate key "%s" in query object', $key));
}
$result->{$key} = $this->recursiveEncode($value);
}
}
return $result;
}
}

59
vendor/mongodb/mongodb/src/Builder/Encoder/RecursiveEncode.php

@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder\Encoder;
use MongoDB\Codec\Encoder;
use stdClass;
use WeakReference;
use function get_object_vars;
use function is_array;
/** @internal */
trait RecursiveEncode
{
/** @param WeakReference<Encoder> $encoder */
final public function __construct(private readonly WeakReference $encoder)
{
}
/**
* Nested arrays and objects must be encoded recursively.
*
* @psalm-template T
* @psalm-param T $value
*
* @psalm-return (T is stdClass ? stdClass : (T is array ? array : mixed))
*
* @template T
*/
private function recursiveEncode(mixed $value): mixed
{
if (is_array($value)) {
foreach ($value as $key => $val) {
$value[$key] = $this->recursiveEncode($val);
}
return $value;
}
if ($value instanceof stdClass) {
foreach (get_object_vars($value) as $key => $val) {
$value->{$key} = $this->recursiveEncode($val);
}
return $value;
}
/**
* If the BuilderEncoder instance is removed from the memory, the
* instances of the classes using this trait will be removed as well.
* Therefore, the weak reference will never return null.
*
* @psalm-suppress PossiblyNullReference
*/
return $this->encoder->get()->encodeIfSupported($value);
}
}

35
vendor/mongodb/mongodb/src/Builder/Encoder/VariableEncoder.php

@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder\Encoder;
use MongoDB\Builder\Expression\Variable;
use MongoDB\Codec\EncodeIfSupported;
use MongoDB\Codec\Encoder;
use MongoDB\Exception\UnsupportedValueException;
/**
* @template-implements Encoder<string, Variable>
* @internal
*/
final class VariableEncoder implements Encoder
{
/** @template-use EncodeIfSupported<string, Variable> */
use EncodeIfSupported;
public function canEncode(mixed $value): bool
{
return $value instanceof Variable;
}
public function encode(mixed $value): string
{
if (! $this->canEncode($value)) {
throw UnsupportedValueException::invalidEncodableValue($value);
}
// TODO: needs method because interfaces can't have properties
return '$$' . $value->name;
}
}

21
vendor/mongodb/mongodb/src/Builder/Expression.php

@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace MongoDB\Builder;
/**
* Factories for Aggregation Pipeline Expression Operators
*
* @see https://docs.mongodb.com/manual/reference/operator/aggregation/
*/
final class Expression
{
use Expression\ExpressionFactoryTrait;
use Expression\FactoryTrait;
private function __construct()
{
// This class cannot be instantiated
}
}

46
vendor/mongodb/mongodb/src/Builder/Expression/AbsOperator.php

@ -0,0 +1,46 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the absolute value of a number.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/abs/
* @internal
*/
final class AbsOperator implements ResolvesToNumber, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$abs';
public const PROPERTIES = ['value' => 'value'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $value */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $value;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $value
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $value)
{
if (is_string($value) && ! str_starts_with($value, '$')) {
throw new InvalidArgumentException('Argument $value can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->value = $value;
}
}

52
vendor/mongodb/mongodb/src/Builder/Expression/AcosOperator.php

@ -0,0 +1,52 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the inverse cosine (arc cosine) of a value in radians.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/acos/
* @internal
*/
final class AcosOperator implements ResolvesToDouble, ResolvesToDecimal, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$acos';
public const PROPERTIES = ['expression' => 'expression'];
/**
* @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1.
* $acos returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $acos returns values as a double. $acos can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1.
* $acos returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $acos returns values as a double. $acos can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

52
vendor/mongodb/mongodb/src/Builder/Expression/AcoshOperator.php

@ -0,0 +1,52 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the inverse hyperbolic cosine (hyperbolic arc cosine) of a value in radians.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/acosh/
* @internal
*/
final class AcoshOperator implements ResolvesToDouble, ResolvesToDecimal, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$acosh';
public const PROPERTIES = ['expression' => 'expression'];
/**
* @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity.
* $acosh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $acosh returns values as a double. $acosh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity.
* $acosh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $acosh returns values as a double. $acosh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

53
vendor/mongodb/mongodb/src/Builder/Expression/AddOperator.php

@ -0,0 +1,53 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use DateTimeInterface;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\BSON\UTCDateTime;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function array_is_list;
/**
* Adds numbers to return the sum, or adds numbers and a date to return a new date. If adding numbers and a date, treats the numbers as milliseconds. Accepts any number of argument expressions, but at most, one expression can resolve to a date.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/add/
* @internal
*/
final class AddOperator implements ResolvesToInt, ResolvesToLong, ResolvesToDouble, ResolvesToDecimal, ResolvesToDate, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$add';
public const PROPERTIES = ['expression' => 'expression'];
/** @var list<DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string> $expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. */
public readonly array $expression;
/**
* @param DateTimeInterface|Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string ...$expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date.
* @no-named-arguments
*/
public function __construct(
DateTimeInterface|Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string ...$expression,
) {
if (\count($expression) < 1) {
throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression)));
}
if (! array_is_list($expression)) {
throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported');
}
$this->expression = $expression;
}
}

52
vendor/mongodb/mongodb/src/Builder/Expression/AllElementsTrueOperator.php

@ -0,0 +1,52 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\PackedArray;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\BSONArray;
use function array_is_list;
use function is_array;
use function is_string;
use function str_starts_with;
/**
* Returns true if no element of a set evaluates to false, otherwise, returns false. Accepts a single argument expression.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/allElementsTrue/
* @internal
*/
final class AllElementsTrueOperator implements ResolvesToBool, OperatorInterface
{
public const ENCODE = Encode::Array;
public const NAME = '$allElementsTrue';
public const PROPERTIES = ['expression' => 'expression'];
/** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression */
public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression;
/**
* @param BSONArray|PackedArray|ResolvesToArray|array|string $expression
*/
public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
if (is_array($expression) && ! array_is_list($expression)) {
throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.');
}
$this->expression = $expression;
}
}

55
vendor/mongodb/mongodb/src/Builder/Expression/AndOperator.php

@ -0,0 +1,55 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use DateTimeInterface;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use stdClass;
use function array_is_list;
/**
* Returns true only when all its expressions evaluate to true. Accepts any number of argument expressions.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/and/
* @internal
*/
final class AndOperator implements ResolvesToBool, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$and';
public const PROPERTIES = ['expression' => 'expression'];
/** @var list<DateTimeInterface|Decimal128|ExpressionInterface|Int64|ResolvesToBool|ResolvesToNull|ResolvesToNumber|ResolvesToString|Type|array|bool|float|int|null|stdClass|string> $expression */
public readonly array $expression;
/**
* @param DateTimeInterface|Decimal128|ExpressionInterface|Int64|ResolvesToBool|ResolvesToNull|ResolvesToNumber|ResolvesToString|Type|array|bool|float|int|null|stdClass|string ...$expression
* @no-named-arguments
*/
public function __construct(
DateTimeInterface|Decimal128|Int64|Type|ResolvesToBool|ResolvesToNull|ResolvesToNumber|ResolvesToString|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression,
) {
if (\count($expression) < 1) {
throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression)));
}
if (! array_is_list($expression)) {
throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported');
}
$this->expression = $expression;
}
}

52
vendor/mongodb/mongodb/src/Builder/Expression/AnyElementTrueOperator.php

@ -0,0 +1,52 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\PackedArray;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\BSONArray;
use function array_is_list;
use function is_array;
use function is_string;
use function str_starts_with;
/**
* Returns true if any elements of a set evaluate to true; otherwise, returns false. Accepts a single argument expression.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/anyElementTrue/
* @internal
*/
final class AnyElementTrueOperator implements ResolvesToBool, OperatorInterface
{
public const ENCODE = Encode::Array;
public const NAME = '$anyElementTrue';
public const PROPERTIES = ['expression' => 'expression'];
/** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression */
public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression;
/**
* @param BSONArray|PackedArray|ResolvesToArray|array|string $expression
*/
public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
if (is_array($expression) && ! array_is_list($expression)) {
throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.');
}
$this->expression = $expression;
}
}

63
vendor/mongodb/mongodb/src/Builder/Expression/ArrayElemAtOperator.php

@ -0,0 +1,63 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\PackedArray;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\BSONArray;
use function array_is_list;
use function is_array;
use function is_string;
use function str_starts_with;
/**
* Returns the element at the specified array index.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayElemAt/
* @internal
*/
final class ArrayElemAtOperator implements ResolvesToAny, OperatorInterface
{
public const ENCODE = Encode::Array;
public const NAME = '$arrayElemAt';
public const PROPERTIES = ['array' => 'array', 'idx' => 'idx'];
/** @var BSONArray|PackedArray|ResolvesToArray|array|string $array */
public readonly PackedArray|ResolvesToArray|BSONArray|array|string $array;
/** @var ResolvesToInt|int|string $idx */
public readonly ResolvesToInt|int|string $idx;
/**
* @param BSONArray|PackedArray|ResolvesToArray|array|string $array
* @param ResolvesToInt|int|string $idx
*/
public function __construct(
PackedArray|ResolvesToArray|BSONArray|array|string $array,
ResolvesToInt|int|string $idx,
) {
if (is_string($array) && ! str_starts_with($array, '$')) {
throw new InvalidArgumentException('Argument $array can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
if (is_array($array) && ! array_is_list($array)) {
throw new InvalidArgumentException('Expected $array argument to be a list, got an associative array.');
}
$this->array = $array;
if (is_string($idx) && ! str_starts_with($idx, '$')) {
throw new InvalidArgumentException('Argument $idx can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->idx = $idx;
}
}

29
vendor/mongodb/mongodb/src/Builder/Expression/ArrayFieldPath.php

@ -0,0 +1,29 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\Builder\Type\FieldPathInterface;
use MongoDB\Exception\InvalidArgumentException;
use function sprintf;
use function str_starts_with;
class ArrayFieldPath implements FieldPathInterface, ResolvesToArray
{
public readonly string $name;
public function __construct(string $name)
{
if (str_starts_with($name, '$')) {
throw new InvalidArgumentException(sprintf('Name cannot start with a dollar sign: "%s"', $name));
}
$this->name = $name;
}
}

52
vendor/mongodb/mongodb/src/Builder/Expression/ArrayToObjectOperator.php

@ -0,0 +1,52 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\PackedArray;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\BSONArray;
use function array_is_list;
use function is_array;
use function is_string;
use function str_starts_with;
/**
* Converts an array of key value pairs to a document.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayToObject/
* @internal
*/
final class ArrayToObjectOperator implements ResolvesToObject, OperatorInterface
{
public const ENCODE = Encode::Array;
public const NAME = '$arrayToObject';
public const PROPERTIES = ['array' => 'array'];
/** @var BSONArray|PackedArray|ResolvesToArray|array|string $array */
public readonly PackedArray|ResolvesToArray|BSONArray|array|string $array;
/**
* @param BSONArray|PackedArray|ResolvesToArray|array|string $array
*/
public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $array)
{
if (is_string($array) && ! str_starts_with($array, '$')) {
throw new InvalidArgumentException('Argument $array can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
if (is_array($array) && ! array_is_list($array)) {
throw new InvalidArgumentException('Expected $array argument to be a list, got an associative array.');
}
$this->array = $array;
}
}

52
vendor/mongodb/mongodb/src/Builder/Expression/AsinOperator.php

@ -0,0 +1,52 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the inverse sin (arc sine) of a value in radians.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/asin/
* @internal
*/
final class AsinOperator implements ResolvesToDouble, ResolvesToDecimal, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$asin';
public const PROPERTIES = ['expression' => 'expression'];
/**
* @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1.
* $asin returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $asin returns values as a double. $asin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1.
* $asin returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $asin returns values as a double. $asin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

52
vendor/mongodb/mongodb/src/Builder/Expression/AsinhOperator.php

@ -0,0 +1,52 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the inverse hyperbolic sine (hyperbolic arc sine) of a value in radians.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/asinh/
* @internal
*/
final class AsinhOperator implements ResolvesToDouble, ResolvesToDecimal, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$asinh';
public const PROPERTIES = ['expression' => 'expression'];
/**
* @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asinh takes any valid expression that resolves to a number.
* $asinh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $asinh returns values as a double. $asinh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asinh takes any valid expression that resolves to a number.
* $asinh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $asinh returns values as a double. $asinh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

63
vendor/mongodb/mongodb/src/Builder/Expression/Atan2Operator.php

@ -0,0 +1,63 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the inverse tangent (arc tangent) of y / x in radians, where y and x are the first and second values passed to the expression respectively.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan2/
* @internal
*/
final class Atan2Operator implements ResolvesToDouble, ResolvesToDecimal, OperatorInterface
{
public const ENCODE = Encode::Array;
public const NAME = '$atan2';
public const PROPERTIES = ['y' => 'y', 'x' => 'x'];
/**
* @var Decimal128|Int64|ResolvesToNumber|float|int|string $y $atan2 takes any valid expression that resolves to a number.
* $atan2 returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $atan returns values as a double. $atan2 can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $y;
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $x */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $x;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $y $atan2 takes any valid expression that resolves to a number.
* $atan2 returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $atan returns values as a double. $atan2 can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $x
*/
public function __construct(
Decimal128|Int64|ResolvesToNumber|float|int|string $y,
Decimal128|Int64|ResolvesToNumber|float|int|string $x,
) {
if (is_string($y) && ! str_starts_with($y, '$')) {
throw new InvalidArgumentException('Argument $y can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->y = $y;
if (is_string($x) && ! str_starts_with($x, '$')) {
throw new InvalidArgumentException('Argument $x can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->x = $x;
}
}

52
vendor/mongodb/mongodb/src/Builder/Expression/AtanOperator.php

@ -0,0 +1,52 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the inverse tangent (arc tangent) of a value in radians.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan/
* @internal
*/
final class AtanOperator implements ResolvesToDouble, ResolvesToDecimal, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$atan';
public const PROPERTIES = ['expression' => 'expression'];
/**
* @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atan takes any valid expression that resolves to a number.
* $atan returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $atan returns values as a double. $atan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atan takes any valid expression that resolves to a number.
* $atan returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $atan returns values as a double. $atan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

52
vendor/mongodb/mongodb/src/Builder/Expression/AtanhOperator.php

@ -0,0 +1,52 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the inverse hyperbolic tangent (hyperbolic arc tangent) of a value in radians.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/atanh/
* @internal
*/
final class AtanhOperator implements ResolvesToDouble, ResolvesToDecimal, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$atanh';
public const PROPERTIES = ['expression' => 'expression'];
/**
* @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1.
* $atanh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $atanh returns values as a double. $atanh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1.
* $atanh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees.
* By default $atanh returns values as a double. $atanh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value.
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

51
vendor/mongodb/mongodb/src/Builder/Expression/AvgOperator.php

@ -0,0 +1,51 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function array_is_list;
/**
* Returns an average of numerical values. Ignores non-numeric values.
* Changed in MongoDB 5.0: Available in the $setWindowFields stage.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/
* @internal
*/
final class AvgOperator implements ResolvesToNumber, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$avg';
public const PROPERTIES = ['expression' => 'expression'];
/** @var list<Decimal128|Int64|ResolvesToNumber|float|int|string> $expression */
public readonly array $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression
* @no-named-arguments
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression)
{
if (\count($expression) < 1) {
throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression)));
}
if (! array_is_list($expression)) {
throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported');
}
$this->expression = $expression;
}
}

29
vendor/mongodb/mongodb/src/Builder/Expression/BinDataFieldPath.php

@ -0,0 +1,29 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\Builder\Type\FieldPathInterface;
use MongoDB\Exception\InvalidArgumentException;
use function sprintf;
use function str_starts_with;
class BinDataFieldPath implements FieldPathInterface, ResolvesToBinData
{
public readonly string $name;
public function __construct(string $name)
{
if (str_starts_with($name, '$')) {
throw new InvalidArgumentException(sprintf('Name cannot start with a dollar sign: "%s"', $name));
}
$this->name = $name;
}
}

37
vendor/mongodb/mongodb/src/Builder/Expression/BinarySizeOperator.php

@ -0,0 +1,37 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Binary;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
/**
* Returns the size of a given string or binary data value's content in bytes.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/binarySize/
* @internal
*/
final class BinarySizeOperator implements ResolvesToInt, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$binarySize';
public const PROPERTIES = ['expression' => 'expression'];
/** @var Binary|ResolvesToBinData|ResolvesToNull|ResolvesToString|null|string $expression */
public readonly Binary|ResolvesToBinData|ResolvesToNull|ResolvesToString|null|string $expression;
/**
* @param Binary|ResolvesToBinData|ResolvesToNull|ResolvesToString|null|string $expression
*/
public function __construct(Binary|ResolvesToBinData|ResolvesToNull|ResolvesToString|null|string $expression)
{
$this->expression = $expression;
}
}

50
vendor/mongodb/mongodb/src/Builder/Expression/BitAndOperator.php

@ -0,0 +1,50 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function array_is_list;
/**
* Returns the result of a bitwise and operation on an array of int or long values.
* New in MongoDB 6.3.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitAnd/
* @internal
*/
final class BitAndOperator implements ResolvesToInt, ResolvesToLong, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$bitAnd';
public const PROPERTIES = ['expression' => 'expression'];
/** @var list<Int64|ResolvesToInt|ResolvesToLong|int|string> $expression */
public readonly array $expression;
/**
* @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression
* @no-named-arguments
*/
public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression)
{
if (\count($expression) < 1) {
throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression)));
}
if (! array_is_list($expression)) {
throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported');
}
$this->expression = $expression;
}
}

46
vendor/mongodb/mongodb/src/Builder/Expression/BitNotOperator.php

@ -0,0 +1,46 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the result of a bitwise not operation on a single argument or an array that contains a single int or long value.
* New in MongoDB 6.3.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitNot/
* @internal
*/
final class BitNotOperator implements ResolvesToInt, ResolvesToLong, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$bitNot';
public const PROPERTIES = ['expression' => 'expression'];
/** @var Int64|ResolvesToInt|ResolvesToLong|int|string $expression */
public readonly Int64|ResolvesToInt|ResolvesToLong|int|string $expression;
/**
* @param Int64|ResolvesToInt|ResolvesToLong|int|string $expression
*/
public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

50
vendor/mongodb/mongodb/src/Builder/Expression/BitOrOperator.php

@ -0,0 +1,50 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function array_is_list;
/**
* Returns the result of a bitwise or operation on an array of int or long values.
* New in MongoDB 6.3.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitOr/
* @internal
*/
final class BitOrOperator implements ResolvesToInt, ResolvesToLong, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$bitOr';
public const PROPERTIES = ['expression' => 'expression'];
/** @var list<Int64|ResolvesToInt|ResolvesToLong|int|string> $expression */
public readonly array $expression;
/**
* @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression
* @no-named-arguments
*/
public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression)
{
if (\count($expression) < 1) {
throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression)));
}
if (! array_is_list($expression)) {
throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported');
}
$this->expression = $expression;
}
}

50
vendor/mongodb/mongodb/src/Builder/Expression/BitXorOperator.php

@ -0,0 +1,50 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function array_is_list;
/**
* Returns the result of a bitwise xor (exclusive or) operation on an array of int and long values.
* New in MongoDB 6.3.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitXor/
* @internal
*/
final class BitXorOperator implements ResolvesToInt, ResolvesToLong, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$bitXor';
public const PROPERTIES = ['expression' => 'expression'];
/** @var list<Int64|ResolvesToInt|ResolvesToLong|int|string> $expression */
public readonly array $expression;
/**
* @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression
* @no-named-arguments
*/
public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression)
{
if (\count($expression) < 1) {
throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression)));
}
if (! array_is_list($expression)) {
throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported');
}
$this->expression = $expression;
}
}

29
vendor/mongodb/mongodb/src/Builder/Expression/BoolFieldPath.php

@ -0,0 +1,29 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\Builder\Type\FieldPathInterface;
use MongoDB\Exception\InvalidArgumentException;
use function sprintf;
use function str_starts_with;
class BoolFieldPath implements FieldPathInterface, ResolvesToBool
{
public readonly string $name;
public function __construct(string $name)
{
if (str_starts_with($name, '$')) {
throw new InvalidArgumentException(sprintf('Name cannot start with a dollar sign: "%s"', $name));
}
$this->name = $name;
}
}

48
vendor/mongodb/mongodb/src/Builder/Expression/BsonSizeOperator.php

@ -0,0 +1,48 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Document;
use MongoDB\BSON\Serializable;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use stdClass;
use function is_string;
use function str_starts_with;
/**
* Returns the size in bytes of a given document (i.e. BSON type Object) when encoded as BSON.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bsonSize/
* @internal
*/
final class BsonSizeOperator implements ResolvesToInt, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$bsonSize';
public const PROPERTIES = ['object' => 'object'];
/** @var Document|ResolvesToNull|ResolvesToObject|Serializable|array|null|stdClass|string $object */
public readonly Document|Serializable|ResolvesToNull|ResolvesToObject|stdClass|array|null|string $object;
/**
* @param Document|ResolvesToNull|ResolvesToObject|Serializable|array|null|stdClass|string $object
*/
public function __construct(
Document|Serializable|ResolvesToNull|ResolvesToObject|stdClass|array|null|string $object,
) {
if (is_string($object) && ! str_starts_with($object, '$')) {
throw new InvalidArgumentException('Argument $object can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->object = $object;
}
}

56
vendor/mongodb/mongodb/src/Builder/Expression/CaseOperator.php

@ -0,0 +1,56 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\SwitchBranchInterface;
use MongoDB\Exception\InvalidArgumentException;
use stdClass;
use function is_string;
use function str_starts_with;
/**
* Represents a single case in a $switch expression
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/switch/
* @internal
*/
final class CaseOperator implements SwitchBranchInterface, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = null;
public const PROPERTIES = ['case' => 'case', 'then' => 'then'];
/** @var ResolvesToBool|bool|string $case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. */
public readonly ResolvesToBool|bool|string $case;
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then Can be any valid expression. */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then;
/**
* @param ResolvesToBool|bool|string $case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here.
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then Can be any valid expression.
*/
public function __construct(
ResolvesToBool|bool|string $case,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then,
) {
if (is_string($case) && ! str_starts_with($case, '$')) {
throw new InvalidArgumentException('Argument $case can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->case = $case;
$this->then = $then;
}
}

46
vendor/mongodb/mongodb/src/Builder/Expression/CeilOperator.php

@ -0,0 +1,46 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the smallest integer greater than or equal to the specified number.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/ceil/
* @internal
*/
final class CeilOperator implements ResolvesToInt, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$ceil';
public const PROPERTIES = ['expression' => 'expression'];
/** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN. */
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN.
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

47
vendor/mongodb/mongodb/src/Builder/Expression/CmpOperator.php

@ -0,0 +1,47 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use stdClass;
/**
* Returns 0 if the two values are equivalent, 1 if the first value is greater than the second, and -1 if the first value is less than the second.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/cmp/
* @internal
*/
final class CmpOperator implements ResolvesToInt, OperatorInterface
{
public const ENCODE = Encode::Array;
public const NAME = '$cmp';
public const PROPERTIES = ['expression1' => 'expression1', 'expression2' => 'expression2'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1 */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1;
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2 */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression1
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression2
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2,
) {
$this->expression1 = $expression1;
$this->expression2 = $expression2;
}
}

50
vendor/mongodb/mongodb/src/Builder/Expression/ConcatArraysOperator.php

@ -0,0 +1,50 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\PackedArray;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\BSONArray;
use function array_is_list;
/**
* Concatenates arrays to return the concatenated array.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/concatArrays/
* @internal
*/
final class ConcatArraysOperator implements ResolvesToArray, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$concatArrays';
public const PROPERTIES = ['array' => 'array'];
/** @var list<BSONArray|PackedArray|ResolvesToArray|array|string> $array */
public readonly array $array;
/**
* @param BSONArray|PackedArray|ResolvesToArray|array|string ...$array
* @no-named-arguments
*/
public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$array)
{
if (\count($array) < 1) {
throw new InvalidArgumentException(\sprintf('Expected at least %d values for $array, got %d.', 1, \count($array)));
}
if (! array_is_list($array)) {
throw new InvalidArgumentException('Expected $array arguments to be a list (array), named arguments are not supported');
}
$this->array = $array;
}
}

48
vendor/mongodb/mongodb/src/Builder/Expression/ConcatOperator.php

@ -0,0 +1,48 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function array_is_list;
/**
* Concatenates any number of strings.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/concat/
* @internal
*/
final class ConcatOperator implements ResolvesToString, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$concat';
public const PROPERTIES = ['expression' => 'expression'];
/** @var list<ResolvesToString|string> $expression */
public readonly array $expression;
/**
* @param ResolvesToString|string ...$expression
* @no-named-arguments
*/
public function __construct(ResolvesToString|string ...$expression)
{
if (\count($expression) < 1) {
throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression)));
}
if (! array_is_list($expression)) {
throw new InvalidArgumentException('Expected $expression arguments to be a list (array), named arguments are not supported');
}
$this->expression = $expression;
}
}

61
vendor/mongodb/mongodb/src/Builder/Expression/CondOperator.php

@ -0,0 +1,61 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use stdClass;
use function is_string;
use function str_starts_with;
/**
* A ternary operator that evaluates one expression, and depending on the result, returns the value of one of the other two expressions. Accepts either three expressions in an ordered list or three named parameters.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/cond/
* @internal
*/
final class CondOperator implements ResolvesToAny, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$cond';
public const PROPERTIES = ['if' => 'if', 'then' => 'then', 'else' => 'else'];
/** @var ResolvesToBool|bool|string $if */
public readonly ResolvesToBool|bool|string $if;
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then;
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $else */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $else;
/**
* @param ResolvesToBool|bool|string $if
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $else
*/
public function __construct(
ResolvesToBool|bool|string $if,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then,
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $else,
) {
if (is_string($if) && ! str_starts_with($if, '$')) {
throw new InvalidArgumentException('Argument $if can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->if = $if;
$this->then = $then;
$this->else = $else;
}
}

69
vendor/mongodb/mongodb/src/Builder/Expression/ConvertOperator.php

@ -0,0 +1,69 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\Optional;
use stdClass;
/**
* Converts a value to a specified type.
* New in MongoDB 4.0.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/convert/
* @internal
*/
final class ConvertOperator implements ResolvesToAny, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$convert';
public const PROPERTIES = ['input' => 'input', 'to' => 'to', 'onError' => 'onError', 'onNull' => 'onNull'];
/** @var DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input */
public readonly DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input;
/** @var ResolvesToInt|ResolvesToString|int|string $to */
public readonly ResolvesToInt|ResolvesToString|int|string $to;
/**
* @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onError The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression.
* If unspecified, the operation throws an error upon encountering an error and stops.
*/
public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError;
/**
* @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull The value to return if the input is null or missing. The arguments can be any valid expression.
* If unspecified, $convert returns null if the input is null or missing.
*/
public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull;
/**
* @param DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input
* @param ResolvesToInt|ResolvesToString|int|string $to
* @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onError The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression.
* If unspecified, the operation throws an error upon encountering an error and stops.
* @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull The value to return if the input is null or missing. The arguments can be any valid expression.
* If unspecified, $convert returns null if the input is null or missing.
*/
public function __construct(
DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input,
ResolvesToInt|ResolvesToString|int|string $to,
Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined,
Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined,
) {
$this->input = $input;
$this->to = $to;
$this->onError = $onError;
$this->onNull = $onNull;
}
}

50
vendor/mongodb/mongodb/src/Builder/Expression/CosOperator.php

@ -0,0 +1,50 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the cosine of a value that is measured in radians.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/cos/
* @internal
*/
final class CosOperator implements ResolvesToDouble, ResolvesToDecimal, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$cos';
public const PROPERTIES = ['expression' => 'expression'];
/**
* @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians.
* By default $cos returns values as a double. $cos can also return values as a 128-bit decimal as long as the <expression> resolves to a 128-bit decimal value.
*/
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians.
* By default $cos returns values as a double. $cos can also return values as a 128-bit decimal as long as the <expression> resolves to a 128-bit decimal value.
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

50
vendor/mongodb/mongodb/src/Builder/Expression/CoshOperator.php

@ -0,0 +1,50 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the hyperbolic cosine of a value that is measured in radians.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/cosh/
* @internal
*/
final class CoshOperator implements ResolvesToDouble, ResolvesToDecimal, OperatorInterface
{
public const ENCODE = Encode::Single;
public const NAME = '$cosh';
public const PROPERTIES = ['expression' => 'expression'];
/**
* @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians.
* By default $cosh returns values as a double. $cosh can also return values as a 128-bit decimal if the <expression> resolves to a 128-bit decimal value.
*/
public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression;
/**
* @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians.
* By default $cosh returns values as a double. $cosh can also return values as a 128-bit decimal if the <expression> resolves to a 128-bit decimal value.
*/
public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression)
{
if (is_string($expression) && ! str_starts_with($expression, '$')) {
throw new InvalidArgumentException('Argument $expression can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->expression = $expression;
}
}

74
vendor/mongodb/mongodb/src/Builder/Expression/DateAddOperator.php

@ -0,0 +1,74 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use DateTimeInterface;
use MongoDB\BSON\Int64;
use MongoDB\BSON\ObjectId;
use MongoDB\BSON\Timestamp;
use MongoDB\BSON\UTCDateTime;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\Optional;
use MongoDB\Builder\Type\TimeUnit;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Adds a number of time units to a date object.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateAdd/
* @internal
*/
final class DateAddOperator implements ResolvesToDate, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$dateAdd';
public const PROPERTIES = ['startDate' => 'startDate', 'unit' => 'unit', 'amount' => 'amount', 'timezone' => 'timezone'];
/** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */
public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate;
/** @var ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. */
public readonly ResolvesToString|TimeUnit|string $unit;
/** @var Int64|ResolvesToInt|ResolvesToLong|int|string $amount */
public readonly Int64|ResolvesToInt|ResolvesToLong|int|string $amount;
/** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */
public readonly Optional|ResolvesToString|string $timezone;
/**
* @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID.
* @param ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate.
* @param Int64|ResolvesToInt|ResolvesToLong|int|string $amount
* @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC.
*/
public function __construct(
DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate,
ResolvesToString|TimeUnit|string $unit,
Int64|ResolvesToInt|ResolvesToLong|int|string $amount,
Optional|ResolvesToString|string $timezone = Optional::Undefined,
) {
if (is_string($startDate) && ! str_starts_with($startDate, '$')) {
throw new InvalidArgumentException('Argument $startDate can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->startDate = $startDate;
$this->unit = $unit;
if (is_string($amount) && ! str_starts_with($amount, '$')) {
throw new InvalidArgumentException('Argument $amount can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->amount = $amount;
$this->timezone = $timezone;
}
}

86
vendor/mongodb/mongodb/src/Builder/Expression/DateDiffOperator.php

@ -0,0 +1,86 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use DateTimeInterface;
use MongoDB\BSON\ObjectId;
use MongoDB\BSON\Timestamp;
use MongoDB\BSON\UTCDateTime;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\Optional;
use MongoDB\Builder\Type\TimeUnit;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Returns the difference between two dates.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateDiff/
* @internal
*/
final class DateDiffOperator implements ResolvesToInt, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$dateDiff';
public const PROPERTIES = [
'startDate' => 'startDate',
'endDate' => 'endDate',
'unit' => 'unit',
'timezone' => 'timezone',
'startOfWeek' => 'startOfWeek',
];
/** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */
public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate;
/** @var DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */
public readonly DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $endDate;
/** @var ResolvesToString|TimeUnit|string $unit The time measurement unit between the startDate and endDate */
public readonly ResolvesToString|TimeUnit|string $unit;
/** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */
public readonly Optional|ResolvesToString|string $timezone;
/** @var Optional|ResolvesToString|string $startOfWeek Used when the unit is equal to week. Defaults to Sunday. The startOfWeek parameter is an expression that resolves to a case insensitive string */
public readonly Optional|ResolvesToString|string $startOfWeek;
/**
* @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID.
* @param DateTimeInterface|ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID.
* @param ResolvesToString|TimeUnit|string $unit The time measurement unit between the startDate and endDate
* @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC.
* @param Optional|ResolvesToString|string $startOfWeek Used when the unit is equal to week. Defaults to Sunday. The startOfWeek parameter is an expression that resolves to a case insensitive string
*/
public function __construct(
DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate,
DateTimeInterface|ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $endDate,
ResolvesToString|TimeUnit|string $unit,
Optional|ResolvesToString|string $timezone = Optional::Undefined,
Optional|ResolvesToString|string $startOfWeek = Optional::Undefined,
) {
if (is_string($startDate) && ! str_starts_with($startDate, '$')) {
throw new InvalidArgumentException('Argument $startDate can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->startDate = $startDate;
if (is_string($endDate) && ! str_starts_with($endDate, '$')) {
throw new InvalidArgumentException('Argument $endDate can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->endDate = $endDate;
$this->unit = $unit;
$this->timezone = $timezone;
$this->startOfWeek = $startOfWeek;
}
}

29
vendor/mongodb/mongodb/src/Builder/Expression/DateFieldPath.php

@ -0,0 +1,29 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\Builder\Type\FieldPathInterface;
use MongoDB\Exception\InvalidArgumentException;
use function sprintf;
use function str_starts_with;
class DateFieldPath implements FieldPathInterface, ResolvesToDate
{
public readonly string $name;
public function __construct(string $name)
{
if (str_starts_with($name, '$')) {
throw new InvalidArgumentException(sprintf('Name cannot start with a dollar sign: "%s"', $name));
}
$this->name = $name;
}
}

157
vendor/mongodb/mongodb/src/Builder/Expression/DateFromPartsOperator.php

@ -0,0 +1,157 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use MongoDB\BSON\Decimal128;
use MongoDB\BSON\Int64;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\Optional;
use MongoDB\Exception\InvalidArgumentException;
use function is_string;
use function str_starts_with;
/**
* Constructs a BSON Date object given the date's constituent parts.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromParts/
* @internal
*/
final class DateFromPartsOperator implements ResolvesToDate, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$dateFromParts';
public const PROPERTIES = [
'year' => 'year',
'isoWeekYear' => 'isoWeekYear',
'month' => 'month',
'isoWeek' => 'isoWeek',
'day' => 'day',
'isoDayOfWeek' => 'isoDayOfWeek',
'hour' => 'hour',
'minute' => 'minute',
'second' => 'second',
'millisecond' => 'millisecond',
'timezone' => 'timezone',
];
/** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year Calendar year. Can be any expression that evaluates to a number. */
public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year;
/** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. */
public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear;
/** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month Month. Defaults to 1. */
public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month;
/** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek Week of year. Defaults to 1. */
public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek;
/** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day Day of month. Defaults to 1. */
public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day;
/** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. */
public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek;
/** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour Hour. Defaults to 0. */
public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour;
/** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute Minute. Defaults to 0. */
public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute;
/** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second Second. Defaults to 0. */
public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second;
/** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond Millisecond. Defaults to 0. */
public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond;
/** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */
public readonly Optional|ResolvesToString|string $timezone;
/**
* @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year Calendar year. Can be any expression that evaluates to a number.
* @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number.
* @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month Month. Defaults to 1.
* @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek Week of year. Defaults to 1.
* @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day Day of month. Defaults to 1.
* @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1.
* @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour Hour. Defaults to 0.
* @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute Minute. Defaults to 0.
* @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second Second. Defaults to 0.
* @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond Millisecond. Defaults to 0.
* @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC.
*/
public function __construct(
Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year = Optional::Undefined,
Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear = Optional::Undefined,
Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month = Optional::Undefined,
Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek = Optional::Undefined,
Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day = Optional::Undefined,
Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek = Optional::Undefined,
Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour = Optional::Undefined,
Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute = Optional::Undefined,
Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second = Optional::Undefined,
Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond = Optional::Undefined,
Optional|ResolvesToString|string $timezone = Optional::Undefined,
) {
if (is_string($year) && ! str_starts_with($year, '$')) {
throw new InvalidArgumentException('Argument $year can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->year = $year;
if (is_string($isoWeekYear) && ! str_starts_with($isoWeekYear, '$')) {
throw new InvalidArgumentException('Argument $isoWeekYear can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->isoWeekYear = $isoWeekYear;
if (is_string($month) && ! str_starts_with($month, '$')) {
throw new InvalidArgumentException('Argument $month can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->month = $month;
if (is_string($isoWeek) && ! str_starts_with($isoWeek, '$')) {
throw new InvalidArgumentException('Argument $isoWeek can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->isoWeek = $isoWeek;
if (is_string($day) && ! str_starts_with($day, '$')) {
throw new InvalidArgumentException('Argument $day can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->day = $day;
if (is_string($isoDayOfWeek) && ! str_starts_with($isoDayOfWeek, '$')) {
throw new InvalidArgumentException('Argument $isoDayOfWeek can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->isoDayOfWeek = $isoDayOfWeek;
if (is_string($hour) && ! str_starts_with($hour, '$')) {
throw new InvalidArgumentException('Argument $hour can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->hour = $hour;
if (is_string($minute) && ! str_starts_with($minute, '$')) {
throw new InvalidArgumentException('Argument $minute can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->minute = $minute;
if (is_string($second) && ! str_starts_with($second, '$')) {
throw new InvalidArgumentException('Argument $second can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->second = $second;
if (is_string($millisecond) && ! str_starts_with($millisecond, '$')) {
throw new InvalidArgumentException('Argument $millisecond can be an expression, field paths and variable names must be prefixed by "$" or "$$".');
}
$this->millisecond = $millisecond;
$this->timezone = $timezone;
}
}

85
vendor/mongodb/mongodb/src/Builder/Expression/DateFromStringOperator.php

@ -0,0 +1,85 @@
<?php
/**
* THIS FILE IS AUTO-GENERATED. ANY CHANGES WILL BE LOST!
*/
declare(strict_types=1);
namespace MongoDB\Builder\Expression;
use DateTimeInterface;
use MongoDB\BSON\Type;
use MongoDB\Builder\Type\Encode;
use MongoDB\Builder\Type\ExpressionInterface;
use MongoDB\Builder\Type\OperatorInterface;
use MongoDB\Builder\Type\Optional;
use stdClass;
/**
* Converts a date/time string to a date object.
*
* @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromString/
* @internal
*/
final class DateFromStringOperator implements ResolvesToDate, OperatorInterface
{
public const ENCODE = Encode::Object;
public const NAME = '$dateFromString';
public const PROPERTIES = [
'dateString' => 'dateString',
'format' => 'format',
'timezone' => 'timezone',
'onError' => 'onError',
'onNull' => 'onNull',
];
/** @var ResolvesToString|string $dateString The date/time string to convert to a date object. */
public readonly ResolvesToString|string $dateString;
/**
* @var Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers.
* If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible.
*/
public readonly Optional|ResolvesToString|string $format;
/** @var Optional|ResolvesToString|string $timezone The time zone to use to format the date. */
public readonly Optional|ResolvesToString|string $timezone;
/**
* @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type.
* If you do not specify onError, $dateFromString throws an error if it cannot parse dateString.
*/
public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError;
/**
* @var Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type.
* If you do not specify onNull and dateString is null or missing, then $dateFromString outputs null.
*/
public readonly Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull;
/**
* @param ResolvesToString|string $dateString The date/time string to convert to a date object.
* @param Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers.
* If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible.
* @param Optional|ResolvesToString|string $timezone The time zone to use to format the date.
* @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type.
* If you do not specify onError, $dateFromString throws an error if it cannot parse dateString.
* @param Optional|DateTimeInterface|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type.
* If you do not specify onNull and dateString is null or missing, then $dateFromString outputs null.
*/
public function __construct(
ResolvesToString|string $dateString,
Optional|ResolvesToString|string $format = Optional::Undefined,
Optional|ResolvesToString|string $timezone = Optional::Undefined,
Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined,
Optional|DateTimeInterface|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined,
) {
$this->dateString = $dateString;
$this->format = $format;
$this->timezone = $timezone;
$this->onError = $onError;
$this->onNull = $onNull;
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save