Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
ffcccf3c
Unverified
Commit
ffcccf3c
authored
Jun 25, 2018
by
Jeremy Mikola
Committed by
GitHub
Jun 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use private static member for internal constant
parent
f3fb0d4c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
BSONIterator.php
src/Model/BSONIterator.php
+5
-5
No files found.
src/Model/BSONIterator.php
View file @
ffcccf3c
...
@@ -26,6 +26,8 @@ use Iterator;
...
@@ -26,6 +26,8 @@ use Iterator;
*/
*/
class
BSONIterator
implements
Iterator
class
BSONIterator
implements
Iterator
{
{
private
static
$bsonSize
=
4
;
private
$buffer
;
private
$buffer
;
private
$bufferLength
;
private
$bufferLength
;
private
$current
;
private
$current
;
...
@@ -33,8 +35,6 @@ class BSONIterator implements Iterator
...
@@ -33,8 +35,6 @@ class BSONIterator implements Iterator
private
$position
=
0
;
private
$position
=
0
;
private
$options
;
private
$options
;
const
BSON_SIZE
=
4
;
/**
/**
* Constructs a BSON Iterator.
* Constructs a BSON Iterator.
*
*
...
@@ -119,11 +119,11 @@ class BSONIterator implements Iterator
...
@@ -119,11 +119,11 @@ class BSONIterator implements Iterator
return
;
return
;
}
}
if
((
$this
->
bufferLength
-
$this
->
position
)
<
self
::
BSON_SIZE
)
{
if
((
$this
->
bufferLength
-
$this
->
position
)
<
self
::
$bsonSize
)
{
throw
new
UnexpectedValueException
(
sprintf
(
'Expected at least %d bytes; %d remaining'
,
self
::
BSON_SIZE
,
$this
->
bufferLength
-
$this
->
position
));
throw
new
UnexpectedValueException
(
sprintf
(
'Expected at least %d bytes; %d remaining'
,
self
::
$bsonSize
,
$this
->
bufferLength
-
$this
->
position
));
}
}
list
(,
$documentLength
)
=
unpack
(
'V'
,
substr
(
$this
->
buffer
,
$this
->
position
,
self
::
BSON_SIZE
));
list
(,
$documentLength
)
=
unpack
(
'V'
,
substr
(
$this
->
buffer
,
$this
->
position
,
self
::
$bsonSize
));
if
((
$this
->
bufferLength
-
$this
->
position
)
<
$documentLength
)
{
if
((
$this
->
bufferLength
-
$this
->
position
)
<
$documentLength
)
{
throw
new
UnexpectedValueException
(
sprintf
(
'Expected %d bytes; %d remaining'
,
$documentLength
,
$this
->
bufferLength
-
$this
->
position
));
throw
new
UnexpectedValueException
(
sprintf
(
'Expected %d bytes; %d remaining'
,
$documentLength
,
$this
->
bufferLength
-
$this
->
position
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment