@@ -36,11 +36,11 @@ discard block |
||
36 | 36 | { |
37 | 37 | |
38 | 38 | protected $descriptions = [ |
39 | - 'migrate' => ['migrate [$to]', 'Runs the migrations up or down until schema at version \$to'], |
|
40 | - 'quietMigrate' => ['quiteMigrate [$to]', 'Same as migrate but without any feedback.'], |
|
41 | - 'refresh' => ['refresh', 'Runs migrations back to version 0 (uninstall) and then back to the most recent migration.'], |
|
39 | + 'migrate' => ['migrate [$to]', 'Runs the migrations up or down until schema at version \$to'], |
|
40 | + 'quietMigrate' => ['quiteMigrate [$to]', 'Same as migrate but without any feedback.'], |
|
41 | + 'refresh' => ['refresh', 'Runs migrations back to version 0 (uninstall) and then back to the most recent migration.'], |
|
42 | 42 | 'newMigration' => ['newMigration [$name]', 'Creates a new migration file.'], |
43 | - 'seed' => ['seed [$name]', 'Runs the named database seeder.'] |
|
43 | + 'seed' => ['seed [$name]', 'Runs the named database seeder.'] |
|
44 | 44 | ]; |
45 | 45 | |
46 | 46 | protected $long_descriptions = [ |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param bool $silent If TRUE, will NOT display any prompts for verification. |
70 | 70 | * @return bool|void |
71 | 71 | */ |
72 | - public function migrate($type=null, $to = null, $silent = false) |
|
72 | + public function migrate($type = null, $to = null, $silent = false) |
|
73 | 73 | { |
74 | 74 | $this->load->library('migration'); |
75 | 75 | |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | $groups = array_keys($groups); |
91 | 91 | |
92 | 92 | // If it's not in the groups list, then assume it's a module. |
93 | - if (! in_array($type, $groups)) |
|
93 | + if ( ! in_array($type, $groups)) |
|
94 | 94 | { |
95 | 95 | if (strpos($type, 'mod:') !== 0) |
96 | 96 | { |
97 | - $type = 'mod:'. $type; |
|
97 | + $type = 'mod:'.$type; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $current = $this->migration->get_version($type); |
112 | 112 | |
113 | 113 | // Already at the desired version? |
114 | - if ((! is_null($to) && $current == $to) OR (is_null($to) && $current == $latest)) |
|
114 | + if (( ! is_null($to) && $current == $to) OR (is_null($to) && $current == $latest)) |
|
115 | 115 | { |
116 | 116 | return $silent ? true : CLI::write("\tDatabase is already at the desired version ({$current})", 'yellow'); |
117 | 117 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | // to the latest version. |
123 | 123 | if (is_null($to)) { |
124 | 124 | // If we're in silent mode, don't prompt, just go to the latest... |
125 | - if (! $silent) { |
|
125 | + if ( ! $silent) { |
|
126 | 126 | $go_ahead = CLI::prompt('Migrate to the latest available version?', array('y', 'n')); |
127 | 127 | |
128 | 128 | if ($go_ahead == 'n') { |
@@ -130,17 +130,16 @@ discard block |
||
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | - if (! $this->migration->latest($type)) { |
|
134 | - return CLI::error("\n\tERROR: " . $this->migration->error_string() . "\n"); |
|
133 | + if ( ! $this->migration->latest($type)) { |
|
134 | + return CLI::error("\n\tERROR: ".$this->migration->error_string()."\n"); |
|
135 | 135 | } |
136 | 136 | } else { |
137 | 137 | if ($this->migration->version($type, $to) === false) { |
138 | - return CLI::error("\n\tERROR: " . $this->migration->error_string() . "\n"); |
|
138 | + return CLI::error("\n\tERROR: ".$this->migration->error_string()."\n"); |
|
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - return $silent ? true : |
|
143 | - CLI::write("\n\tSuccessfully migrated database from version {$current} to {$target}.\n", 'green'); |
|
142 | + return $silent ? true : CLI::write("\n\tSuccessfully migrated database from version {$current} to {$target}.\n", 'green'); |
|
144 | 143 | } |
145 | 144 | |
146 | 145 | //-------------------------------------------------------------------- |
@@ -154,7 +153,7 @@ discard block |
||
154 | 153 | * @param null $to |
155 | 154 | * @return bool|void |
156 | 155 | */ |
157 | - public function quietMigrate($type='app', $to = null) |
|
156 | + public function quietMigrate($type = 'app', $to = null) |
|
158 | 157 | { |
159 | 158 | return $this->migrate($type, $to, true); |
160 | 159 | } |
@@ -168,7 +167,7 @@ discard block |
||
168 | 167 | * @param string $type The group or module to refresh. |
169 | 168 | * @return mixed |
170 | 169 | */ |
171 | - public function refresh($type=null) |
|
170 | + public function refresh($type = null) |
|
172 | 171 | { |
173 | 172 | $this->load->library('migration'); |
174 | 173 | |
@@ -183,13 +182,13 @@ discard block |
||
183 | 182 | } |
184 | 183 | |
185 | 184 | if ($this->migration->version($type, 0) === false) { |
186 | - return CLI::error("\tERROR: " . $this->migration->error_string()); |
|
185 | + return CLI::error("\tERROR: ".$this->migration->error_string()); |
|
187 | 186 | } |
188 | 187 | |
189 | 188 | CLI::write(CLI::color("\tCleared the database.", 'green')); |
190 | 189 | |
191 | 190 | if ($this->migration->latest($type) === false) { |
192 | - return CLI::error("\tERROR: " . $this->migration->error_string()); |
|
191 | + return CLI::error("\tERROR: ".$this->migration->error_string()); |
|
193 | 192 | } |
194 | 193 | |
195 | 194 | CLI::write("\tRe-installed the database to the latest migration.", 'green'); |
@@ -217,23 +216,23 @@ discard block |
||
217 | 216 | $path = $this->migration->determine_migration_path($type); |
218 | 217 | |
219 | 218 | // Does the alias path exist in our config? |
220 | - if (! $path) { |
|
219 | + if ( ! $path) { |
|
221 | 220 | return CLI::error("\tThe migration path for '{$type}' does not exist.'"); |
222 | 221 | } |
223 | 222 | |
224 | 223 | // Does the path really exist? |
225 | - if (! is_dir($path)) { |
|
224 | + if ( ! is_dir($path)) { |
|
226 | 225 | return CLI::error("\tThe path for '{$type}' is not a directory."); |
227 | 226 | } |
228 | 227 | |
229 | 228 | // Is the folder writeable? |
230 | - if (! is_writeable($path)) { |
|
229 | + if ( ! is_writeable($path)) { |
|
231 | 230 | return CLI::error("\tThe folder for '{$type}' migrations is not writeable."); |
232 | 231 | } |
233 | 232 | |
234 | 233 | $file = $this->migration->make_name($name); |
235 | 234 | |
236 | - $path = rtrim($path, '/') .'/'. $file; |
|
235 | + $path = rtrim($path, '/').'/'.$file; |
|
237 | 236 | |
238 | 237 | $contents = <<<EOT |
239 | 238 | <?php |
@@ -269,7 +268,7 @@ discard block |
||
269 | 268 | $this->load->helper('file'); |
270 | 269 | |
271 | 270 | if (write_file($path, $contents)) { |
272 | - return CLI::write("\tNew migration created: " . CLI::color($file, 'yellow'), 'green'); |
|
271 | + return CLI::write("\tNew migration created: ".CLI::color($file, 'yellow'), 'green'); |
|
273 | 272 | } |
274 | 273 | |
275 | 274 | return CLI::error("\tUnkown error trying to create migration: {$file}", 'red'); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | class Seeder { |
41 | 41 | |
42 | - public $error_string = ''; |
|
42 | + public $error_string = ''; |
|
43 | 43 | |
44 | 44 | protected $ci; |
45 | 45 | |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | //-------------------------------------------------------------------- |
52 | 52 | |
53 | - public function __construct () |
|
53 | + public function __construct() |
|
54 | 54 | { |
55 | - $this->ci =& get_instance(); |
|
55 | + $this->ci = & get_instance(); |
|
56 | 56 | |
57 | 57 | $this->is_cli = $this->ci->input->is_cli_request(); |
58 | 58 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $this->ci->load->dbforge(); |
66 | 66 | |
67 | 67 | // Setup some convenience vars. |
68 | - $this->db =& $this->ci->db; |
|
69 | - $this->dbforge =& $this->ci->dbforge; |
|
68 | + $this->db = & $this->ci->db; |
|
69 | + $this->dbforge = & $this->ci->dbforge; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | //-------------------------------------------------------------------- |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * Run the database seeds. It's where the magic happens. |
77 | 77 | * This method MUST be overridden by child classes. |
78 | 78 | */ |
79 | - public function run () |
|
79 | + public function run() |
|
80 | 80 | { |
81 | 81 | |
82 | 82 | } |
@@ -89,23 +89,23 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @param $class |
91 | 91 | */ |
92 | - public function call ($class) |
|
92 | + public function call($class) |
|
93 | 93 | { |
94 | 94 | if (empty($class)) |
95 | 95 | { |
96 | 96 | // Ask the user... |
97 | - $class = trim( CLI::prompt("Seeder name") ); |
|
97 | + $class = trim(CLI::prompt("Seeder name")); |
|
98 | 98 | |
99 | 99 | if (empty($class)) { |
100 | 100 | return CLI::error("\tNo Seeder was specified."); |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - $path = APPPATH .'database/seeds/'. str_replace('.php', '', $class) .'.php'; |
|
104 | + $path = APPPATH.'database/seeds/'.str_replace('.php', '', $class).'.php'; |
|
105 | 105 | |
106 | 106 | if ( ! is_file($path)) |
107 | 107 | { |
108 | - return CLI::error("\tUnable to find seed class: ". $class); |
|
108 | + return CLI::error("\tUnable to find seed class: ".$class); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | try { |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | | if realpath cannot find/read the folder. |
58 | 58 | */ |
59 | 59 | $config['docs.folders'] = [ |
60 | - 'application' => APPPATH .'docs', |
|
61 | - 'developer' => APPPATH .'../myth/_docs_src' |
|
60 | + 'application' => APPPATH.'docs', |
|
61 | + 'developer' => APPPATH.'../myth/_docs_src' |
|
62 | 62 | ]; |
63 | 63 | |
64 | 64 | /* |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | | If you change it, ensure that it includes the period (.). |
90 | 90 | */ |
91 | 91 | |
92 | -$config['docs.extension'] = '.md'; |
|
92 | +$config['docs.extension'] = '.md'; |
|
93 | 93 | |
94 | 94 | /* |
95 | 95 | * If true, the 'developer' docs will be displayed in environments other than |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | $this->load->helper('form'); |
76 | 76 | $this->load->helper('language'); |
77 | 77 | |
78 | - $this->docbuilder = new \Myth\Docs\Builder( array('apppath' => APPPATH) ); |
|
78 | + $this->docbuilder = new \Myth\Docs\Builder(array('apppath' => APPPATH)); |
|
79 | 79 | |
80 | - $formatter = function ($str) { |
|
80 | + $formatter = function($str) { |
|
81 | 81 | $converter = new \League\CommonMark\CommonMarkConverter(); |
82 | 82 | return $converter->convertToHtml($str); |
83 | 83 | }; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | { |
163 | 163 | // Is displaying docs permitted for this environment? |
164 | 164 | if (config_item('docs.permitted_environments') |
165 | - && !in_array(ENVIRONMENT, config_item('docs.permitted_environments')) |
|
165 | + && ! in_array(ENVIRONMENT, config_item('docs.permitted_environments')) |
|
166 | 166 | ) { |
167 | 167 | $this->setMessage(lang('docs_env_disabled'), 'error'); |
168 | 168 | redirect(); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $this->current_group = false; |
178 | 178 | } // Are we allowed to show developer docs in this environment? |
179 | 179 | elseif ($current_group == 'developer' |
180 | - && !$this->showDevDocs |
|
180 | + && ! $this->showDevDocs |
|
181 | 181 | && ENVIRONMENT != 'development' |
182 | 182 | ) { |
183 | 183 | if ($this->showAppDocs) { |
@@ -216,8 +216,8 @@ discard block |
||
216 | 216 | |
217 | 217 | // If nothing left, then assign the default group and redirect to |
218 | 218 | // a page we can do something with... |
219 | - if (!count($segments)) { |
|
220 | - redirect('docs/' . config_item('docs.default_group')); |
|
219 | + if ( ! count($segments)) { |
|
220 | + redirect('docs/'.config_item('docs.default_group')); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | // Do we have a group specified? Bonfire Docs requires that a group |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $data = []; |
249 | 249 | |
250 | 250 | // Set the remaining data for the view |
251 | - $data['docsDir'] = 'docs/' . $this->current_group . '/'; |
|
251 | + $data['docsDir'] = 'docs/'.$this->current_group.'/'; |
|
252 | 252 | $data['docsExt'] = config_item('docs.extension'); |
253 | 253 | |
254 | 254 | $data['docMap'] = $this->docbuilder->buildDocumentMap($content); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | private function buildTOC() |
269 | 269 | { |
270 | - $folder = $this->doc_folders[$this->current_group] . '/'; |
|
270 | + $folder = $this->doc_folders[$this->current_group].'/'; |
|
271 | 271 | |
272 | 272 | $map = $this->docbuilder->buildTOC($folder); |
273 | 273 | |
@@ -291,11 +291,11 @@ discard block |
||
291 | 291 | $docs_modules = array(); |
292 | 292 | foreach (\Bonfire\Modules::list_modules() as $module) { |
293 | 293 | $ignored_folders = array(); |
294 | - $path = \Bonfire\Modules::path($module) . $this->docsDir; |
|
294 | + $path = \Bonfire\Modules::path($module).$this->docsDir; |
|
295 | 295 | |
296 | 296 | // If these are developer docs, add the folder to the path. |
297 | 297 | if ($this->current_group == $this->docsTypeBf) { |
298 | - $path .= '/' . $this->docsTypeBf; |
|
298 | + $path .= '/'.$this->docsTypeBf; |
|
299 | 299 | } // For Application docs, ignore the 'developers' folder. |
300 | 300 | else { |
301 | 301 | $ignored_folders[] = $this->docsTypeBf; |
@@ -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 ?> |
@@ -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(); ?> |
@@ -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; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | return; |
87 | 87 | } |
88 | 88 | |
89 | - if ( ! (PHP_SAPI === 'cli' || defined('STDIN')) ) |
|
89 | + if ( ! (PHP_SAPI === 'cli' || defined('STDIN'))) |
|
90 | 90 | { |
91 | 91 | throw new \Exception('Cli class cannot be used outside of the command line.'); |
92 | 92 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public static function segment($index) |
112 | 112 | { |
113 | - if (! isset(static::$segments[$index - 1])) |
|
113 | + if ( ! isset(static::$segments[$index - 1])) |
|
114 | 114 | { |
115 | 115 | return null; |
116 | 116 | } |
@@ -202,13 +202,13 @@ discard block |
||
202 | 202 | // E.g: $ready = CLI::prompt('Are you ready?', array('y','n')); |
203 | 203 | if (is_array($args[1])) |
204 | 204 | { |
205 | - list($output, $options)=$args; |
|
205 | + list($output, $options) = $args; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | // E.g: $color = CLI::prompt('What is your favourite color?', 'white'); |
209 | 209 | elseif (is_string($args[1])) |
210 | 210 | { |
211 | - list($output, $default)=$args; |
|
211 | + list($output, $default) = $args; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | break; |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | public static function new_line($num = 1) |
392 | 392 | { |
393 | 393 | // Do it once or more, write with empty string gives us a new line |
394 | - for($i = 0; $i < $num; $i++) |
|
394 | + for ($i = 0; $i < $num; $i++) |
|
395 | 395 | { |
396 | 396 | static::write(); |
397 | 397 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | * @param string $format other formatting to apply. Currently only 'underline' is understood |
428 | 428 | * @return string the color coded string |
429 | 429 | */ |
430 | - public static function color($text, $foreground, $background = null, $format=null) |
|
430 | + public static function color($text, $foreground, $background = null, $format = null) |
|
431 | 431 | { |
432 | 432 | if (static::is_windows() and ! isset($_SERVER['ANSICON'])) |
433 | 433 | { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | throw new \RuntimeException('Invalid CLI foreground color: '.$foreground); |
440 | 440 | } |
441 | 441 | |
442 | - if ( $background !== null and ! array_key_exists($background, static::$background_colors)) |
|
442 | + if ($background !== null and ! array_key_exists($background, static::$background_colors)) |
|
443 | 443 | { |
444 | 444 | throw new \RuntimeException('Invalid CLI background color: '.$background); |
445 | 445 | } |
@@ -463,26 +463,26 @@ discard block |
||
463 | 463 | |
464 | 464 | //-------------------------------------------------------------------- |
465 | 465 | |
466 | - public static function getWidth($default=80) |
|
466 | + public static function getWidth($default = 80) |
|
467 | 467 | { |
468 | 468 | if (static::is_windows()) |
469 | 469 | { |
470 | 470 | return $default; |
471 | 471 | } |
472 | 472 | |
473 | - return (int)shell_exec('tput cols'); |
|
473 | + return (int) shell_exec('tput cols'); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | //-------------------------------------------------------------------- |
477 | 477 | |
478 | - public static function getHeight($default=32) |
|
478 | + public static function getHeight($default = 32) |
|
479 | 479 | { |
480 | 480 | if (static::is_windows()) |
481 | 481 | { |
482 | 482 | return $default; |
483 | 483 | } |
484 | 484 | |
485 | - return (int)shell_exec('tput lines'); |
|
485 | + return (int) shell_exec('tput lines'); |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | //-------------------------------------------------------------------- |
@@ -494,13 +494,13 @@ discard block |
||
494 | 494 | * @param int $thisStep |
495 | 495 | * @param int $totalSteps |
496 | 496 | */ |
497 | - public static function showProgress($thisStep=1, $totalSteps=10) |
|
497 | + public static function showProgress($thisStep = 1, $totalSteps = 10) |
|
498 | 498 | { |
499 | 499 | // The first time through, save |
500 | 500 | // our position so the script knows where to go |
501 | 501 | // back to when writing the bar, and |
502 | 502 | // at the end of the script. |
503 | - if (! static::$inProgress) { |
|
503 | + if ( ! static::$inProgress) { |
|
504 | 504 | fwrite(STDOUT, "\0337"); |
505 | 505 | static::$inProgress = true; |
506 | 506 | } |
@@ -513,13 +513,13 @@ discard block |
||
513 | 513 | $thisStep = abs($thisStep); |
514 | 514 | $totalSteps = $totalSteps < 1 ? 1 : $totalSteps; |
515 | 515 | |
516 | - $percent = intval( ($thisStep / $totalSteps) * 100 ); |
|
517 | - $step = (int)round($percent / 10); |
|
516 | + $percent = intval(($thisStep / $totalSteps) * 100); |
|
517 | + $step = (int) round($percent / 10); |
|
518 | 518 | |
519 | 519 | // Write the progress bar |
520 | - fwrite(STDOUT, "[\033[32m" . str_repeat('#', $step) . str_repeat('.', 10 - $step) . "\033[0m]"); |
|
520 | + fwrite(STDOUT, "[\033[32m".str_repeat('#', $step).str_repeat('.', 10 - $step)."\033[0m]"); |
|
521 | 521 | // Textual representation... |
522 | - fwrite(STDOUT, " {$percent}% Complete" . PHP_EOL); |
|
522 | + fwrite(STDOUT, " {$percent}% Complete".PHP_EOL); |
|
523 | 523 | // Move up, undo the PHP_EOL |
524 | 524 | fwrite(STDOUT, "\033[1A"); |
525 | 525 | } |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | */ |
571 | 571 | public static function optionString() |
572 | 572 | { |
573 | - if (! count(static::$options)) |
|
573 | + if ( ! count(static::$options)) |
|
574 | 574 | { |
575 | 575 | return ''; |
576 | 576 | } |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | // so it will pass correctly. |
584 | 584 | if (strpos($value, ' ') !== false) |
585 | 585 | { |
586 | - $value = '"'. $value .'"'; |
|
586 | + $value = '"'.$value.'"'; |
|
587 | 587 | } |
588 | 588 | $out .= "-{$name} $value "; |
589 | 589 | } |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * @param int $max |
609 | 609 | * @param int $pad_left |
610 | 610 | */ |
611 | - public static function wrap($string=null, $max=0, $pad_left=0) |
|
611 | + public static function wrap($string = null, $max = 0, $pad_left = 0) |
|
612 | 612 | { |
613 | 613 | if (empty($string)) |
614 | 614 | { |
@@ -630,13 +630,13 @@ discard block |
||
630 | 630 | $lines = wordwrap($string, $max); |
631 | 631 | |
632 | 632 | if ($pad_left > 0) { |
633 | - $lines = explode( "\n", $lines ); |
|
633 | + $lines = explode("\n", $lines); |
|
634 | 634 | |
635 | 635 | $first = true; |
636 | 636 | |
637 | - array_walk( $lines, function ( &$line, $index ) use($max, $pad_left, &$first) { |
|
638 | - if (! $first) { |
|
639 | - $line = str_repeat( " ", $pad_left ) . $line; |
|
637 | + array_walk($lines, function(&$line, $index) use($max, $pad_left, &$first) { |
|
638 | + if ( ! $first) { |
|
639 | + $line = str_repeat(" ", $pad_left).$line; |
|
640 | 640 | } |
641 | 641 | else |
642 | 642 | { |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | { |
669 | 669 | // If there's no '-' at the beginning of the argument |
670 | 670 | // then add it to our segments. |
671 | - if (! $options_found && strpos($_SERVER['argv'][$i], '-') === false) |
|
671 | + if ( ! $options_found && strpos($_SERVER['argv'][$i], '-') === false) |
|
672 | 672 | { |
673 | 673 | self::$segments[] = $_SERVER['argv'][$i]; |
674 | 674 | continue; |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | $value = null; |
686 | 686 | |
687 | 687 | // If the next item starts with a dash it's a value |
688 | - if (isset($_SERVER['argv'][$i + 1]) && substr($_SERVER['argv'][$i + 1], 0, 1) != '-' ) |
|
688 | + if (isset($_SERVER['argv'][$i + 1]) && substr($_SERVER['argv'][$i + 1], 0, 1) != '-') |
|
689 | 689 | { |
690 | 690 | $value = $_SERVER['argv'][$i + 1]; |
691 | 691 | $i++; |
@@ -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 | //-------------------------------------------------------------------- |