Conditions | 9 |
Paths | 9 |
Total Lines | 23 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 51.9671 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
109 | 8 | private static function convertBSONObjectToLegacy(\MongoDB\BSON\Type $value) |
|
110 | { |
||
111 | 8 | switch (true) { |
|
112 | 8 | case $value instanceof \MongoDB\BSON\ObjectID: |
|
1 ignored issue
–
show
|
|||
113 | 8 | return new \MongoId($value); |
|
114 | case $value instanceof \MongoDB\BSON\Binary: |
||
1 ignored issue
–
show
|
|||
115 | return new \MongoBinData($value); |
||
116 | case $value instanceof \MongoDB\BSON\Javascript: |
||
1 ignored issue
–
show
|
|||
117 | return new \MongoCode($value); |
||
118 | case $value instanceof \MongoDB\BSON\MaxKey: |
||
1 ignored issue
–
show
|
|||
119 | return new \MongoMaxKey(); |
||
120 | case $value instanceof \MongoDB\BSON\MinKey: |
||
1 ignored issue
–
show
|
|||
121 | return new \MongoMinKey(); |
||
122 | case $value instanceof \MongoDB\BSON\Regex: |
||
1 ignored issue
–
show
|
|||
123 | return new \MongoRegex($value); |
||
124 | case $value instanceof \MongoDB\BSON\Timestamp: |
||
1 ignored issue
–
show
|
|||
125 | return new \MongoTimestamp($value); |
||
126 | case $value instanceof \MongoDB\BSON\UTCDatetime: |
||
1 ignored issue
–
show
|
|||
127 | return new \MongoDate($value); |
||
128 | default: |
||
129 | return $value; |
||
130 | } |
||
131 | } |
||
132 | |||
155 |
As per the PSR-2 coding standard, case statements should not be wrapped in curly braces. There is no need for braces, since each case is terminated by the next
break
.To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.