@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | <div class="nav-header"><?php echo $file; ?></div> |
8 | 8 | <ul class="nav"> |
9 | 9 | <?php foreach ($name as $line => $namer) : ?> |
10 | - <li><?php echo anchor($docsDir . str_replace($docsExt, '', $line), $namer); ?></li> |
|
10 | + <li><?php echo anchor($docsDir.str_replace($docsExt, '', $line), $namer); ?></li> |
|
11 | 11 | <?php endforeach; ?> |
12 | 12 | </ul> |
13 | 13 | </li> |
14 | 14 | <?php else : ?> |
15 | - <li><?php echo anchor($docsDir . str_replace($docsExt, '', $file), $name); ?></li> |
|
15 | + <li><?php echo anchor($docsDir.str_replace($docsExt, '', $file), $name); ?></li> |
|
16 | 16 | <?php endif ?> |
17 | 17 | <?php endforeach ?> |
18 | 18 | <?php else : ?> |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | <div class='nav-header'><?php echo $module; ?></div> |
30 | 30 | <ul class='nav'> |
31 | 31 | <?php foreach ($mod_files as $fileName => $title) : ?> |
32 | - <li><?php echo anchor(site_url($docsDir . '/' . str_replace($docsExt, '', $fileName)), ucwords($title)); ?></li> |
|
32 | + <li><?php echo anchor(site_url($docsDir.'/'.str_replace($docsExt, '', $fileName)), ucwords($title)); ?></li> |
|
33 | 33 | <?php endforeach; ?> |
34 | 34 | </ul> |
35 | 35 | </li> |
36 | 36 | <?php else : ?> |
37 | - <li class='parent'><?php echo anchor(site_url($docsDir . '/' . str_replace($docsExt, '', $module)), ucwords(str_replace('_', ' ', $module))); ?></li> |
|
37 | + <li class='parent'><?php echo anchor(site_url($docsDir.'/'.str_replace($docsExt, '', $module)), ucwords(str_replace('_', ' ', $module))); ?></li> |
|
38 | 38 | <?php endif ?> |
39 | 39 | <?php endforeach ?> |
40 | 40 | <?php endif ?> |
@@ -11,12 +11,18 @@ discard block |
||
11 | 11 | <?php endforeach; ?> |
12 | 12 | </ul> |
13 | 13 | </li> |
14 | - <?php else : ?> |
|
15 | - <li><?php echo anchor($docsDir . str_replace($docsExt, '', $file), $name); ?></li> |
|
14 | + <?php else { |
|
15 | + : ?> |
|
16 | + <li><?php echo anchor($docsDir . str_replace($docsExt, '', $file), $name); |
|
17 | +} |
|
18 | +?></li> |
|
16 | 19 | <?php endif ?> |
17 | 20 | <?php endforeach ?> |
18 | - <?php else : ?> |
|
19 | - <p class="text-center"><?php echo lang('docs_not_found'); ?></p> |
|
21 | + <?php else { |
|
22 | + : ?> |
|
23 | + <p class="text-center"><?php echo lang('docs_not_found'); |
|
24 | +} |
|
25 | +?></p> |
|
20 | 26 | <?php endif ?> |
21 | 27 | |
22 | 28 | <?php if ( ! empty($module_docs) && is_array($module_docs)) : ?> |
@@ -33,8 +39,11 @@ discard block |
||
33 | 39 | <?php endforeach; ?> |
34 | 40 | </ul> |
35 | 41 | </li> |
36 | - <?php else : ?> |
|
37 | - <li class='parent'><?php echo anchor(site_url($docsDir . '/' . str_replace($docsExt, '', $module)), ucwords(str_replace('_', ' ', $module))); ?></li> |
|
42 | + <?php else { |
|
43 | + : ?> |
|
44 | + <li class='parent'><?php echo anchor(site_url($docsDir . '/' . str_replace($docsExt, '', $module)), ucwords(str_replace('_', ' ', $module))); |
|
45 | +} |
|
46 | +?></li> |
|
38 | 47 | <?php endif ?> |
39 | 48 | <?php endforeach ?> |
40 | 49 | <?php endif ?> |
@@ -2,15 +2,21 @@ |
||
2 | 2 | <div class="alert alert-info" style="margin-top: 40px;"> |
3 | 3 | <?php if (isset($notice)) : ?> |
4 | 4 | <?= $notice; ?> |
5 | - <?php else: ?> |
|
6 | - <?php echo lang('docs_not_found'); ?> |
|
5 | + <?php else { |
|
6 | + : ?> |
|
7 | + <?php echo lang('docs_not_found'); |
|
8 | +} |
|
9 | +?> |
|
7 | 10 | <?php endif; ?> |
8 | 11 | </div> |
9 | 12 | |
10 | -<?php else: ?> |
|
13 | +<?php else { |
|
14 | + : ?> |
|
11 | 15 | |
12 | 16 | <div class="page"> |
13 | - <?php echo $content; ?> |
|
17 | + <?php echo $content; |
|
18 | +} |
|
19 | +?> |
|
14 | 20 | </div> |
15 | 21 | |
16 | 22 | <?php endif; ?> |
@@ -2,7 +2,7 @@ |
||
2 | 2 | <h1><?php echo lang('docs_search_results') ?></h1> |
3 | 3 | |
4 | 4 | <div class="well"> |
5 | - <?php echo form_open( current_url(), 'class="form-inline"'); ?> |
|
5 | + <?php echo form_open(current_url(), 'class="form-inline"'); ?> |
|
6 | 6 | <input type="text" name="search_terms" class="form-control" style="width: 85%" value="<?php echo set_value('search_terms', $search_terms) ?>" /> |
7 | 7 | <input type="submit" name="submit" class="btn btn-primary" value="<?php echo lang('docs_search'); ?>"/> |
8 | 8 | <?php echo form_close(); ?> |
@@ -24,10 +24,13 @@ |
||
24 | 24 | </div> |
25 | 25 | <?php endforeach; ?> |
26 | 26 | |
27 | -<?php else: ?> |
|
27 | +<?php else { |
|
28 | + : ?> |
|
28 | 29 | |
29 | 30 | <div class="alert alert-info"> |
30 | - <?php echo sprintf(lang('docs_no_results'), $search_terms); ?> |
|
31 | + <?php echo sprintf(lang('docs_no_results'), $search_terms); |
|
32 | +} |
|
33 | +?> |
|
31 | 34 | </div> |
32 | 35 | |
33 | 36 | <?php endif; ?> |
@@ -34,133 +34,133 @@ discard block |
||
34 | 34 | |
35 | 35 | class Forge extends \Myth\Controllers\CLIController { |
36 | 36 | |
37 | - public function __construct() |
|
38 | - { |
|
39 | - parent::__construct(); |
|
37 | + public function __construct() |
|
38 | + { |
|
39 | + parent::__construct(); |
|
40 | 40 | |
41 | - $this->load->config('forge'); |
|
42 | - } |
|
41 | + $this->load->config('forge'); |
|
42 | + } |
|
43 | 43 | |
44 | - //-------------------------------------------------------------------- |
|
44 | + //-------------------------------------------------------------------- |
|
45 | 45 | |
46 | 46 | |
47 | - public function _remap($method, $params) |
|
48 | - { |
|
49 | - if (method_exists($this, $method)) |
|
50 | - { |
|
51 | - call_user_func_array( [$this, $method], $params); |
|
52 | - } |
|
53 | - else |
|
54 | - { |
|
55 | - $params = array_merge([CLI::cli_string()], $params); |
|
47 | + public function _remap($method, $params) |
|
48 | + { |
|
49 | + if (method_exists($this, $method)) |
|
50 | + { |
|
51 | + call_user_func_array( [$this, $method], $params); |
|
52 | + } |
|
53 | + else |
|
54 | + { |
|
55 | + $params = array_merge([CLI::cli_string()], $params); |
|
56 | 56 | |
57 | - call_user_func_array( [$this, 'run'], $params); |
|
58 | - } |
|
59 | - } |
|
57 | + call_user_func_array( [$this, 'run'], $params); |
|
58 | + } |
|
59 | + } |
|
60 | 60 | |
61 | - //-------------------------------------------------------------------- |
|
62 | - |
|
63 | - /** |
|
64 | - * Overrides to implement dynamic description building based on |
|
65 | - * scanning the collections and grabbing the information from |
|
66 | - * 'forge.php' files. |
|
67 | - */ |
|
68 | - public function index() |
|
69 | - { |
|
70 | - $collections = config_item('forge.collections'); |
|
71 | - |
|
72 | - if (! is_array($collections) || ! count($collections) ) |
|
73 | - { |
|
74 | - return CLI::error('No generator collections found.'); |
|
75 | - } |
|
76 | - |
|
77 | - // We loop through each collection scanning |
|
78 | - // for any generator folders that have a |
|
79 | - // 'forge.php' file. For each one found |
|
80 | - // we build out another section in our help commands |
|
81 | - foreach ($collections as $alias => $path) |
|
82 | - { |
|
83 | - $path = rtrim($path, '/ ') .'/'; |
|
84 | - $folders = scandir($path); |
|
85 | - |
|
86 | - $_descriptions = []; |
|
87 | - |
|
88 | - foreach ($folders as $dir) |
|
89 | - { |
|
90 | - if ($dir == '.' || $dir == '..' || ! is_file($path . $dir .'/forge.php')) |
|
91 | - { |
|
92 | - continue; |
|
93 | - } |
|
94 | - |
|
95 | - include $path . $dir .'/forge.php'; |
|
96 | - |
|
97 | - // Don't have valid arrays to work with? Move along... |
|
98 | - if (! isset($descriptions)) |
|
99 | - { |
|
100 | - log_message('debug', '[Forge] Invalid forge.php file at: '. $path . $dir .'/forge.php'); |
|
101 | - continue; |
|
102 | - } |
|
103 | - |
|
104 | - $_descriptions = array_merge($descriptions, $_descriptions); |
|
105 | - } |
|
106 | - |
|
107 | - ksort($_descriptions); |
|
108 | - |
|
109 | - CLI::new_line(); |
|
110 | - CLI::write(ucwords( str_replace('_', ' ', $alias)) .' Collection'); |
|
111 | - $this->sayDescriptions($_descriptions); |
|
112 | - } |
|
113 | - } |
|
114 | - |
|
115 | - //-------------------------------------------------------------------- |
|
116 | - |
|
117 | - /** |
|
118 | - * The primary method that calls the correct generator and |
|
119 | - * makes it run. |
|
120 | - */ |
|
121 | - public function run($command) |
|
122 | - { |
|
123 | - $quiet = false; |
|
124 | - |
|
125 | - $segments = explode(" ", $command); |
|
126 | - |
|
127 | - // Get rid of the 'forge' command |
|
128 | - if ($segments[0] == 'forge') { |
|
129 | - array_shift( $segments ); |
|
130 | - } |
|
131 | - |
|
132 | - $command = trim(str_ireplace("forge", '', array_shift($segments))); |
|
61 | + //-------------------------------------------------------------------- |
|
62 | + |
|
63 | + /** |
|
64 | + * Overrides to implement dynamic description building based on |
|
65 | + * scanning the collections and grabbing the information from |
|
66 | + * 'forge.php' files. |
|
67 | + */ |
|
68 | + public function index() |
|
69 | + { |
|
70 | + $collections = config_item('forge.collections'); |
|
71 | + |
|
72 | + if (! is_array($collections) || ! count($collections) ) |
|
73 | + { |
|
74 | + return CLI::error('No generator collections found.'); |
|
75 | + } |
|
76 | + |
|
77 | + // We loop through each collection scanning |
|
78 | + // for any generator folders that have a |
|
79 | + // 'forge.php' file. For each one found |
|
80 | + // we build out another section in our help commands |
|
81 | + foreach ($collections as $alias => $path) |
|
82 | + { |
|
83 | + $path = rtrim($path, '/ ') .'/'; |
|
84 | + $folders = scandir($path); |
|
85 | + |
|
86 | + $_descriptions = []; |
|
87 | + |
|
88 | + foreach ($folders as $dir) |
|
89 | + { |
|
90 | + if ($dir == '.' || $dir == '..' || ! is_file($path . $dir .'/forge.php')) |
|
91 | + { |
|
92 | + continue; |
|
93 | + } |
|
94 | + |
|
95 | + include $path . $dir .'/forge.php'; |
|
96 | + |
|
97 | + // Don't have valid arrays to work with? Move along... |
|
98 | + if (! isset($descriptions)) |
|
99 | + { |
|
100 | + log_message('debug', '[Forge] Invalid forge.php file at: '. $path . $dir .'/forge.php'); |
|
101 | + continue; |
|
102 | + } |
|
103 | + |
|
104 | + $_descriptions = array_merge($descriptions, $_descriptions); |
|
105 | + } |
|
106 | + |
|
107 | + ksort($_descriptions); |
|
108 | + |
|
109 | + CLI::new_line(); |
|
110 | + CLI::write(ucwords( str_replace('_', ' ', $alias)) .' Collection'); |
|
111 | + $this->sayDescriptions($_descriptions); |
|
112 | + } |
|
113 | + } |
|
114 | + |
|
115 | + //-------------------------------------------------------------------- |
|
116 | + |
|
117 | + /** |
|
118 | + * The primary method that calls the correct generator and |
|
119 | + * makes it run. |
|
120 | + */ |
|
121 | + public function run($command) |
|
122 | + { |
|
123 | + $quiet = false; |
|
124 | + |
|
125 | + $segments = explode(" ", $command); |
|
126 | + |
|
127 | + // Get rid of the 'forge' command |
|
128 | + if ($segments[0] == 'forge') { |
|
129 | + array_shift( $segments ); |
|
130 | + } |
|
131 | + |
|
132 | + $command = trim(str_ireplace("forge", '', array_shift($segments))); |
|
133 | 133 | |
134 | 134 | $dir = $this->locateGenerator($command); |
135 | 135 | |
136 | 136 | $class_name = ucfirst($command) .'Generator'; |
137 | 137 | |
138 | - if (! file_exists($dir . $class_name .'.php')) |
|
139 | - { |
|
140 | - return CLI::error("Generator file not found for: {$class_name}"); |
|
141 | - } |
|
138 | + if (! file_exists($dir . $class_name .'.php')) |
|
139 | + { |
|
140 | + return CLI::error("Generator file not found for: {$class_name}"); |
|
141 | + } |
|
142 | 142 | |
143 | 143 | require_once $dir . $class_name .'.php'; |
144 | 144 | |
145 | - if (! class_exists($class_name, false)) |
|
146 | - { |
|
147 | - return CLI::error("No class `{$class_name}` found in generator file."); |
|
148 | - } |
|
145 | + if (! class_exists($class_name, false)) |
|
146 | + { |
|
147 | + return CLI::error("No class `{$class_name}` found in generator file."); |
|
148 | + } |
|
149 | 149 | |
150 | - // Should we run the process quietly? |
|
151 | - if ( (CLI::option('q') || CLI::option('quiet'))) |
|
152 | - { |
|
153 | - $quiet = true; |
|
154 | - } |
|
150 | + // Should we run the process quietly? |
|
151 | + if ( (CLI::option('q') || CLI::option('quiet'))) |
|
152 | + { |
|
153 | + $quiet = true; |
|
154 | + } |
|
155 | 155 | |
156 | - CLI::write('Invoked '. CLI::color($class_name, 'yellow')); |
|
156 | + CLI::write('Invoked '. CLI::color($class_name, 'yellow')); |
|
157 | 157 | |
158 | 158 | $class = new $class_name(); |
159 | 159 | |
160 | - $class->run( $segments, $quiet ); |
|
161 | - } |
|
160 | + $class->run( $segments, $quiet ); |
|
161 | + } |
|
162 | 162 | |
163 | - //-------------------------------------------------------------------- |
|
163 | + //-------------------------------------------------------------------- |
|
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Displays the readme file for a generator if it exists. |
@@ -205,67 +205,67 @@ discard block |
||
205 | 205 | //-------------------------------------------------------------------- |
206 | 206 | |
207 | 207 | |
208 | - /** |
|
209 | - * Overrides CLIController's version to support searching our |
|
210 | - * collections for the help description. |
|
211 | - * |
|
212 | - * @param null $method |
|
213 | - */ |
|
214 | - public function longDescribeMethod($method=null) |
|
215 | - { |
|
216 | - $collections = config_item('forge.collections'); |
|
217 | - |
|
218 | - if (! is_array($collections) || ! count($collections) ) |
|
219 | - { |
|
220 | - return CLI::error('No generator collections found.'); |
|
221 | - } |
|
222 | - |
|
223 | - // We loop through each collection scanning |
|
224 | - // for any generator folders that have a |
|
225 | - // 'forge.php' file. For each one found |
|
226 | - // we build out another section in our help commands |
|
227 | - foreach ($collections as $alias => $path) |
|
228 | - { |
|
229 | - |
|
230 | - $path = rtrim($path, '/ ') .'/'; |
|
231 | - $folders = scandir($path); |
|
232 | - |
|
233 | - if (! $i = array_search(ucfirst($method), $folders)) |
|
234 | - { |
|
235 | - continue; |
|
236 | - } |
|
237 | - |
|
238 | - $dir = $path . $folders[$i] .'/'; |
|
239 | - |
|
240 | - if (! is_file($dir .'/forge.php')) |
|
241 | - { |
|
242 | - CLI::error("The {$method} command does not have any cli help available."); |
|
243 | - } |
|
244 | - |
|
245 | - include $dir .'/forge.php'; |
|
246 | - |
|
247 | - // Don't have valid arrays to work with? Move along... |
|
248 | - if (! isset($long_description)) |
|
249 | - { |
|
250 | - log_message('debug', '[Forge] Invalid forge.php file at: '. $dir .'/forge.php'); |
|
251 | - continue; |
|
252 | - } |
|
253 | - |
|
254 | - if (empty($long_description)) |
|
255 | - { |
|
256 | - return CLI::error("The {$method} command does not have an cli help available."); |
|
257 | - } |
|
258 | - |
|
259 | - CLI::new_line(); |
|
260 | - CLI::write( CLI::color(ucfirst($method) .' Help', 'yellow') ); |
|
261 | - return CLI::write( CLI::wrap($long_description, CLI::getWidth()) ); |
|
262 | - } |
|
263 | - |
|
264 | - // Still here? |
|
265 | - CLI::error("No help found for command: {$method}"); |
|
266 | - } |
|
267 | - |
|
268 | - //-------------------------------------------------------------------- |
|
208 | + /** |
|
209 | + * Overrides CLIController's version to support searching our |
|
210 | + * collections for the help description. |
|
211 | + * |
|
212 | + * @param null $method |
|
213 | + */ |
|
214 | + public function longDescribeMethod($method=null) |
|
215 | + { |
|
216 | + $collections = config_item('forge.collections'); |
|
217 | + |
|
218 | + if (! is_array($collections) || ! count($collections) ) |
|
219 | + { |
|
220 | + return CLI::error('No generator collections found.'); |
|
221 | + } |
|
222 | + |
|
223 | + // We loop through each collection scanning |
|
224 | + // for any generator folders that have a |
|
225 | + // 'forge.php' file. For each one found |
|
226 | + // we build out another section in our help commands |
|
227 | + foreach ($collections as $alias => $path) |
|
228 | + { |
|
229 | + |
|
230 | + $path = rtrim($path, '/ ') .'/'; |
|
231 | + $folders = scandir($path); |
|
232 | + |
|
233 | + if (! $i = array_search(ucfirst($method), $folders)) |
|
234 | + { |
|
235 | + continue; |
|
236 | + } |
|
237 | + |
|
238 | + $dir = $path . $folders[$i] .'/'; |
|
239 | + |
|
240 | + if (! is_file($dir .'/forge.php')) |
|
241 | + { |
|
242 | + CLI::error("The {$method} command does not have any cli help available."); |
|
243 | + } |
|
244 | + |
|
245 | + include $dir .'/forge.php'; |
|
246 | + |
|
247 | + // Don't have valid arrays to work with? Move along... |
|
248 | + if (! isset($long_description)) |
|
249 | + { |
|
250 | + log_message('debug', '[Forge] Invalid forge.php file at: '. $dir .'/forge.php'); |
|
251 | + continue; |
|
252 | + } |
|
253 | + |
|
254 | + if (empty($long_description)) |
|
255 | + { |
|
256 | + return CLI::error("The {$method} command does not have an cli help available."); |
|
257 | + } |
|
258 | + |
|
259 | + CLI::new_line(); |
|
260 | + CLI::write( CLI::color(ucfirst($method) .' Help', 'yellow') ); |
|
261 | + return CLI::write( CLI::wrap($long_description, CLI::getWidth()) ); |
|
262 | + } |
|
263 | + |
|
264 | + // Still here? |
|
265 | + CLI::error("No help found for command: {$method}"); |
|
266 | + } |
|
267 | + |
|
268 | + //-------------------------------------------------------------------- |
|
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Scans through the collections for the folder for this generator. |
@@ -48,13 +48,13 @@ discard block |
||
48 | 48 | { |
49 | 49 | if (method_exists($this, $method)) |
50 | 50 | { |
51 | - call_user_func_array( [$this, $method], $params); |
|
51 | + call_user_func_array([$this, $method], $params); |
|
52 | 52 | } |
53 | 53 | else |
54 | 54 | { |
55 | 55 | $params = array_merge([CLI::cli_string()], $params); |
56 | 56 | |
57 | - call_user_func_array( [$this, 'run'], $params); |
|
57 | + call_user_func_array([$this, 'run'], $params); |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $collections = config_item('forge.collections'); |
71 | 71 | |
72 | - if (! is_array($collections) || ! count($collections) ) |
|
72 | + if ( ! is_array($collections) || ! count($collections)) |
|
73 | 73 | { |
74 | 74 | return CLI::error('No generator collections found.'); |
75 | 75 | } |
@@ -80,24 +80,24 @@ discard block |
||
80 | 80 | // we build out another section in our help commands |
81 | 81 | foreach ($collections as $alias => $path) |
82 | 82 | { |
83 | - $path = rtrim($path, '/ ') .'/'; |
|
83 | + $path = rtrim($path, '/ ').'/'; |
|
84 | 84 | $folders = scandir($path); |
85 | 85 | |
86 | 86 | $_descriptions = []; |
87 | 87 | |
88 | 88 | foreach ($folders as $dir) |
89 | 89 | { |
90 | - if ($dir == '.' || $dir == '..' || ! is_file($path . $dir .'/forge.php')) |
|
90 | + if ($dir == '.' || $dir == '..' || ! is_file($path.$dir.'/forge.php')) |
|
91 | 91 | { |
92 | 92 | continue; |
93 | 93 | } |
94 | 94 | |
95 | - include $path . $dir .'/forge.php'; |
|
95 | + include $path.$dir.'/forge.php'; |
|
96 | 96 | |
97 | 97 | // Don't have valid arrays to work with? Move along... |
98 | - if (! isset($descriptions)) |
|
98 | + if ( ! isset($descriptions)) |
|
99 | 99 | { |
100 | - log_message('debug', '[Forge] Invalid forge.php file at: '. $path . $dir .'/forge.php'); |
|
100 | + log_message('debug', '[Forge] Invalid forge.php file at: '.$path.$dir.'/forge.php'); |
|
101 | 101 | continue; |
102 | 102 | } |
103 | 103 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ksort($_descriptions); |
108 | 108 | |
109 | 109 | CLI::new_line(); |
110 | - CLI::write(ucwords( str_replace('_', ' ', $alias)) .' Collection'); |
|
110 | + CLI::write(ucwords(str_replace('_', ' ', $alias)).' Collection'); |
|
111 | 111 | $this->sayDescriptions($_descriptions); |
112 | 112 | } |
113 | 113 | } |
@@ -126,38 +126,38 @@ discard block |
||
126 | 126 | |
127 | 127 | // Get rid of the 'forge' command |
128 | 128 | if ($segments[0] == 'forge') { |
129 | - array_shift( $segments ); |
|
129 | + array_shift($segments); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | $command = trim(str_ireplace("forge", '', array_shift($segments))); |
133 | 133 | |
134 | 134 | $dir = $this->locateGenerator($command); |
135 | 135 | |
136 | - $class_name = ucfirst($command) .'Generator'; |
|
136 | + $class_name = ucfirst($command).'Generator'; |
|
137 | 137 | |
138 | - if (! file_exists($dir . $class_name .'.php')) |
|
138 | + if ( ! file_exists($dir.$class_name.'.php')) |
|
139 | 139 | { |
140 | 140 | return CLI::error("Generator file not found for: {$class_name}"); |
141 | 141 | } |
142 | 142 | |
143 | - require_once $dir . $class_name .'.php'; |
|
143 | + require_once $dir.$class_name.'.php'; |
|
144 | 144 | |
145 | - if (! class_exists($class_name, false)) |
|
145 | + if ( ! class_exists($class_name, false)) |
|
146 | 146 | { |
147 | 147 | return CLI::error("No class `{$class_name}` found in generator file."); |
148 | 148 | } |
149 | 149 | |
150 | 150 | // Should we run the process quietly? |
151 | - if ( (CLI::option('q') || CLI::option('quiet'))) |
|
151 | + if ((CLI::option('q') || CLI::option('quiet'))) |
|
152 | 152 | { |
153 | 153 | $quiet = true; |
154 | 154 | } |
155 | 155 | |
156 | - CLI::write('Invoked '. CLI::color($class_name, 'yellow')); |
|
156 | + CLI::write('Invoked '.CLI::color($class_name, 'yellow')); |
|
157 | 157 | |
158 | 158 | $class = new $class_name(); |
159 | 159 | |
160 | - $class->run( $segments, $quiet ); |
|
160 | + $class->run($segments, $quiet); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | //-------------------------------------------------------------------- |
@@ -171,20 +171,20 @@ discard block |
||
171 | 171 | { |
172 | 172 | $dir = $this->locateGenerator($command); |
173 | 173 | |
174 | - if (! is_file($dir .'readme.txt')) |
|
174 | + if ( ! is_file($dir.'readme.txt')) |
|
175 | 175 | { |
176 | 176 | return CLI::error('Unable to locate the readme.txt file.'); |
177 | 177 | } |
178 | 178 | |
179 | - $lines = file($dir .'readme.txt'); |
|
179 | + $lines = file($dir.'readme.txt'); |
|
180 | 180 | |
181 | - if (! is_array($lines) || ! count($lines)) |
|
181 | + if ( ! is_array($lines) || ! count($lines)) |
|
182 | 182 | { |
183 | 183 | return CLI::error('The readme file does not have anything to display.'); |
184 | 184 | } |
185 | 185 | |
186 | 186 | $line_count = 0; // Total we're currently viewing. |
187 | - $max_rows = CLI::getHeight() -3; |
|
187 | + $max_rows = CLI::getHeight() - 3; |
|
188 | 188 | |
189 | 189 | foreach ($lines as $line) |
190 | 190 | { |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | * |
212 | 212 | * @param null $method |
213 | 213 | */ |
214 | - public function longDescribeMethod($method=null) |
|
214 | + public function longDescribeMethod($method = null) |
|
215 | 215 | { |
216 | 216 | $collections = config_item('forge.collections'); |
217 | 217 | |
218 | - if (! is_array($collections) || ! count($collections) ) |
|
218 | + if ( ! is_array($collections) || ! count($collections)) |
|
219 | 219 | { |
220 | 220 | return CLI::error('No generator collections found.'); |
221 | 221 | } |
@@ -227,27 +227,27 @@ discard block |
||
227 | 227 | foreach ($collections as $alias => $path) |
228 | 228 | { |
229 | 229 | |
230 | - $path = rtrim($path, '/ ') .'/'; |
|
230 | + $path = rtrim($path, '/ ').'/'; |
|
231 | 231 | $folders = scandir($path); |
232 | 232 | |
233 | - if (! $i = array_search(ucfirst($method), $folders)) |
|
233 | + if ( ! $i = array_search(ucfirst($method), $folders)) |
|
234 | 234 | { |
235 | 235 | continue; |
236 | 236 | } |
237 | 237 | |
238 | - $dir = $path . $folders[$i] .'/'; |
|
238 | + $dir = $path.$folders[$i].'/'; |
|
239 | 239 | |
240 | - if (! is_file($dir .'/forge.php')) |
|
240 | + if ( ! is_file($dir.'/forge.php')) |
|
241 | 241 | { |
242 | 242 | CLI::error("The {$method} command does not have any cli help available."); |
243 | 243 | } |
244 | 244 | |
245 | - include $dir .'/forge.php'; |
|
245 | + include $dir.'/forge.php'; |
|
246 | 246 | |
247 | 247 | // Don't have valid arrays to work with? Move along... |
248 | - if (! isset($long_description)) |
|
248 | + if ( ! isset($long_description)) |
|
249 | 249 | { |
250 | - log_message('debug', '[Forge] Invalid forge.php file at: '. $dir .'/forge.php'); |
|
250 | + log_message('debug', '[Forge] Invalid forge.php file at: '.$dir.'/forge.php'); |
|
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | CLI::new_line(); |
260 | - CLI::write( CLI::color(ucfirst($method) .' Help', 'yellow') ); |
|
261 | - return CLI::write( CLI::wrap($long_description, CLI::getWidth()) ); |
|
260 | + CLI::write(CLI::color(ucfirst($method).' Help', 'yellow')); |
|
261 | + return CLI::write(CLI::wrap($long_description, CLI::getWidth())); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | // Still here? |
@@ -278,22 +278,22 @@ discard block |
||
278 | 278 | { |
279 | 279 | $collections = config_item('forge.collections'); |
280 | 280 | |
281 | - if (! is_array($collections) || ! count($collections) ) |
|
281 | + if ( ! is_array($collections) || ! count($collections)) |
|
282 | 282 | { |
283 | 283 | return CLI::error('No generator collections found.'); |
284 | 284 | } |
285 | 285 | |
286 | 286 | foreach ($collections as $alias => $path) |
287 | 287 | { |
288 | - $path = rtrim($path, '/ ') .'/'; |
|
288 | + $path = rtrim($path, '/ ').'/'; |
|
289 | 289 | $folders = scandir($path); |
290 | 290 | |
291 | - if (! $i = array_search(ucfirst($name), $folders)) |
|
291 | + if ( ! $i = array_search(ucfirst($name), $folders)) |
|
292 | 292 | { |
293 | 293 | continue; |
294 | 294 | } |
295 | 295 | |
296 | - return $path . $folders[$i] .'/'; |
|
296 | + return $path.$folders[$i].'/'; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | return null; |
@@ -253,8 +253,7 @@ |
||
253 | 253 | { |
254 | 254 | $this->vars[$k] = $escape ? esc($v, $context, $this->escaper) : $v; |
255 | 255 | } |
256 | - } |
|
257 | - else |
|
256 | + } else |
|
258 | 257 | { |
259 | 258 | $this->vars[$name] = $escape ? esc($value, $context, $this->escaper) : $value; |
260 | 259 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | { |
101 | 101 | parent::__construct(); |
102 | 102 | |
103 | - $this->load->library('session'); |
|
103 | + $this->load->library('session'); |
|
104 | 104 | |
105 | 105 | $this->setupCache(); |
106 | 106 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | } |
237 | 237 | |
238 | 238 | $this->output->enable_profiler( FALSE ) |
239 | - ->set_content_type( 'text/plain' ) |
|
240 | - ->set_output( $text ); |
|
239 | + ->set_content_type( 'text/plain' ) |
|
240 | + ->set_output( $text ); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | //-------------------------------------------------------------------- |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | $this->output->enable_profiler( FALSE ) |
270 | - ->set_content_type( 'application/json' ) |
|
271 | - ->set_output( json_encode( $json ) ); |
|
270 | + ->set_content_type( 'application/json' ) |
|
271 | + ->set_output( json_encode( $json ) ); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | //-------------------------------------------------------------------- |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | $this->output->enable_profiler( FALSE ) |
295 | - ->set_content_type( 'application/x-javascript' ) |
|
296 | - ->set_output( $js ); |
|
295 | + ->set_content_type( 'application/x-javascript' ) |
|
296 | + ->set_output( $js ); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | //-------------------------------------------------------------------- |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | |
33 | 33 | /* PHP5 spl_autoload */ |
34 | -spl_autoload_register( '\Myth\Modules::autoload' ); |
|
34 | +spl_autoload_register('\Myth\Modules::autoload'); |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * The following properties are used to provide autocomplete for IDE's. |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $this->setupProfiler(); |
112 | 112 | |
113 | - log_message( 'debug', get_class( $this ) . ' controller loaded.' ); |
|
113 | + log_message('debug', get_class($this).' controller loaded.'); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | //-------------------------------------------------------------------- |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | { |
132 | 132 | // If the controller doesn't override cache type, grab the values from |
133 | 133 | // the defaults set in the start file. |
134 | - if ( empty( $this->cache_type ) ) |
|
134 | + if (empty($this->cache_type)) |
|
135 | 135 | { |
136 | - $this->cache_type = $this->config->item( 'cache_type' ); |
|
136 | + $this->cache_type = $this->config->item('cache_type'); |
|
137 | 137 | } |
138 | - if ( empty( $this->backup_cache ) ) |
|
138 | + if (empty($this->backup_cache)) |
|
139 | 139 | { |
140 | - $this->backup_cache = $this->config->item( 'backup_cache_type' ); |
|
140 | + $this->backup_cache = $this->config->item('backup_cache_type'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | // Make sure that caching is ALWAYS available throughout the app |
144 | 144 | // though it defaults to 'dummy' which won't actually cache. |
145 | - $this->load->driver( 'cache', array( 'adapter' => $this->cache_type, 'backup' => $this->backup_cache ) ); |
|
145 | + $this->load->driver('cache', array('adapter' => $this->cache_type, 'backup' => $this->backup_cache)); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | //-------------------------------------------------------------------- |
@@ -153,15 +153,15 @@ discard block |
||
153 | 153 | */ |
154 | 154 | protected function autoload() |
155 | 155 | { |
156 | - if ( ! is_null( $this->language_file ) ) |
|
156 | + if ( ! is_null($this->language_file)) |
|
157 | 157 | { |
158 | - $this->lang->load( $this->language_file ); |
|
158 | + $this->lang->load($this->language_file); |
|
159 | 159 | } |
160 | 160 | |
161 | - if ( ! is_null( $this->model_file ) ) |
|
161 | + if ( ! is_null($this->model_file)) |
|
162 | 162 | { |
163 | 163 | $this->load->database(); |
164 | - $this->load->model( $this->model_file ); |
|
164 | + $this->load->model($this->model_file); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | */ |
174 | 174 | protected function autoMigrate() |
175 | 175 | { |
176 | - $migrations = config_item( 'auto_migrate' ); |
|
176 | + $migrations = config_item('auto_migrate'); |
|
177 | 177 | |
178 | - if ( ! is_array( $migrations ) || ! count( $migrations ) ) |
|
178 | + if ( ! is_array($migrations) || ! count($migrations)) |
|
179 | 179 | { |
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | - $this->load->library( 'migration' ); |
|
183 | + $this->load->library('migration'); |
|
184 | 184 | |
185 | 185 | // Run all of our migrations for each group. |
186 | - foreach ( $migrations as $group ) |
|
186 | + foreach ($migrations as $group) |
|
187 | 187 | { |
188 | - $this->migration->latest( $group ); |
|
188 | + $this->migration->latest($group); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
@@ -199,9 +199,9 @@ discard block |
||
199 | 199 | // The profiler is dealt with twice so that we can set |
200 | 200 | // things up to work correctly in AJAX methods using $this->render_json |
201 | 201 | // and it's cousins. |
202 | - if ( $this->config->item( 'show_profiler' ) == TRUE ) |
|
202 | + if ($this->config->item('show_profiler') == TRUE) |
|
203 | 203 | { |
204 | - $this->output->enable_profiler( TRUE ); |
|
204 | + $this->output->enable_profiler(TRUE); |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | |
@@ -223,21 +223,21 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return void [type] [description] |
225 | 225 | */ |
226 | - public function renderText( $text, $typography = FALSE ) |
|
226 | + public function renderText($text, $typography = FALSE) |
|
227 | 227 | { |
228 | 228 | // Note that, for now anyway, we don't do any cleaning of the text |
229 | 229 | // and leave that up to the client to take care of. |
230 | 230 | |
231 | 231 | // However, we can auto_typogrify the text if we're asked nicely. |
232 | - if ( $typography === TRUE ) |
|
232 | + if ($typography === TRUE) |
|
233 | 233 | { |
234 | - $this->load->helper( 'typography' ); |
|
235 | - $text = auto_typography( $text ); |
|
234 | + $this->load->helper('typography'); |
|
235 | + $text = auto_typography($text); |
|
236 | 236 | } |
237 | 237 | |
238 | - $this->output->enable_profiler( FALSE ) |
|
239 | - ->set_content_type( 'text/plain' ) |
|
240 | - ->set_output( $text ); |
|
238 | + $this->output->enable_profiler(FALSE) |
|
239 | + ->set_content_type('text/plain') |
|
240 | + ->set_output($text); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | //-------------------------------------------------------------------- |
@@ -253,22 +253,22 @@ discard block |
||
253 | 253 | * @throws RenderException |
254 | 254 | * @return void |
255 | 255 | */ |
256 | - public function renderJSON( $json ) |
|
256 | + public function renderJSON($json) |
|
257 | 257 | { |
258 | - if ( is_resource( $json ) ) |
|
258 | + if (is_resource($json)) |
|
259 | 259 | { |
260 | - throw new \RuntimeException( lang('bad_json_encode') ); |
|
260 | + throw new \RuntimeException(lang('bad_json_encode')); |
|
261 | 261 | } |
262 | 262 | |
263 | - if ( $this->config->item( 'show_profiler' ) ) |
|
263 | + if ($this->config->item('show_profiler')) |
|
264 | 264 | { |
265 | - $this->load->library( 'profiler' ); |
|
265 | + $this->load->library('profiler'); |
|
266 | 266 | $json['#sprint-profiler'] = $this->profiler->run(); |
267 | 267 | } |
268 | 268 | |
269 | - $this->output->enable_profiler( FALSE ) |
|
270 | - ->set_content_type( 'application/json' ) |
|
271 | - ->set_output( json_encode( $json ) ); |
|
269 | + $this->output->enable_profiler(FALSE) |
|
270 | + ->set_content_type('application/json') |
|
271 | + ->set_output(json_encode($json)); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | //-------------------------------------------------------------------- |
@@ -284,16 +284,16 @@ discard block |
||
284 | 284 | * @throws RenderException |
285 | 285 | * @return void |
286 | 286 | */ |
287 | - public function renderJS( $js = NULL ) |
|
287 | + public function renderJS($js = NULL) |
|
288 | 288 | { |
289 | - if ( ! is_string( $js ) ) |
|
289 | + if ( ! is_string($js)) |
|
290 | 290 | { |
291 | - throw new \RuntimeException( lang('bad_javascript') ); |
|
291 | + throw new \RuntimeException(lang('bad_javascript')); |
|
292 | 292 | } |
293 | 293 | |
294 | - $this->output->enable_profiler( FALSE ) |
|
295 | - ->set_content_type( 'application/x-javascript' ) |
|
296 | - ->set_output( $js ); |
|
294 | + $this->output->enable_profiler(FALSE) |
|
295 | + ->set_content_type('application/x-javascript') |
|
296 | + ->set_output($js); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | //-------------------------------------------------------------------- |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | */ |
309 | 309 | public function renderRealtime() |
310 | 310 | { |
311 | - if ( ob_get_level() > 0 ) |
|
311 | + if (ob_get_level() > 0) |
|
312 | 312 | { |
313 | 313 | end_end_flush(); |
314 | 314 | } |
315 | - ob_implicit_flush( TRUE ); |
|
315 | + ob_implicit_flush(TRUE); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | //-------------------------------------------------------------------- |
@@ -326,21 +326,21 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @param string $location [description] |
328 | 328 | */ |
329 | - public function ajaxRedirect( $location = '' ) |
|
329 | + public function ajaxRedirect($location = '') |
|
330 | 330 | { |
331 | - $location = empty( $location ) ? '/' : $location; |
|
331 | + $location = empty($location) ? '/' : $location; |
|
332 | 332 | |
333 | - if ( strpos( $location, '/' ) !== 0 || strpos( $location, '://' ) !== FALSE ) |
|
333 | + if (strpos($location, '/') !== 0 || strpos($location, '://') !== FALSE) |
|
334 | 334 | { |
335 | - if ( ! function_exists( 'site_url' ) ) |
|
335 | + if ( ! function_exists('site_url')) |
|
336 | 336 | { |
337 | - $this->load->helper( 'url' ); |
|
337 | + $this->load->helper('url'); |
|
338 | 338 | } |
339 | 339 | |
340 | - $location = site_url( $location ); |
|
340 | + $location = site_url($location); |
|
341 | 341 | } |
342 | 342 | |
343 | - $this->render_json( array( 'location' => $location ) ); |
|
343 | + $this->render_json(array('location' => $location)); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | //-------------------------------------------------------------------- |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @return mixed The formatted JSON data, or NULL. |
357 | 357 | */ |
358 | - public function getJSON( $format = 'object', $depth = 512 ) |
|
358 | + public function getJSON($format = 'object', $depth = 512) |
|
359 | 359 | { |
360 | 360 | $as_array = $format == 'array' ? TRUE : FALSE; |
361 | 361 | |
362 | - return json_decode( file_get_contents( 'php://input' ), $as_array, $depth ); |
|
362 | + return json_decode(file_get_contents('php://input'), $as_array, $depth); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | //-------------------------------------------------------------------- |
@@ -41,144 +41,144 @@ |
||
41 | 41 | */ |
42 | 42 | class CLIController extends \CI_Controller { |
43 | 43 | |
44 | - /** |
|
45 | - * Holds short descriptions for the public functions in this class. |
|
46 | - * Each 'key' in the array should match the function name. |
|
47 | - * |
|
48 | - * @var array |
|
49 | - */ |
|
50 | - protected $descriptions = []; |
|
51 | - |
|
52 | - /** |
|
53 | - * Holds long descriptions for the public functions in this class. |
|
54 | - * Each 'key' in the array should match the function name. |
|
55 | - * @var array |
|
56 | - */ |
|
57 | - protected $long_descriptions = []; |
|
58 | - |
|
59 | - //-------------------------------------------------------------------- |
|
60 | - |
|
61 | - /** |
|
62 | - * Ensures that we are running on the CLI, and collects basic settings |
|
63 | - * like collecting our command line arguments into a pretty array. |
|
64 | - */ |
|
65 | - public function __construct() |
|
66 | - { |
|
67 | - parent::__construct(); |
|
68 | - |
|
69 | - // Restrict usage to the command line. |
|
70 | - if (! is_cli() ) |
|
71 | - { |
|
72 | - show_error( lang('cli_required') ); |
|
73 | - } |
|
74 | - |
|
75 | - // Make sure the CLI library is loaded and ready. |
|
44 | + /** |
|
45 | + * Holds short descriptions for the public functions in this class. |
|
46 | + * Each 'key' in the array should match the function name. |
|
47 | + * |
|
48 | + * @var array |
|
49 | + */ |
|
50 | + protected $descriptions = []; |
|
51 | + |
|
52 | + /** |
|
53 | + * Holds long descriptions for the public functions in this class. |
|
54 | + * Each 'key' in the array should match the function name. |
|
55 | + * @var array |
|
56 | + */ |
|
57 | + protected $long_descriptions = []; |
|
58 | + |
|
59 | + //-------------------------------------------------------------------- |
|
60 | + |
|
61 | + /** |
|
62 | + * Ensures that we are running on the CLI, and collects basic settings |
|
63 | + * like collecting our command line arguments into a pretty array. |
|
64 | + */ |
|
65 | + public function __construct() |
|
66 | + { |
|
67 | + parent::__construct(); |
|
68 | + |
|
69 | + // Restrict usage to the command line. |
|
70 | + if (! is_cli() ) |
|
71 | + { |
|
72 | + show_error( lang('cli_required') ); |
|
73 | + } |
|
74 | + |
|
75 | + // Make sure the CLI library is loaded and ready. |
|
76 | 76 | // CLI::_init(); |
77 | - } |
|
78 | - |
|
79 | - //-------------------------------------------------------------------- |
|
80 | - |
|
81 | - /** |
|
82 | - * A default index method that all CLI Controllers can share. Will |
|
83 | - * list all of the methods and their short descriptions, if available. |
|
84 | - */ |
|
85 | - public function index() |
|
86 | - { |
|
87 | - CLI::new_line(); |
|
88 | - CLI::write( lang('cli.available_commands') ); |
|
89 | - |
|
90 | - $this->sayDescriptions($this->descriptions); |
|
91 | - |
|
92 | - CLI::new_line(); |
|
93 | - } |
|
94 | - |
|
95 | - //-------------------------------------------------------------------- |
|
96 | - |
|
97 | - |
|
98 | - /** |
|
99 | - * Grabs the short description of a command, if it exists. |
|
100 | - * |
|
101 | - * @param null $method |
|
102 | - */ |
|
103 | - public function describeMethod($method=null) |
|
104 | - { |
|
105 | - if (empty($this->descriptions[$method])) |
|
106 | - { |
|
107 | - return CLI::error( lang('cli.bad_description') ); |
|
108 | - } |
|
109 | - |
|
110 | - CLI::write("\t{$this->descriptions[$method]}", 'yellow'); |
|
111 | - } |
|
112 | - |
|
113 | - //-------------------------------------------------------------------- |
|
114 | - |
|
115 | - public function longDescribeMethod($method=null) |
|
116 | - { |
|
117 | - if (empty($this->long_descriptions[$method])) |
|
118 | - { |
|
119 | - return CLI::error( lang('cli.no_help') ); |
|
120 | - } |
|
121 | - |
|
122 | - CLI::write("\t{$this->long_descriptions[$method]}", 'yellow'); |
|
123 | - } |
|
124 | - |
|
125 | - //-------------------------------------------------------------------- |
|
126 | - |
|
127 | - //-------------------------------------------------------------------- |
|
128 | - // Private Methods |
|
129 | - //-------------------------------------------------------------------- |
|
130 | - |
|
131 | - protected function sayDescriptions($descriptions) |
|
132 | - { |
|
133 | - $names = array_keys($descriptions); |
|
134 | - $syntaxes = array_column($descriptions, 0); |
|
135 | - $descs = array_column($descriptions, 1); |
|
136 | - |
|
137 | - // Pad each item to the same length |
|
138 | - $names = $this->padArray($names); |
|
139 | - $syntaxes = $this->padArray($syntaxes); |
|
140 | - |
|
141 | - for ($i=0; $i < count($names); $i++) |
|
142 | - { |
|
143 | - $out = CLI::color($names[$i], 'yellow'); |
|
144 | - |
|
145 | - // The rest of the items stay default color. |
|
146 | - if (isset($syntaxes[$i])) |
|
147 | - { |
|
148 | - $out .= $syntaxes[$i]; |
|
149 | - } |
|
150 | - |
|
151 | - if (isset($descs[$i])) |
|
152 | - { |
|
153 | - $out .= CLI::wrap($descs[$i], 125, strlen($names[$i]) + strlen($syntaxes[$i])); |
|
154 | - } |
|
155 | - |
|
156 | - CLI::write($out); |
|
157 | - } |
|
158 | - } |
|
159 | - |
|
160 | - //-------------------------------------------------------------------- |
|
161 | - |
|
162 | - /** |
|
163 | - * Returns a new array where all of the string elements have |
|
164 | - * been padding with trailling spaces to be the same length. |
|
165 | - * |
|
166 | - * @param array $array |
|
167 | - * @param int $extra // How many extra spaces to add at the end |
|
168 | - * @return array |
|
169 | - */ |
|
170 | - protected function padArray($array, $extra=2) |
|
171 | - { |
|
172 | - $max = max(array_map('strlen', $array)) + $extra; |
|
173 | - |
|
174 | - foreach ($array as &$item) |
|
175 | - { |
|
176 | - $item = str_pad($item, $max); |
|
177 | - } |
|
178 | - |
|
179 | - return $array; |
|
180 | - } |
|
181 | - |
|
182 | - //-------------------------------------------------------------------- |
|
77 | + } |
|
78 | + |
|
79 | + //-------------------------------------------------------------------- |
|
80 | + |
|
81 | + /** |
|
82 | + * A default index method that all CLI Controllers can share. Will |
|
83 | + * list all of the methods and their short descriptions, if available. |
|
84 | + */ |
|
85 | + public function index() |
|
86 | + { |
|
87 | + CLI::new_line(); |
|
88 | + CLI::write( lang('cli.available_commands') ); |
|
89 | + |
|
90 | + $this->sayDescriptions($this->descriptions); |
|
91 | + |
|
92 | + CLI::new_line(); |
|
93 | + } |
|
94 | + |
|
95 | + //-------------------------------------------------------------------- |
|
96 | + |
|
97 | + |
|
98 | + /** |
|
99 | + * Grabs the short description of a command, if it exists. |
|
100 | + * |
|
101 | + * @param null $method |
|
102 | + */ |
|
103 | + public function describeMethod($method=null) |
|
104 | + { |
|
105 | + if (empty($this->descriptions[$method])) |
|
106 | + { |
|
107 | + return CLI::error( lang('cli.bad_description') ); |
|
108 | + } |
|
109 | + |
|
110 | + CLI::write("\t{$this->descriptions[$method]}", 'yellow'); |
|
111 | + } |
|
112 | + |
|
113 | + //-------------------------------------------------------------------- |
|
114 | + |
|
115 | + public function longDescribeMethod($method=null) |
|
116 | + { |
|
117 | + if (empty($this->long_descriptions[$method])) |
|
118 | + { |
|
119 | + return CLI::error( lang('cli.no_help') ); |
|
120 | + } |
|
121 | + |
|
122 | + CLI::write("\t{$this->long_descriptions[$method]}", 'yellow'); |
|
123 | + } |
|
124 | + |
|
125 | + //-------------------------------------------------------------------- |
|
126 | + |
|
127 | + //-------------------------------------------------------------------- |
|
128 | + // Private Methods |
|
129 | + //-------------------------------------------------------------------- |
|
130 | + |
|
131 | + protected function sayDescriptions($descriptions) |
|
132 | + { |
|
133 | + $names = array_keys($descriptions); |
|
134 | + $syntaxes = array_column($descriptions, 0); |
|
135 | + $descs = array_column($descriptions, 1); |
|
136 | + |
|
137 | + // Pad each item to the same length |
|
138 | + $names = $this->padArray($names); |
|
139 | + $syntaxes = $this->padArray($syntaxes); |
|
140 | + |
|
141 | + for ($i=0; $i < count($names); $i++) |
|
142 | + { |
|
143 | + $out = CLI::color($names[$i], 'yellow'); |
|
144 | + |
|
145 | + // The rest of the items stay default color. |
|
146 | + if (isset($syntaxes[$i])) |
|
147 | + { |
|
148 | + $out .= $syntaxes[$i]; |
|
149 | + } |
|
150 | + |
|
151 | + if (isset($descs[$i])) |
|
152 | + { |
|
153 | + $out .= CLI::wrap($descs[$i], 125, strlen($names[$i]) + strlen($syntaxes[$i])); |
|
154 | + } |
|
155 | + |
|
156 | + CLI::write($out); |
|
157 | + } |
|
158 | + } |
|
159 | + |
|
160 | + //-------------------------------------------------------------------- |
|
161 | + |
|
162 | + /** |
|
163 | + * Returns a new array where all of the string elements have |
|
164 | + * been padding with trailling spaces to be the same length. |
|
165 | + * |
|
166 | + * @param array $array |
|
167 | + * @param int $extra // How many extra spaces to add at the end |
|
168 | + * @return array |
|
169 | + */ |
|
170 | + protected function padArray($array, $extra=2) |
|
171 | + { |
|
172 | + $max = max(array_map('strlen', $array)) + $extra; |
|
173 | + |
|
174 | + foreach ($array as &$item) |
|
175 | + { |
|
176 | + $item = str_pad($item, $max); |
|
177 | + } |
|
178 | + |
|
179 | + return $array; |
|
180 | + } |
|
181 | + |
|
182 | + //-------------------------------------------------------------------- |
|
183 | 183 | |
184 | 184 | } |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | parent::__construct(); |
68 | 68 | |
69 | 69 | // Restrict usage to the command line. |
70 | - if (! is_cli() ) |
|
70 | + if ( ! is_cli()) |
|
71 | 71 | { |
72 | - show_error( lang('cli_required') ); |
|
72 | + show_error(lang('cli_required')); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | // Make sure the CLI library is loaded and ready. |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | public function index() |
86 | 86 | { |
87 | 87 | CLI::new_line(); |
88 | - CLI::write( lang('cli.available_commands') ); |
|
88 | + CLI::write(lang('cli.available_commands')); |
|
89 | 89 | |
90 | 90 | $this->sayDescriptions($this->descriptions); |
91 | 91 | |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @param null $method |
102 | 102 | */ |
103 | - public function describeMethod($method=null) |
|
103 | + public function describeMethod($method = null) |
|
104 | 104 | { |
105 | 105 | if (empty($this->descriptions[$method])) |
106 | 106 | { |
107 | - return CLI::error( lang('cli.bad_description') ); |
|
107 | + return CLI::error(lang('cli.bad_description')); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | CLI::write("\t{$this->descriptions[$method]}", 'yellow'); |
@@ -112,11 +112,11 @@ discard block |
||
112 | 112 | |
113 | 113 | //-------------------------------------------------------------------- |
114 | 114 | |
115 | - public function longDescribeMethod($method=null) |
|
115 | + public function longDescribeMethod($method = null) |
|
116 | 116 | { |
117 | 117 | if (empty($this->long_descriptions[$method])) |
118 | 118 | { |
119 | - return CLI::error( lang('cli.no_help') ); |
|
119 | + return CLI::error(lang('cli.no_help')); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | CLI::write("\t{$this->long_descriptions[$method]}", 'yellow'); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $names = $this->padArray($names); |
139 | 139 | $syntaxes = $this->padArray($syntaxes); |
140 | 140 | |
141 | - for ($i=0; $i < count($names); $i++) |
|
141 | + for ($i = 0; $i < count($names); $i++) |
|
142 | 142 | { |
143 | 143 | $out = CLI::color($names[$i], 'yellow'); |
144 | 144 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param int $extra // How many extra spaces to add at the end |
168 | 168 | * @return array |
169 | 169 | */ |
170 | - protected function padArray($array, $extra=2) |
|
170 | + protected function padArray($array, $extra = 2) |
|
171 | 171 | { |
172 | 172 | $max = max(array_map('strlen', $array)) + $extra; |
173 | 173 |
@@ -34,257 +34,257 @@ |
||
34 | 34 | |
35 | 35 | class CronManager { |
36 | 36 | |
37 | - protected static $tasks = []; |
|
38 | - |
|
39 | - //-------------------------------------------------------------------- |
|
40 | - |
|
41 | - /** |
|
42 | - * Schedules a new task in the system. |
|
43 | - * |
|
44 | - * @param $alias |
|
45 | - * @param $time_string |
|
46 | - * @param callable|string $task |
|
47 | - */ |
|
48 | - public static function schedule($alias, $time_string, $task) |
|
49 | - { |
|
50 | - // Valid Alias? |
|
51 | - if (! is_string($alias) || empty($alias)) |
|
52 | - { |
|
53 | - throw new \RuntimeException( lang('cron.bad_alias') ); |
|
54 | - } |
|
55 | - |
|
56 | - // Valid TimeString? |
|
57 | - if (! is_string($time_string) || empty($time_string)) |
|
58 | - { |
|
59 | - throw new \RuntimeException( lang('cron.bad_timestring') ); |
|
60 | - } |
|
61 | - |
|
62 | - // Valid Task? |
|
63 | - if (! is_callable($task) && ! is_string($task)) |
|
64 | - { |
|
65 | - throw new \RuntimeException( lang('cron.bad_task') . $alias); |
|
66 | - } |
|
67 | - |
|
68 | - static::$tasks[$alias] = new CronTask($time_string, $task); |
|
69 | - } |
|
70 | - |
|
71 | - //-------------------------------------------------------------------- |
|
72 | - |
|
73 | - /** |
|
74 | - * Removes a single task from the system. |
|
75 | - * |
|
76 | - * @param $alias |
|
77 | - */ |
|
78 | - public static function remove($alias) |
|
79 | - { |
|
80 | - if (empty(static::$tasks[$alias])) |
|
81 | - { |
|
82 | - return null; |
|
83 | - } |
|
84 | - |
|
85 | - unset(static::$tasks[$alias]); |
|
86 | - |
|
87 | - return true; |
|
88 | - } |
|
89 | - |
|
90 | - //-------------------------------------------------------------------- |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * Provides an array of all tasks in the system. The format will be |
|
95 | - * like: |
|
96 | - * [ |
|
97 | - * 'alias' => [ |
|
98 | - * 'next_run' => '123456789', |
|
99 | - * 'prev_run' => '123456789', |
|
100 | - * 'task' => mixed |
|
101 | - * ], |
|
102 | - * ... |
|
103 | - * ] |
|
104 | - */ |
|
105 | - public static function listAll($current_time='now') |
|
106 | - { |
|
107 | - if (! count(static::$tasks)) |
|
108 | - { |
|
109 | - return null; |
|
110 | - } |
|
111 | - |
|
112 | - $output = array(); |
|
113 | - |
|
114 | - foreach (static::$tasks as $alias => $task) |
|
115 | - { |
|
116 | - $output[$alias] = [ |
|
117 | - 'next_run' => $task->nextRunDate($current_time), |
|
118 | - 'prev_run' => $task->previousRunDate($current_time), |
|
119 | - 'task' => $task->task() |
|
120 | - ]; |
|
121 | - } |
|
122 | - |
|
123 | - return $output; |
|
124 | - } |
|
125 | - |
|
126 | - //-------------------------------------------------------------------- |
|
127 | - |
|
128 | - /** |
|
129 | - * Gets the task object assigned to an alias. |
|
130 | - * |
|
131 | - * @param $alias |
|
132 | - * @return null|CronTask object |
|
133 | - */ |
|
134 | - public static function task($alias) |
|
135 | - { |
|
136 | - if (empty(static::$tasks[$alias]) ) |
|
137 | - { |
|
138 | - return null; |
|
139 | - } |
|
140 | - |
|
141 | - return static::$tasks[$alias]; |
|
142 | - } |
|
143 | - |
|
144 | - //-------------------------------------------------------------------- |
|
145 | - |
|
146 | - /** |
|
147 | - * Returns all tasks currently in the system. |
|
148 | - * |
|
149 | - * @return array |
|
150 | - */ |
|
151 | - public static function tasks() |
|
152 | - { |
|
153 | - return count(static::$tasks) ? static::$tasks : null; |
|
154 | - } |
|
155 | - |
|
156 | - //-------------------------------------------------------------------- |
|
157 | - |
|
158 | - /** |
|
159 | - * Runs all tasks scheduled to run right now. |
|
160 | - * |
|
161 | - * Can be limited to a single task by passing it's alias in the first param. |
|
162 | - * |
|
163 | - * Returns the output of all task runs as a single string. Perfect for |
|
164 | - * emailing to users on completion |
|
165 | - * |
|
166 | - * @param null $alias |
|
167 | - * @param bool $force_run |
|
168 | - * @param string $current_time |
|
169 | - * @return string |
|
170 | - */ |
|
171 | - public static function run($alias=null, $force_run=false, $current_time='now') |
|
172 | - { |
|
173 | - $tasks = static::$tasks; |
|
174 | - |
|
175 | - if (! empty($alias) && isset($tasks[$alias])) |
|
176 | - { |
|
177 | - $tasks = [$alias => $tasks[$alias] ]; |
|
178 | - } |
|
179 | - |
|
180 | - $output = ''; |
|
181 | - |
|
182 | - $count = 0; // How many tasks have ran? |
|
183 | - |
|
184 | - foreach ($tasks as $alias => $task) |
|
185 | - { |
|
186 | - if ($task->isDue($current_time) || $force_run === true) |
|
187 | - { |
|
188 | - $output .= sprintf( lang('cron.running_task'), $alias); |
|
189 | - |
|
190 | - try { |
|
191 | - $result = self::runTask($alias); |
|
192 | - |
|
193 | - if (is_bool($result)) |
|
194 | - { |
|
195 | - $output .= $result === true ? lang('done') ."\n" : lang('failed') ."\n"; |
|
196 | - } |
|
197 | - else if (is_string($result)) |
|
198 | - { |
|
199 | - $output .= sprintf( lang('cron.done_with_msg'), $result); |
|
200 | - } |
|
201 | - } |
|
202 | - catch (\Exception $e) |
|
203 | - { |
|
204 | - $output .= "[Exception] ". $e->getMessage() ."\n"; |
|
205 | - } |
|
206 | - |
|
207 | - $count++; |
|
208 | - } |
|
209 | - else |
|
210 | - { |
|
211 | - $output .= sprintf( lang('cron.not_scheduled_until'), $alias, $task->nextRunDate() ); |
|
212 | - } |
|
213 | - } |
|
214 | - |
|
215 | - if (! $count) |
|
216 | - { |
|
217 | - $output .= lang('cron.nothing_scheduled'); |
|
218 | - } |
|
219 | - |
|
220 | - return $output; |
|
221 | - } |
|
222 | - |
|
223 | - //-------------------------------------------------------------------- |
|
224 | - |
|
225 | - /** |
|
226 | - * Clears all tasks from the system |
|
227 | - */ |
|
228 | - public static function reset() |
|
229 | - { |
|
230 | - static::$tasks = []; |
|
231 | - } |
|
232 | - |
|
233 | - //-------------------------------------------------------------------- |
|
234 | - |
|
235 | - //-------------------------------------------------------------------- |
|
236 | - // Protected Methods |
|
237 | - //-------------------------------------------------------------------- |
|
238 | - |
|
239 | - /** |
|
240 | - * Runs a single Task. |
|
241 | - * |
|
242 | - * NOTE: Tasks MUST return a true/false value only. |
|
243 | - * |
|
244 | - * @param $alias |
|
245 | - * @return bool |
|
246 | - */ |
|
247 | - protected static function runTask($alias) |
|
248 | - { |
|
249 | - $task = static::$tasks[$alias]->task(); |
|
250 | - |
|
251 | - $success = false; |
|
252 | - |
|
253 | - // If it's a standard callable item, |
|
254 | - // then run it. |
|
255 | - if (is_callable($task)) |
|
256 | - { |
|
257 | - $success = call_user_func($task); |
|
258 | - } |
|
259 | - |
|
260 | - // Otherwise, if it's a string it should be |
|
261 | - // a library:method string so try to run it. |
|
262 | - else if (is_string($task) && ! empty($task) && strpos($task, ':') !== false) |
|
263 | - { |
|
264 | - list($class, $method) = explode(':', $task); |
|
265 | - |
|
266 | - // Let PHP try to autoload it through any available autoloaders |
|
267 | - // (including Composer and user's custom autoloaders). If we |
|
268 | - // don't find it, then assume it's a CI library that we can reach. |
|
269 | - if (class_exists($class)) { |
|
270 | - $class = new $class(); |
|
271 | - } else { |
|
272 | - get_instance()->load->library($class); |
|
273 | - $class =& get_instance()->$class; |
|
274 | - } |
|
275 | - |
|
276 | - if (! method_exists($class, $method)) { |
|
277 | - log_message('error', "[CRON] Method not found: {$class}::{$method}"); |
|
278 | - return $success; |
|
279 | - } |
|
280 | - |
|
281 | - // Call the class with our parameters |
|
282 | - $success = $class->{$method}(); |
|
283 | - } |
|
284 | - |
|
285 | - return $success; |
|
286 | - } |
|
287 | - |
|
288 | - //-------------------------------------------------------------------- |
|
37 | + protected static $tasks = []; |
|
38 | + |
|
39 | + //-------------------------------------------------------------------- |
|
40 | + |
|
41 | + /** |
|
42 | + * Schedules a new task in the system. |
|
43 | + * |
|
44 | + * @param $alias |
|
45 | + * @param $time_string |
|
46 | + * @param callable|string $task |
|
47 | + */ |
|
48 | + public static function schedule($alias, $time_string, $task) |
|
49 | + { |
|
50 | + // Valid Alias? |
|
51 | + if (! is_string($alias) || empty($alias)) |
|
52 | + { |
|
53 | + throw new \RuntimeException( lang('cron.bad_alias') ); |
|
54 | + } |
|
55 | + |
|
56 | + // Valid TimeString? |
|
57 | + if (! is_string($time_string) || empty($time_string)) |
|
58 | + { |
|
59 | + throw new \RuntimeException( lang('cron.bad_timestring') ); |
|
60 | + } |
|
61 | + |
|
62 | + // Valid Task? |
|
63 | + if (! is_callable($task) && ! is_string($task)) |
|
64 | + { |
|
65 | + throw new \RuntimeException( lang('cron.bad_task') . $alias); |
|
66 | + } |
|
67 | + |
|
68 | + static::$tasks[$alias] = new CronTask($time_string, $task); |
|
69 | + } |
|
70 | + |
|
71 | + //-------------------------------------------------------------------- |
|
72 | + |
|
73 | + /** |
|
74 | + * Removes a single task from the system. |
|
75 | + * |
|
76 | + * @param $alias |
|
77 | + */ |
|
78 | + public static function remove($alias) |
|
79 | + { |
|
80 | + if (empty(static::$tasks[$alias])) |
|
81 | + { |
|
82 | + return null; |
|
83 | + } |
|
84 | + |
|
85 | + unset(static::$tasks[$alias]); |
|
86 | + |
|
87 | + return true; |
|
88 | + } |
|
89 | + |
|
90 | + //-------------------------------------------------------------------- |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * Provides an array of all tasks in the system. The format will be |
|
95 | + * like: |
|
96 | + * [ |
|
97 | + * 'alias' => [ |
|
98 | + * 'next_run' => '123456789', |
|
99 | + * 'prev_run' => '123456789', |
|
100 | + * 'task' => mixed |
|
101 | + * ], |
|
102 | + * ... |
|
103 | + * ] |
|
104 | + */ |
|
105 | + public static function listAll($current_time='now') |
|
106 | + { |
|
107 | + if (! count(static::$tasks)) |
|
108 | + { |
|
109 | + return null; |
|
110 | + } |
|
111 | + |
|
112 | + $output = array(); |
|
113 | + |
|
114 | + foreach (static::$tasks as $alias => $task) |
|
115 | + { |
|
116 | + $output[$alias] = [ |
|
117 | + 'next_run' => $task->nextRunDate($current_time), |
|
118 | + 'prev_run' => $task->previousRunDate($current_time), |
|
119 | + 'task' => $task->task() |
|
120 | + ]; |
|
121 | + } |
|
122 | + |
|
123 | + return $output; |
|
124 | + } |
|
125 | + |
|
126 | + //-------------------------------------------------------------------- |
|
127 | + |
|
128 | + /** |
|
129 | + * Gets the task object assigned to an alias. |
|
130 | + * |
|
131 | + * @param $alias |
|
132 | + * @return null|CronTask object |
|
133 | + */ |
|
134 | + public static function task($alias) |
|
135 | + { |
|
136 | + if (empty(static::$tasks[$alias]) ) |
|
137 | + { |
|
138 | + return null; |
|
139 | + } |
|
140 | + |
|
141 | + return static::$tasks[$alias]; |
|
142 | + } |
|
143 | + |
|
144 | + //-------------------------------------------------------------------- |
|
145 | + |
|
146 | + /** |
|
147 | + * Returns all tasks currently in the system. |
|
148 | + * |
|
149 | + * @return array |
|
150 | + */ |
|
151 | + public static function tasks() |
|
152 | + { |
|
153 | + return count(static::$tasks) ? static::$tasks : null; |
|
154 | + } |
|
155 | + |
|
156 | + //-------------------------------------------------------------------- |
|
157 | + |
|
158 | + /** |
|
159 | + * Runs all tasks scheduled to run right now. |
|
160 | + * |
|
161 | + * Can be limited to a single task by passing it's alias in the first param. |
|
162 | + * |
|
163 | + * Returns the output of all task runs as a single string. Perfect for |
|
164 | + * emailing to users on completion |
|
165 | + * |
|
166 | + * @param null $alias |
|
167 | + * @param bool $force_run |
|
168 | + * @param string $current_time |
|
169 | + * @return string |
|
170 | + */ |
|
171 | + public static function run($alias=null, $force_run=false, $current_time='now') |
|
172 | + { |
|
173 | + $tasks = static::$tasks; |
|
174 | + |
|
175 | + if (! empty($alias) && isset($tasks[$alias])) |
|
176 | + { |
|
177 | + $tasks = [$alias => $tasks[$alias] ]; |
|
178 | + } |
|
179 | + |
|
180 | + $output = ''; |
|
181 | + |
|
182 | + $count = 0; // How many tasks have ran? |
|
183 | + |
|
184 | + foreach ($tasks as $alias => $task) |
|
185 | + { |
|
186 | + if ($task->isDue($current_time) || $force_run === true) |
|
187 | + { |
|
188 | + $output .= sprintf( lang('cron.running_task'), $alias); |
|
189 | + |
|
190 | + try { |
|
191 | + $result = self::runTask($alias); |
|
192 | + |
|
193 | + if (is_bool($result)) |
|
194 | + { |
|
195 | + $output .= $result === true ? lang('done') ."\n" : lang('failed') ."\n"; |
|
196 | + } |
|
197 | + else if (is_string($result)) |
|
198 | + { |
|
199 | + $output .= sprintf( lang('cron.done_with_msg'), $result); |
|
200 | + } |
|
201 | + } |
|
202 | + catch (\Exception $e) |
|
203 | + { |
|
204 | + $output .= "[Exception] ". $e->getMessage() ."\n"; |
|
205 | + } |
|
206 | + |
|
207 | + $count++; |
|
208 | + } |
|
209 | + else |
|
210 | + { |
|
211 | + $output .= sprintf( lang('cron.not_scheduled_until'), $alias, $task->nextRunDate() ); |
|
212 | + } |
|
213 | + } |
|
214 | + |
|
215 | + if (! $count) |
|
216 | + { |
|
217 | + $output .= lang('cron.nothing_scheduled'); |
|
218 | + } |
|
219 | + |
|
220 | + return $output; |
|
221 | + } |
|
222 | + |
|
223 | + //-------------------------------------------------------------------- |
|
224 | + |
|
225 | + /** |
|
226 | + * Clears all tasks from the system |
|
227 | + */ |
|
228 | + public static function reset() |
|
229 | + { |
|
230 | + static::$tasks = []; |
|
231 | + } |
|
232 | + |
|
233 | + //-------------------------------------------------------------------- |
|
234 | + |
|
235 | + //-------------------------------------------------------------------- |
|
236 | + // Protected Methods |
|
237 | + //-------------------------------------------------------------------- |
|
238 | + |
|
239 | + /** |
|
240 | + * Runs a single Task. |
|
241 | + * |
|
242 | + * NOTE: Tasks MUST return a true/false value only. |
|
243 | + * |
|
244 | + * @param $alias |
|
245 | + * @return bool |
|
246 | + */ |
|
247 | + protected static function runTask($alias) |
|
248 | + { |
|
249 | + $task = static::$tasks[$alias]->task(); |
|
250 | + |
|
251 | + $success = false; |
|
252 | + |
|
253 | + // If it's a standard callable item, |
|
254 | + // then run it. |
|
255 | + if (is_callable($task)) |
|
256 | + { |
|
257 | + $success = call_user_func($task); |
|
258 | + } |
|
259 | + |
|
260 | + // Otherwise, if it's a string it should be |
|
261 | + // a library:method string so try to run it. |
|
262 | + else if (is_string($task) && ! empty($task) && strpos($task, ':') !== false) |
|
263 | + { |
|
264 | + list($class, $method) = explode(':', $task); |
|
265 | + |
|
266 | + // Let PHP try to autoload it through any available autoloaders |
|
267 | + // (including Composer and user's custom autoloaders). If we |
|
268 | + // don't find it, then assume it's a CI library that we can reach. |
|
269 | + if (class_exists($class)) { |
|
270 | + $class = new $class(); |
|
271 | + } else { |
|
272 | + get_instance()->load->library($class); |
|
273 | + $class =& get_instance()->$class; |
|
274 | + } |
|
275 | + |
|
276 | + if (! method_exists($class, $method)) { |
|
277 | + log_message('error', "[CRON] Method not found: {$class}::{$method}"); |
|
278 | + return $success; |
|
279 | + } |
|
280 | + |
|
281 | + // Call the class with our parameters |
|
282 | + $success = $class->{$method}(); |
|
283 | + } |
|
284 | + |
|
285 | + return $success; |
|
286 | + } |
|
287 | + |
|
288 | + //-------------------------------------------------------------------- |
|
289 | 289 | |
290 | 290 | } |
@@ -48,21 +48,21 @@ discard block |
||
48 | 48 | public static function schedule($alias, $time_string, $task) |
49 | 49 | { |
50 | 50 | // Valid Alias? |
51 | - if (! is_string($alias) || empty($alias)) |
|
51 | + if ( ! is_string($alias) || empty($alias)) |
|
52 | 52 | { |
53 | - throw new \RuntimeException( lang('cron.bad_alias') ); |
|
53 | + throw new \RuntimeException(lang('cron.bad_alias')); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | // Valid TimeString? |
57 | - if (! is_string($time_string) || empty($time_string)) |
|
57 | + if ( ! is_string($time_string) || empty($time_string)) |
|
58 | 58 | { |
59 | - throw new \RuntimeException( lang('cron.bad_timestring') ); |
|
59 | + throw new \RuntimeException(lang('cron.bad_timestring')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Valid Task? |
63 | - if (! is_callable($task) && ! is_string($task)) |
|
63 | + if ( ! is_callable($task) && ! is_string($task)) |
|
64 | 64 | { |
65 | - throw new \RuntimeException( lang('cron.bad_task') . $alias); |
|
65 | + throw new \RuntimeException(lang('cron.bad_task').$alias); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | static::$tasks[$alias] = new CronTask($time_string, $task); |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | * ... |
103 | 103 | * ] |
104 | 104 | */ |
105 | - public static function listAll($current_time='now') |
|
105 | + public static function listAll($current_time = 'now') |
|
106 | 106 | { |
107 | - if (! count(static::$tasks)) |
|
107 | + if ( ! count(static::$tasks)) |
|
108 | 108 | { |
109 | 109 | return null; |
110 | 110 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | public static function task($alias) |
135 | 135 | { |
136 | - if (empty(static::$tasks[$alias]) ) |
|
136 | + if (empty(static::$tasks[$alias])) |
|
137 | 137 | { |
138 | 138 | return null; |
139 | 139 | } |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | * @param string $current_time |
169 | 169 | * @return string |
170 | 170 | */ |
171 | - public static function run($alias=null, $force_run=false, $current_time='now') |
|
171 | + public static function run($alias = null, $force_run = false, $current_time = 'now') |
|
172 | 172 | { |
173 | 173 | $tasks = static::$tasks; |
174 | 174 | |
175 | - if (! empty($alias) && isset($tasks[$alias])) |
|
175 | + if ( ! empty($alias) && isset($tasks[$alias])) |
|
176 | 176 | { |
177 | - $tasks = [$alias => $tasks[$alias] ]; |
|
177 | + $tasks = [$alias => $tasks[$alias]]; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | $output = ''; |
@@ -185,34 +185,34 @@ discard block |
||
185 | 185 | { |
186 | 186 | if ($task->isDue($current_time) || $force_run === true) |
187 | 187 | { |
188 | - $output .= sprintf( lang('cron.running_task'), $alias); |
|
188 | + $output .= sprintf(lang('cron.running_task'), $alias); |
|
189 | 189 | |
190 | 190 | try { |
191 | 191 | $result = self::runTask($alias); |
192 | 192 | |
193 | 193 | if (is_bool($result)) |
194 | 194 | { |
195 | - $output .= $result === true ? lang('done') ."\n" : lang('failed') ."\n"; |
|
195 | + $output .= $result === true ? lang('done')."\n" : lang('failed')."\n"; |
|
196 | 196 | } |
197 | 197 | else if (is_string($result)) |
198 | 198 | { |
199 | - $output .= sprintf( lang('cron.done_with_msg'), $result); |
|
199 | + $output .= sprintf(lang('cron.done_with_msg'), $result); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | catch (\Exception $e) |
203 | 203 | { |
204 | - $output .= "[Exception] ". $e->getMessage() ."\n"; |
|
204 | + $output .= "[Exception] ".$e->getMessage()."\n"; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | $count++; |
208 | 208 | } |
209 | 209 | else |
210 | 210 | { |
211 | - $output .= sprintf( lang('cron.not_scheduled_until'), $alias, $task->nextRunDate() ); |
|
211 | + $output .= sprintf(lang('cron.not_scheduled_until'), $alias, $task->nextRunDate()); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | |
215 | - if (! $count) |
|
215 | + if ( ! $count) |
|
216 | 216 | { |
217 | 217 | $output .= lang('cron.nothing_scheduled'); |
218 | 218 | } |
@@ -270,10 +270,10 @@ discard block |
||
270 | 270 | $class = new $class(); |
271 | 271 | } else { |
272 | 272 | get_instance()->load->library($class); |
273 | - $class =& get_instance()->$class; |
|
273 | + $class = & get_instance()->$class; |
|
274 | 274 | } |
275 | 275 | |
276 | - if (! method_exists($class, $method)) { |
|
276 | + if ( ! method_exists($class, $method)) { |
|
277 | 277 | log_message('error', "[CRON] Method not found: {$class}::{$method}"); |
278 | 278 | return $success; |
279 | 279 | } |
@@ -193,20 +193,17 @@ |
||
193 | 193 | if (is_bool($result)) |
194 | 194 | { |
195 | 195 | $output .= $result === true ? lang('done') ."\n" : lang('failed') ."\n"; |
196 | - } |
|
197 | - else if (is_string($result)) |
|
196 | + } else if (is_string($result)) |
|
198 | 197 | { |
199 | 198 | $output .= sprintf( lang('cron.done_with_msg'), $result); |
200 | 199 | } |
201 | - } |
|
202 | - catch (\Exception $e) |
|
200 | + } catch (\Exception $e) |
|
203 | 201 | { |
204 | 202 | $output .= "[Exception] ". $e->getMessage() ."\n"; |
205 | 203 | } |
206 | 204 | |
207 | 205 | $count++; |
208 | - } |
|
209 | - else |
|
206 | + } else |
|
210 | 207 | { |
211 | 208 | $output .= sprintf( lang('cron.not_scheduled_until'), $alias, $task->nextRunDate() ); |
212 | 209 | } |
@@ -40,117 +40,117 @@ |
||
40 | 40 | */ |
41 | 41 | interface DocBuilderInterface |
42 | 42 | { |
43 | - /** |
|
44 | - * Does the actual work of reading in and parsing the help file. |
|
45 | - * If a folder Nickname (see addDocFolder() ) is passed as the second parameter, |
|
46 | - * it will limit it's search to that single folder. If nothing is passed, it will |
|
47 | - * search through all of the folders in the order they were given to the library, |
|
48 | - * until it finds the first one. |
|
49 | - * |
|
50 | - * @param string $path The 'path' of the file (relative to the docs |
|
51 | - * folder. Usually from the URI) |
|
52 | - * @param string $restrictToFolder (Optional) The folder nickname |
|
53 | - * |
|
54 | - * @return string |
|
55 | - */ |
|
56 | - public function readPage($path, $restrictToFolder = null); |
|
43 | + /** |
|
44 | + * Does the actual work of reading in and parsing the help file. |
|
45 | + * If a folder Nickname (see addDocFolder() ) is passed as the second parameter, |
|
46 | + * it will limit it's search to that single folder. If nothing is passed, it will |
|
47 | + * search through all of the folders in the order they were given to the library, |
|
48 | + * until it finds the first one. |
|
49 | + * |
|
50 | + * @param string $path The 'path' of the file (relative to the docs |
|
51 | + * folder. Usually from the URI) |
|
52 | + * @param string $restrictToFolder (Optional) The folder nickname |
|
53 | + * |
|
54 | + * @return string |
|
55 | + */ |
|
56 | + public function readPage($path, $restrictToFolder = null); |
|
57 | 57 | |
58 | - /** |
|
59 | - * Parses the contents. Currently runs through the Markdown Extended |
|
60 | - * parser to convert to HTML. |
|
61 | - * |
|
62 | - * @param $str |
|
63 | - * @return mixed |
|
64 | - */ |
|
65 | - public function parse($str); |
|
58 | + /** |
|
59 | + * Parses the contents. Currently runs through the Markdown Extended |
|
60 | + * parser to convert to HTML. |
|
61 | + * |
|
62 | + * @param $str |
|
63 | + * @return mixed |
|
64 | + */ |
|
65 | + public function parse($str); |
|
66 | 66 | |
67 | - /** |
|
68 | - * Perform a few housekeeping tasks on a page, like rewriting URLs to full |
|
69 | - * URLs, not relative, ensuring they link correctly, etc. |
|
70 | - * |
|
71 | - * @param $content |
|
72 | - * @param null $site_url |
|
73 | - * @param null $current_url |
|
74 | - * @return string The post-processed HTML. |
|
75 | - */ |
|
76 | - public function postProcess($content, $site_url = null, $current_url = null); |
|
67 | + /** |
|
68 | + * Perform a few housekeeping tasks on a page, like rewriting URLs to full |
|
69 | + * URLs, not relative, ensuring they link correctly, etc. |
|
70 | + * |
|
71 | + * @param $content |
|
72 | + * @param null $site_url |
|
73 | + * @param null $current_url |
|
74 | + * @return string The post-processed HTML. |
|
75 | + */ |
|
76 | + public function postProcess($content, $site_url = null, $current_url = null); |
|
77 | 77 | |
78 | - /** |
|
79 | - * Allows users to define the classes that are attached to |
|
80 | - * generated tables. |
|
81 | - * |
|
82 | - * @param null $classes |
|
83 | - * @return $this |
|
84 | - */ |
|
85 | - public function setTableClasses($classes = null); |
|
78 | + /** |
|
79 | + * Allows users to define the classes that are attached to |
|
80 | + * generated tables. |
|
81 | + * |
|
82 | + * @param null $classes |
|
83 | + * @return $this |
|
84 | + */ |
|
85 | + public function setTableClasses($classes = null); |
|
86 | 86 | |
87 | - /** |
|
88 | - * Given the contents to render, will build a list of links for the sidebar |
|
89 | - * out of the headings in the file. |
|
90 | - * |
|
91 | - * Note: Will ONLY use h2 and h3 to build the links from. |
|
92 | - * |
|
93 | - * Note: The $content passed in WILL be modified by adding named anchors |
|
94 | - * that match up with the locations. |
|
95 | - * |
|
96 | - * @param string $content The HTML to analyse for headings. |
|
97 | - * @return string |
|
98 | - */ |
|
99 | - public function buildDocumentMap(&$content); |
|
87 | + /** |
|
88 | + * Given the contents to render, will build a list of links for the sidebar |
|
89 | + * out of the headings in the file. |
|
90 | + * |
|
91 | + * Note: Will ONLY use h2 and h3 to build the links from. |
|
92 | + * |
|
93 | + * Note: The $content passed in WILL be modified by adding named anchors |
|
94 | + * that match up with the locations. |
|
95 | + * |
|
96 | + * @param string $content The HTML to analyse for headings. |
|
97 | + * @return string |
|
98 | + */ |
|
99 | + public function buildDocumentMap(&$content); |
|
100 | 100 | |
101 | - /** |
|
102 | - * Stores the name of the callback method to run to convert the source |
|
103 | - * files to viewable files. By default, this should be used to register |
|
104 | - * a Mardown Extended formatter with the system, but could be used to |
|
105 | - * extend the |
|
106 | - * |
|
107 | - * @param string $callback_name |
|
108 | - * @param bool $cascade // If FALSE the formatting of a component ends here. If TRUE, will be passed to next formatter. |
|
109 | - * @return $this |
|
110 | - */ |
|
111 | - public function registerFormatter($callback_name = '', $cascade = false); |
|
101 | + /** |
|
102 | + * Stores the name of the callback method to run to convert the source |
|
103 | + * files to viewable files. By default, this should be used to register |
|
104 | + * a Mardown Extended formatter with the system, but could be used to |
|
105 | + * extend the |
|
106 | + * |
|
107 | + * @param string $callback_name |
|
108 | + * @param bool $cascade // If FALSE the formatting of a component ends here. If TRUE, will be passed to next formatter. |
|
109 | + * @return $this |
|
110 | + */ |
|
111 | + public function registerFormatter($callback_name = '', $cascade = false); |
|
112 | 112 | |
113 | - /** |
|
114 | - * Runs the text through the registered formatters. |
|
115 | - * |
|
116 | - * @param $str |
|
117 | - * @return mixed |
|
118 | - */ |
|
119 | - public function format($str); |
|
113 | + /** |
|
114 | + * Runs the text through the registered formatters. |
|
115 | + * |
|
116 | + * @param $str |
|
117 | + * @return mixed |
|
118 | + */ |
|
119 | + public function format($str); |
|
120 | 120 | |
121 | - /** |
|
122 | - * Retrieves the list of files in a folder and preps the name and filename |
|
123 | - * so it's ready for creating the HTML. |
|
124 | - * |
|
125 | - * @param String $folder The path to the folder to retrieve. |
|
126 | - * |
|
127 | - * @return Array An associative array @see parse_ini_file for format |
|
128 | - * details. |
|
129 | - */ |
|
130 | - public function buildTOC($folder); |
|
121 | + /** |
|
122 | + * Retrieves the list of files in a folder and preps the name and filename |
|
123 | + * so it's ready for creating the HTML. |
|
124 | + * |
|
125 | + * @param String $folder The path to the folder to retrieve. |
|
126 | + * |
|
127 | + * @return Array An associative array @see parse_ini_file for format |
|
128 | + * details. |
|
129 | + */ |
|
130 | + public function buildTOC($folder); |
|
131 | 131 | |
132 | - /** |
|
133 | - * Returns the current docFolders array. |
|
134 | - * |
|
135 | - * @return array |
|
136 | - */ |
|
137 | - public function docFolders(); |
|
132 | + /** |
|
133 | + * Returns the current docFolders array. |
|
134 | + * |
|
135 | + * @return array |
|
136 | + */ |
|
137 | + public function docFolders(); |
|
138 | 138 | |
139 | - /** |
|
140 | - * Registers a path to be used when searching for documentation files. |
|
141 | - * |
|
142 | - * @param $name A nickname to reference it by later. |
|
143 | - * @param $path The server path to the folder. |
|
144 | - * @return $this |
|
145 | - */ |
|
146 | - public function addDocFolder($name, $path); |
|
139 | + /** |
|
140 | + * Registers a path to be used when searching for documentation files. |
|
141 | + * |
|
142 | + * @param $name A nickname to reference it by later. |
|
143 | + * @param $path The server path to the folder. |
|
144 | + * @return $this |
|
145 | + */ |
|
146 | + public function addDocFolder($name, $path); |
|
147 | 147 | |
148 | - /** |
|
149 | - * Removes a folder from the folders we scan for documentation files |
|
150 | - * within. |
|
151 | - * |
|
152 | - * @param $name |
|
153 | - * @return $this |
|
154 | - */ |
|
155 | - public function removeDocFolder($name); |
|
148 | + /** |
|
149 | + * Removes a folder from the folders we scan for documentation files |
|
150 | + * within. |
|
151 | + * |
|
152 | + * @param $name |
|
153 | + * @return $this |
|
154 | + */ |
|
155 | + public function removeDocFolder($name); |
|
156 | 156 | } |
@@ -1,71 +1,71 @@ |
||
1 | 1 | <?php namespace Myth\Docs; |
2 | 2 | /** |
3 | - * Sprint |
|
4 | - * |
|
5 | - * A set of power tools to enhance the CodeIgniter framework and provide consistent workflow. |
|
6 | - * |
|
7 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
8 | - * of this software and associated documentation files (the "Software"), to deal |
|
9 | - * in the Software without restriction, including without limitation the rights |
|
10 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
11 | - * copies of the Software, and to permit persons to whom the Software is |
|
12 | - * furnished to do so, subject to the following conditions: |
|
13 | - * |
|
14 | - * The above copyright notice and this permission notice shall be included in |
|
15 | - * all copies or substantial portions of the Software. |
|
16 | - * |
|
17 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
18 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
19 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
20 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
21 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
22 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
23 | - * THE SOFTWARE. |
|
24 | - * |
|
25 | - * @package Sprint |
|
26 | - * @author Lonnie Ezell |
|
27 | - * @copyright Copyright 2014-2015, New Myth Media, LLC (http://newmythmedia.com) |
|
28 | - * @license http://opensource.org/licenses/MIT (MIT) |
|
29 | - * @link http://sprintphp.com |
|
30 | - * @since Version 1.0 |
|
31 | - */ |
|
3 | + * Sprint |
|
4 | + * |
|
5 | + * A set of power tools to enhance the CodeIgniter framework and provide consistent workflow. |
|
6 | + * |
|
7 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
8 | + * of this software and associated documentation files (the "Software"), to deal |
|
9 | + * in the Software without restriction, including without limitation the rights |
|
10 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
11 | + * copies of the Software, and to permit persons to whom the Software is |
|
12 | + * furnished to do so, subject to the following conditions: |
|
13 | + * |
|
14 | + * The above copyright notice and this permission notice shall be included in |
|
15 | + * all copies or substantial portions of the Software. |
|
16 | + * |
|
17 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
18 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
19 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
20 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
21 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
22 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
23 | + * THE SOFTWARE. |
|
24 | + * |
|
25 | + * @package Sprint |
|
26 | + * @author Lonnie Ezell |
|
27 | + * @copyright Copyright 2014-2015, New Myth Media, LLC (http://newmythmedia.com) |
|
28 | + * @license http://opensource.org/licenses/MIT (MIT) |
|
29 | + * @link http://sprintphp.com |
|
30 | + * @since Version 1.0 |
|
31 | + */ |
|
32 | 32 | |
33 | 33 | interface DocSearchInterface { |
34 | 34 | |
35 | - /** |
|
36 | - * The entry point for performing a search of the documentation. |
|
37 | - * |
|
38 | - * @param null $terms |
|
39 | - * @param array $folders |
|
40 | - * |
|
41 | - * @return array|null |
|
42 | - */ |
|
43 | - public function search($terms = null, $folders = []); |
|
35 | + /** |
|
36 | + * The entry point for performing a search of the documentation. |
|
37 | + * |
|
38 | + * @param null $terms |
|
39 | + * @param array $folders |
|
40 | + * |
|
41 | + * @return array|null |
|
42 | + */ |
|
43 | + public function search($terms = null, $folders = []); |
|
44 | 44 | |
45 | - //-------------------------------------------------------------------- |
|
45 | + //-------------------------------------------------------------------- |
|
46 | 46 | |
47 | - /** |
|
48 | - * Stores the name of the callback method to run to convert the source |
|
49 | - * files to viewable files. By default, this should be used to register |
|
50 | - * a Mardown Extended formatter with the system, but could be used to |
|
51 | - * extend the |
|
52 | - * |
|
53 | - * @param string $callback_name |
|
54 | - * @param bool $cascade // If FALSE the formatting of a component ends here. If TRUE, will be passed to next formatter. |
|
55 | - * @return $this |
|
56 | - */ |
|
57 | - public function registerFormatter($callback_name='', $cascade=false); |
|
47 | + /** |
|
48 | + * Stores the name of the callback method to run to convert the source |
|
49 | + * files to viewable files. By default, this should be used to register |
|
50 | + * a Mardown Extended formatter with the system, but could be used to |
|
51 | + * extend the |
|
52 | + * |
|
53 | + * @param string $callback_name |
|
54 | + * @param bool $cascade // If FALSE the formatting of a component ends here. If TRUE, will be passed to next formatter. |
|
55 | + * @return $this |
|
56 | + */ |
|
57 | + public function registerFormatter($callback_name='', $cascade=false); |
|
58 | 58 | |
59 | - //-------------------------------------------------------------------- |
|
59 | + //-------------------------------------------------------------------- |
|
60 | 60 | |
61 | - /** |
|
62 | - * Runs the text through the registered formatters. |
|
63 | - * |
|
64 | - * @param $str |
|
65 | - * @return mixed |
|
66 | - */ |
|
67 | - public function format($str); |
|
61 | + /** |
|
62 | + * Runs the text through the registered formatters. |
|
63 | + * |
|
64 | + * @param $str |
|
65 | + * @return mixed |
|
66 | + */ |
|
67 | + public function format($str); |
|
68 | 68 | |
69 | - //-------------------------------------------------------------------- |
|
69 | + //-------------------------------------------------------------------- |
|
70 | 70 | |
71 | 71 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | * @param bool $cascade // If FALSE the formatting of a component ends here. If TRUE, will be passed to next formatter. |
55 | 55 | * @return $this |
56 | 56 | */ |
57 | - public function registerFormatter($callback_name='', $cascade=false); |
|
57 | + public function registerFormatter($callback_name = '', $cascade = false); |
|
58 | 58 | |
59 | 59 | //-------------------------------------------------------------------- |
60 | 60 |