Conditions | 5 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
24 | 78 | public function key() |
|
25 | { |
||
26 | 78 | if (!$this->useIdAsKey) { |
|
27 | 37 | return parent::key(); |
|
28 | } |
||
29 | |||
30 | 41 | $current = $this->current(); |
|
31 | |||
32 | 41 | if (!isset($current->_id) || (is_object($current->_id) && !$current->_id instanceof ObjectID)) { |
|
33 | 40 | return parent::key(); |
|
34 | } |
||
35 | |||
36 | 20 | return (string) $current->_id; |
|
37 | } |
||
38 | } |
||
39 |