Skip to content

Commit 04729ef

Browse files
committed
Fix snake_case variable names
1 parent c9cdb9f commit 04729ef

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

source/includes/read/cursor.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// Converts the documents stored in a cursor to an array
2727
// start-cursor-array
2828
$cursor = $collection->find(['name' => 'Dunkin\' Donuts']);
29-
$array_results = $cursor->toArray();
29+
$resultArray = $cursor->toArray();
3030
// end-cursor-array
3131

3232
// Creates a collection with a maximum size and inserts documents representing vegetables
@@ -52,12 +52,12 @@
5252
$cursor = $collection->find([], ['cursorType' => MongoDB\Operation\Find::TAILABLE]);
5353
$cursor->rewind();
5454

55-
$docs_found = 0;
56-
while ($docs_found < 3) {
55+
$docsFound = 0;
56+
while ($docsFound < 3) {
5757
if ($cursor->valid()) {
5858
$doc = $cursor->current();
5959
echo json_encode($doc), PHP_EOL;
60-
$docs_found++;
60+
$docsFound++;
6161
}
6262
$cursor->next();
6363
}

source/includes/write/gridfs.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function toJSON(object $document): string
2121

2222
// Creates or references a GridFS bucket with a custom name
2323
// start-create-custom-bucket
24-
$custom_bucket = $client->db->selectGridFSBucket(
24+
$customBucket = $client->db->selectGridFSBucket(
2525
['bucketName' => 'myCustomBucket'],
2626
);
2727
// end-create-custom-bucket
@@ -44,8 +44,8 @@ function toJSON(object $document): string
4444
// Prints information about each file in the bucket
4545
// start-retrieve-file-info
4646
$files = $bucket->find();
47-
foreach ($files as $file_doc) {
48-
echo toJSON($file_doc), PHP_EOL;
47+
foreach ($files as $fileDocument) {
48+
echo toJSON($fileDocument), PHP_EOL;
4949
}
5050
// end-retrieve-file-info
5151

source/includes/write/replace.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// end-db-coll
1010

1111
// start-replace-one
12-
$replace_document = [
12+
$replaceDocument = [
1313
'name' => 'Mongo\'s Pizza',
1414
'cuisine' => 'Pizza',
1515
'address' => [
@@ -19,12 +19,12 @@
1919
'borough' => 'Manhattan',
2020
];
2121

22-
$result = $collection->replaceOne(['name' => 'Pizza Town'], $replace_document);
22+
$result = $collection->replaceOne(['name' => 'Pizza Town'], $replaceDocument);
2323
echo 'Modified documents: ', $result->getModifiedCount();
2424
// end-replace-one
2525

2626
// start-replace-options
27-
$replace_document = [
27+
$replaceDocument = [
2828
'name' => 'Food World',
2929
'cuisine' => 'Mixed',
3030
'address' => [
@@ -36,7 +36,7 @@
3636

3737
$result = $collection->replaceOne(
3838
['name' => 'Food Town'],
39-
$replace_document,
39+
$replaceDocument,
4040
['upsert' => true],
4141
);
4242
// end-replace-options

0 commit comments

Comments
 (0)