Completed
Push — master ( 68c2d1...79d43d )
by Angus
02:33
created

MY_Loader   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 85.71%

Importance

Changes 0
Metric Value
dl 0
loc 29
ccs 6
cts 7
cp 0.8571
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A database() 0 11 2
1
<?php
2
3
class MY_Loader extends CI_Loader {
4
5 96
	public function __construct() {
6 96
		parent::__construct();
7 96
	}
8
9
	/**
10
	 * Database Loader extension, to load our version of the caching engine
11
	 *
12
	 * @access   public
13
	 *
14
	 * @param    string  the DB credentials
15
	 * @param    bool    whether to return the DB object
16
	 * @param    bool    whether to enable active record (this allows us to override the config setting)
17
	 *
18
	 * @return   object
19
	 */
20 96
	function database($params = '', $return = FALSE, $active_record = NULL) {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
21
		// load our version of the CI_DB_Cache class. The database library checks
22
		// if this class is already loaded before instantiating it. Loading it now
23
		// makes sure our version is used when a controller enables query caching
24 96
		if(!class_exists('CI_DB_Cache')) {
25
			@include(APPPATH . 'libraries/MY_DB_cache.php');
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
26
		}
27
28
		// call the parent method to retain the CI functionality
29 96
		return parent::database($params, $return, $active_record);
30
	}
31
}
32