Skip to content

Commit 817a1f6

Browse files
committed
Fix string quoting
1 parent af46eea commit 817a1f6

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

source/includes/aggregation/atlas-search.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,17 @@
7777
$collection->updateSearchIndex(
7878
'default',
7979
['mappings' => [
80-
"dynamic" => false,
81-
"fields" => [
82-
"name" => [
83-
["type" => "stringFacet"],
84-
["type" => "string"],
80+
'dynamic' => false,
81+
'fields' => [
82+
'name' => [
83+
['type' => 'stringFacet'],
84+
['type' => 'string'],
8585
[
86-
"foldDiacritics" => false,
87-
"maxGrams" => 7,
88-
"minGrams" => 3,
89-
"tokenization" => "edgeGram",
90-
"type" => "autocomplete",
86+
'foldDiacritics' => false,
87+
'maxGrams' => 7,
88+
'minGrams' => 3,
89+
'tokenization' => 'edgeGram',
90+
'type' => 'autocomplete',
9191
],
9292
],
9393
],

source/includes/connect/client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?php
22

3-
$client = new MongoDB\Client("mongodb://localhost:27017");
3+
$client = new MongoDB\Client('mongodb://localhost:27017');

source/includes/connect/connection-options.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
// start-connection-uri
44
// Replace the placeholders with your actual hostname, port, and path to the certificate key file
5-
$uri = "mongodb://<hostname>:<port>/?tls=true&tlsCertificateKeyFile=/path/to/file.pem";
5+
$uri = 'mongodb://<hostname>:<port>/?tls=true&tlsCertificateKeyFile=/path/to/file.pem';
66

77
// Create a MongoDB client
88
$client = new MongoDB\Client($uri);
99
// end-connection-uri
1010

1111
// start-client-options
1212
// Replace the placeholders with your actual hostname and port
13-
$uri = "mongodb://<hostname>:<port>/";
13+
$uri = 'mongodb://<hostname>:<port>/';
1414

1515
// Set the connection options
1616
// Replace the placeholder with the actual path to the certificate key file

source/includes/connect/stable-api.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
22

33
// start-specify-v1
4-
$uri = "mongodb://<hostname>:<port>";
4+
$uri = 'mongodb://<hostname>:<port>';
55

66
$driverOptions = ['serverApi' => new MongoDB\Driver\ServerApi('1')];
77

88
$client = new MongoDB\Client($uri, [], $driverOptions);
99
// end-specify-v1
1010

1111
// start-stable-api-options
12-
$uri = "mongodb://<hostname>:<port>";
12+
$uri = 'mongodb://<hostname>:<port>';
1313

1414
$serverApi = new MongoDB\Driver\ServerApi('1', strict: true, deprecationErrors: true);
1515
$driverOptions = ['serverApi' => $serverApi];

source/includes/write/transaction.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$checking = $client->bank->checking_accounts;
1010
$saving = $client->bank->saving_accounts;
1111

12-
$accountId = "5678";
12+
$accountId = '5678';
1313
$transferAmount = 1000.0;
1414

1515
$callback = function (MongoDB\Driver\Session $session) use (
@@ -20,30 +20,30 @@
2020
$transferAmount,
2121
): void {
2222
$checking->updateOne(
23-
["account_id" => $accountId],
24-
['$inc' => ["balance" => -$transferAmount]],
25-
["session" => $session],
23+
['account_id' => $accountId],
24+
['$inc' => ['balance' => -$transferAmount]],
25+
['session' => $session],
2626
);
2727

2828
$saving->updateOne(
29-
["account_id" => $accountId],
30-
['$inc' => ["balance" => $transferAmount]],
31-
["session" => $session],
29+
['account_id' => $accountId],
30+
['$inc' => ['balance' => $transferAmount]],
31+
['session' => $session],
3232
);
3333

3434
$summary = sprintf('SAVINGS +%1$u CHECKING -%1$u', $transferAmount);
3535

3636
$receipts->insertOne(
3737
[
38-
"account_id" => $accountId,
39-
"summary" => $summary,
40-
"timestamp" => new MongoDB\BSON\UTCDateTime(),
38+
'account_id' => $accountId,
39+
'summary' => $summary,
40+
'timestamp' => new MongoDB\BSON\UTCDateTime(),
4141
],
42-
["session" => $session],
42+
['session' => $session],
4343
);
4444

45-
echo "Successfully performed transaction!", PHP_EOL;
46-
echo "Summary: ", $summary, PHP_EOL;
45+
echo 'Successfully performed transaction!', PHP_EOL;
46+
echo 'Summary: ', $summary, PHP_EOL;
4747
};
4848
// end-callback
4949

@@ -53,6 +53,6 @@
5353
try {
5454
MongoDB\with_transaction($session, $callback);
5555
} catch (MongoDB\Driver\Exception\RuntimeException $e) {
56-
echo "Caught exception: ", $e->getMessage(), PHP_EOL;
56+
echo 'Caught exception: ', $e->getMessage(), PHP_EOL;
5757
}
5858
// end-txn

0 commit comments

Comments
 (0)