Skip to content

Commit 02db0fc

Browse files
committed
Reorganize and add folding markers
1 parent 4a3962f commit 02db0fc

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

src/Collection.php

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -24,46 +24,17 @@ class CursorType {
2424
class Collection {
2525
protected $manager;
2626
protected $rp;
27+
protected $wc;
2728
protected $ns;
2829

29-
function __construct(Manager $manager, $ns, ReadPreference $rp = null) {
30+
function __construct(Manager $manager, $ns, WriteConcern $wc = null, ReadPreference $rp = null) {
3031
$this->manager = $manager;
3132
$this->ns = $ns;
33+
$this->wc = $wc;
3234
$this->rp = $rp;
3335
}
3436

35-
protected function _opQueryFlags($options) {
36-
$flags = 0;
37-
38-
$flags |= $options["allowPartialResults"] ? QueryFlags::PARTIAL : 0;
39-
$flags |= $options["cursorType"] ? $options["cursorType"] : 0;
40-
$flags |= $options["oplogReplay"] ? QueryFlags::OPLOG_REPLY: 0;
41-
$flags |= $options["noCursorTimeout"] ? QueryFlags::NO_CURSOR_TIMEOUT : 0;
42-
43-
return $flags;
44-
}
45-
46-
protected function _buildQuery($document, $options) {
47-
if ($options["comment"]) {
48-
$options["modifiers"]['$comment'] = $options["comment"];
49-
}
50-
if ($options["maxTimeMS"]) {
51-
$options["modifiers"]['$maxTimeMS'] = $options["maxTimeMS"];
52-
}
53-
if ($options["sort"]) {
54-
$options['$orderby'] = $options["sort"];
55-
}
56-
57-
$flags = $this->_opQueryFlags($options);
58-
$options["cursorFlags"] = $flags;
59-
60-
61-
$query = new Query($document, $options);
62-
63-
return $query;
64-
}
65-
66-
function find(array $document = array(), array $options = array()) {
37+
function find(array $document = array(), array $options = array()) { /* {{{ {{{ */
6738

6839
$options = array_merge($this->getFindOptions(), $options);
6940

@@ -72,9 +43,8 @@ function find(array $document = array(), array $options = array()) {
7243
$cursor = $this->manager->executeQuery($this->ns, $query, $this->rp);
7344

7445
return $cursor;
75-
}
76-
77-
function getFindOptions() {
46+
} /* }}} */
47+
function getFindOptions() { /* {{{ */
7848
return array(
7949
/**
8050
* Get partial results from a mongos if some shards are down (instead of throwing an error).
@@ -166,6 +136,37 @@ function getFindOptions() {
166136
*/
167137
"sort" => array(),
168138
);
139+
} /* }}} */
140+
protected function _opQueryFlags($options) { /* {{{ */
141+
$flags = 0;
142+
143+
$flags |= $options["allowPartialResults"] ? QueryFlags::PARTIAL : 0;
144+
$flags |= $options["cursorType"] ? $options["cursorType"] : 0;
145+
$flags |= $options["oplogReplay"] ? QueryFlags::OPLOG_REPLY: 0;
146+
$flags |= $options["noCursorTimeout"] ? QueryFlags::NO_CURSOR_TIMEOUT : 0;
147+
148+
return $flags;
149+
} /* }}} */
150+
protected function _buildQuery($document, $options) { /* {{{ */
151+
if ($options["comment"]) {
152+
$options["modifiers"]['$comment'] = $options["comment"];
153+
}
154+
if ($options["maxTimeMS"]) {
155+
$options["modifiers"]['$maxTimeMS'] = $options["maxTimeMS"];
156+
}
157+
if ($options["sort"]) {
158+
$options['$orderby'] = $options["sort"];
159+
}
160+
161+
$flags = $this->_opQueryFlags($options);
162+
$options["cursorFlags"] = $flags;
163+
164+
165+
$query = new Query($document, $options);
166+
167+
return $query;
168+
} /* }}} */
169+
/* }}} */
169170
}
170171
}
171172

0 commit comments

Comments
 (0)