| Conditions | 3 |
| Paths | 2 |
| Total Lines | 34 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 24 | protected function ObtainLastLeafInTree() : DaftNestedWriteableObject |
|
| 36 | 24 | { |
|
| 37 | /** |
||
| 38 | 24 | * @var \ParagonIE\EasyDB\EasyDB |
|
| 39 | 24 | */ |
|
| 40 | 24 | $db = $this->db; |
|
| 41 | 24 | ||
| 42 | 24 | /** |
|
| 43 | * @psalm-var class-string<T> |
||
| 44 | */ |
||
| 45 | 24 | $type = $this->type; |
|
| 46 | |||
| 47 | 24 | $sth = $db->prepare( |
|
| 48 | 'SELECT ' . |
||
| 49 | 24 | implode(',', array_map( |
|
| 50 | 24 | [$db, 'escapeIdentifier'], |
|
| 51 | $type::DaftObjectIdProperties() |
||
| 52 | )) . |
||
| 53 | 24 | ' FROM ' . |
|
| 54 | $this->DaftObjectDatabaseTable() . |
||
| 55 | ' ORDER BY ' . |
||
| 56 | $db->escapeIdentifier('intNestedLeft') . |
||
| 57 | ' DESC LIMIT 1' |
||
| 58 | ); |
||
| 59 | |||
| 60 | $sth->execute(); |
||
| 61 | |||
| 62 | $res = $sth->fetch(PDO::FETCH_ASSOC); |
||
| 63 | |||
| 64 | if (1 === count($res) && ! is_a($type, DefinesOwnArrayIdInterface::class, true)) { |
||
| 65 | $res = current($res); |
||
| 66 | } |
||
| 67 | |||
| 68 | return $this->RecallDaftObjectOrThrow($res); |
||
| 69 | } |
||
| 71 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.