Skip to content

Commit 6663cf7

Browse files
committed
Re-order functions.php alphabetically
1 parent 581188c commit 6663cf7

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/functions.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,34 @@
77
use MongoDB\Exception\InvalidArgumentTypeException;
88
use stdClass;
99

10+
/**
11+
* Generate an index name from a key specification.
12+
*
13+
* @internal
14+
* @param array|object $document Document containing fields mapped to values,
15+
* which denote order or an index type
16+
* @return string
17+
* @throws InvalidArgumentTypeException
18+
*/
19+
function generate_index_name($document)
20+
{
21+
if (is_object($document)) {
22+
$document = get_object_vars($document);
23+
}
24+
25+
if ( ! is_array($document)) {
26+
throw new InvalidArgumentTypeException('$document', $document, 'array or object');
27+
}
28+
29+
$name = '';
30+
31+
foreach ($document as $field => $type) {
32+
$name .= ($name != '' ? '_' : '') . $field . '_' . $type;
33+
}
34+
35+
return $name;
36+
}
37+
1038
/**
1139
* Return whether the first key in the document starts with a "$" character.
1240
*
@@ -55,34 +83,6 @@ function is_last_pipeline_operator_out(array $pipeline)
5583
return key($lastOp) === '$out';
5684
}
5785

58-
/**
59-
* Generate an index name from a key specification.
60-
*
61-
* @internal
62-
* @param array|object $document Document containing fields mapped to values,
63-
* which denote order or an index type
64-
* @return string
65-
* @throws InvalidArgumentTypeException
66-
*/
67-
function generate_index_name($document)
68-
{
69-
if (is_object($document)) {
70-
$document = get_object_vars($document);
71-
}
72-
73-
if ( ! is_array($document)) {
74-
throw new InvalidArgumentTypeException('$document', $document, 'array or object');
75-
}
76-
77-
$name = '';
78-
79-
foreach ($document as $field => $type) {
80-
$name .= ($name != '' ? '_' : '') . $field . '_' . $type;
81-
}
82-
83-
return $name;
84-
}
85-
8686
/**
8787
* Converts a ReadConcern instance to a stdClass for use in a BSON document.
8888
*

0 commit comments

Comments
 (0)