Code Duplication    Length = 16-16 lines in 4 locations

system/libraries/drivers/Database/Mssql.php 1 location

@@ 346-361 (lines=16) @@
343
        }
344
    }
345
346
    public function result($object = true, $type = MSSQL_ASSOC)
347
    {
348
        $this->fetch_type = ((bool) $object) ? 'mssql_fetch_object' : 'mssql_fetch_array';
349
350
        // This check has to be outside the previous statement, because we do not
351
        // know the state of fetch_type when $object = NULL
352
        // NOTE - The class set by $type must be defined before fetching the result,
353
        // autoloading is disabled to save a lot of stupid overhead.
354
        if ($this->fetch_type == 'mssql_fetch_object') {
355
            $this->return_type = (is_string($type) and Kohana::auto_load($type)) ? $type : 'stdClass';
356
        } else {
357
            $this->return_type = $type;
358
        }
359
360
        return $this;
361
    }
362
363
    public function as_array($object = null, $type = MSSQL_ASSOC)
364
    {

system/libraries/drivers/Database/Mysql.php 1 location

@@ 371-386 (lines=16) @@
368
        }
369
    }
370
371
    public function result($object = true, $type = MYSQL_ASSOC)
372
    {
373
        $this->fetch_type = ((bool) $object) ? 'mysql_fetch_object' : 'mysql_fetch_array';
374
375
        // This check has to be outside the previous statement, because we do not
376
        // know the state of fetch_type when $object = NULL
377
        // NOTE - The class set by $type must be defined before fetching the result,
378
        // autoloading is disabled to save a lot of stupid overhead.
379
        if ($this->fetch_type == 'mysql_fetch_object' and $object === true) {
380
            $this->return_type = (is_string($type) and Kohana::auto_load($type)) ? $type : 'stdClass';
381
        } else {
382
            $this->return_type = $type;
383
        }
384
385
        return $this;
386
    }
387
388
    public function as_array($object = null, $type = MYSQL_ASSOC)
389
    {

system/libraries/drivers/Database/Mysqli.php 1 location

@@ 187-202 (lines=16) @@
184
        }
185
    }
186
187
    public function result($object = true, $type = MYSQLI_ASSOC)
188
    {
189
        $this->fetch_type = ((bool) $object) ? 'fetch_object' : 'fetch_array';
190
191
        // This check has to be outside the previous statement, because we do not
192
        // know the state of fetch_type when $object = NULL
193
        // NOTE - The class set by $type must be defined before fetching the result,
194
        // autoloading is disabled to save a lot of stupid overhead.
195
        if ($this->fetch_type == 'fetch_object') {
196
            $this->return_type = (is_string($type) and Kohana::auto_load($type)) ? $type : 'stdClass';
197
        } else {
198
            $this->return_type = $type;
199
        }
200
201
        return $this;
202
    }
203
204
    public function as_array($object = null, $type = MYSQLI_ASSOC)
205
    {

system/libraries/drivers/Database/Pgsql.php 1 location

@@ 338-353 (lines=16) @@
335
        }
336
    }
337
338
    public function result($object = true, $type = PGSQL_ASSOC)
339
    {
340
        $this->fetch_type = ((bool) $object) ? 'pg_fetch_object' : 'pg_fetch_array';
341
342
        // This check has to be outside the previous statement, because we do not
343
        // know the state of fetch_type when $object = NULL
344
        // NOTE - The class set by $type must be defined before fetching the result,
345
        // autoloading is disabled to save a lot of stupid overhead.
346
        if ($this->fetch_type == 'pg_fetch_object') {
347
            $this->return_type = (is_string($type) and Kohana::auto_load($type)) ? $type : 'stdClass';
348
        } else {
349
            $this->return_type = $type;
350
        }
351
352
        return $this;
353
    }
354
355
    public function as_array($object = null, $type = PGSQL_ASSOC)
356
    {