@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | public function __construct() |
10 | 10 | { |
11 | - $this->ci =& get_instance(); |
|
11 | + $this->ci = & get_instance(); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | //-------------------------------------------------------------------- |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public function get($key) |
28 | 28 | { |
29 | 29 | // Does CI even have a cache engine loaded? |
30 | - if (! is_object($this->ci->cache)) |
|
30 | + if (!is_object($this->ci->cache)) |
|
31 | 31 | { |
32 | 32 | return false; |
33 | 33 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | public function set($key, $content, $ttl) |
49 | 49 | { |
50 | 50 | // Does CI even have a cache engine loaded? |
51 | - if (! is_object($this->ci->cache)) |
|
51 | + if (!is_object($this->ci->cache)) |
|
52 | 52 | { |
53 | 53 | return true; |
54 | 54 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | public function find($class) |
16 | 16 | { |
17 | - $ci =& get_instance(); |
|
17 | + $ci =& get_instance(); |
|
18 | 18 | |
19 | 19 | $ci->load->library($class); |
20 | 20 |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | public function find($class) |
16 | 16 | { |
17 | - $ci =& get_instance(); |
|
17 | + $ci = & get_instance(); |
|
18 | 18 | |
19 | 19 | $ci->load->library($class); |
20 | 20 |
@@ -145,7 +145,7 @@ |
||
145 | 145 | * we will try to run a framework-specific loader, if the user provided |
146 | 146 | * one in __construct(); |
147 | 147 | * |
148 | - * @param $library |
|
148 | + * @param string $library |
|
149 | 149 | * @return array |
150 | 150 | */ |
151 | 151 | public function determineClass($library) |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @return null|string |
52 | 52 | */ |
53 | - public function display($library, $params=null, $cache_name=null, $cache_ttl=0) |
|
53 | + public function display($library, $params = null, $cache_name = null, $cache_ttl = 0) |
|
54 | 54 | { |
55 | 55 | list($class, $method) = $this->determineClass($library); |
56 | 56 | |
57 | 57 | // Is it cached? |
58 | - $cache_name = ! empty($cache_name) ? $cache_name : $class . $method . md5(serialize($params)); |
|
58 | + $cache_name = !empty($cache_name) ? $cache_name : $class.$method.md5(serialize($params)); |
|
59 | 59 | |
60 | - if (! empty($this->cache) && $output = $this->cache->get($cache_name)) |
|
60 | + if (!empty($this->cache) && $output = $this->cache->get($cache_name)) |
|
61 | 61 | { |
62 | 62 | return $output; |
63 | 63 | } |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | elseif ( |
88 | 88 | ($num_of_params === 1) |
89 | 89 | && ( |
90 | - (! array_key_exists($ref_params[0]->name, $params_array)) |
|
90 | + (!array_key_exists($ref_params[ 0 ]->name, $params_array)) |
|
91 | 91 | || ( |
92 | - array_key_exists($ref_params[0]->name, $params_array) |
|
92 | + array_key_exists($ref_params[ 0 ]->name, $params_array) |
|
93 | 93 | && count($params_array) !== 1 |
94 | 94 | ) |
95 | 95 | ) |
@@ -99,31 +99,31 @@ discard block |
||
99 | 99 | } |
100 | 100 | else |
101 | 101 | { |
102 | - $fire_args = []; |
|
103 | - $method_params = []; |
|
102 | + $fire_args = [ ]; |
|
103 | + $method_params = [ ]; |
|
104 | 104 | |
105 | - foreach($ref_params as $arg) |
|
105 | + foreach ($ref_params as $arg) |
|
106 | 106 | { |
107 | - $method_params[$arg->name] = true; |
|
107 | + $method_params[ $arg->name ] = true; |
|
108 | 108 | if (array_key_exists($arg->name, $params_array)) |
109 | 109 | { |
110 | - $fire_args[$arg->name] = $params_array[$arg->name]; |
|
110 | + $fire_args[ $arg->name ] = $params_array[ $arg->name ]; |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | 114 | foreach ($params_array as $key => $val) |
115 | 115 | { |
116 | - if (! isset($method_params[$key])) |
|
116 | + if (!isset($method_params[ $key ])) |
|
117 | 117 | { |
118 | 118 | throw new \InvalidArgumentException("{$key} is not a valid param name."); |
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | - $output = call_user_func_array([$instance, $method], $fire_args); |
|
122 | + $output = call_user_func_array([ $instance, $method ], $fire_args); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | // Can we cache it? |
126 | - if (! empty($this->cache) && $cache_ttl !== 0) |
|
126 | + if (!empty($this->cache) && $cache_ttl !== 0) |
|
127 | 127 | { |
128 | 128 | $this->cache->set($cache_name, $output, $cache_ttl); |
129 | 129 | } |
@@ -83,8 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | $output = $instance->{$method}(); |
86 | - } |
|
87 | - elseif ( |
|
86 | + } elseif ( |
|
88 | 87 | ($num_of_params === 1) |
89 | 88 | && ( |
90 | 89 | (! array_key_exists($ref_params[0]->name, $params_array)) |
@@ -96,8 +95,7 @@ discard block |
||
96 | 95 | ) |
97 | 96 | { |
98 | 97 | $output = $instance->{$method}($params_array); |
99 | - } |
|
100 | - else |
|
98 | + } else |
|
101 | 99 | { |
102 | 100 | $fire_args = []; |
103 | 101 | $method_params = []; |
@@ -173,8 +171,7 @@ discard block |
||
173 | 171 | $found = true; |
174 | 172 | } |
175 | 173 | } |
176 | - } |
|
177 | - else |
|
174 | + } else |
|
178 | 175 | { |
179 | 176 | $found = true; |
180 | 177 | } |