Code Duplication    Length = 26-26 lines in 2 locations

code/DebugBarDatabaseNewProxy.php 1 location

@@ 342-367 (lines=26) @@
339
     * @param int $errorLevel The level of error reporting to enable for the query
340
     * @return SS_Query
341
     */
342
    public function query($sql, $errorLevel = E_USER_ERROR)
343
    {
344
        // Check if we should only preview this query
345
        if ($this->previewWrite($sql)) {
346
            return;
347
        }
348
349
        if (!$this->connector) {
350
            $self = $this;
351
            return $this->benchmarkQuery(
352
                $sql,
353
                function ($sql) use ($self, $errorLevel) {
354
                    return $self->oldQuery($sql, $errorLevel);
355
                }
356
            );
357
        }
358
359
        // Benchmark query
360
        $connector = $this->connector;
361
        return $this->benchmarkQuery(
362
            $sql,
363
            function ($sql) use ($connector, $errorLevel) {
364
                return $connector->query($sql, $errorLevel);
365
            }
366
        );
367
    }
368
369
    public function oldQuery($sql, $errorLevel = E_USER_ERROR)
370
    {

code/DebugBarDatabaseProxy.php 1 location

@@ 314-339 (lines=26) @@
311
     * @param int $errorLevel The level of error reporting to enable for the query
312
     * @return SS_Query
313
     */
314
    public function query($sql, $errorLevel = E_USER_ERROR)
315
    {
316
        // Check if we should only preview this query
317
        if ($this->previewWrite($sql)) {
318
            return;
319
        }
320
321
        if (!$this->connector) {
322
            $self = $this;
323
            return $this->benchmarkQuery(
324
                $sql,
325
                function ($sql) use ($self, $errorLevel) {
326
                    return $self->oldQuery($sql, $errorLevel);
327
                }
328
            );
329
        }
330
331
        // Benchmark query
332
        $connector = $this->connector;
333
        return $this->benchmarkQuery(
334
            $sql,
335
            function ($sql) use ($connector, $errorLevel) {
336
                return $connector->query($sql, $errorLevel);
337
            }
338
        );
339
    }
340
341
    public function oldQuery($sql, $errorLevel = E_USER_ERROR)
342
    {