@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function __construct($stdout = null, $stderr = null, $stdin = null) { |
58 | 58 | parent::__construct($stdout, $stderr, $stdin); |
59 | - $this->path = APP . 'Test' . DS . 'Fixture' . DS; |
|
59 | + $this->path = APP.'Test'.DS.'Fixture'.DS; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | if (isset($this->args[0])) { |
114 | 114 | $this->interactive = false; |
115 | - if (!isset($this->connection)) { |
|
115 | + if ( ! isset($this->connection)) { |
|
116 | 116 | $this->connection = 'default'; |
117 | 117 | } |
118 | 118 | if (strtolower($this->args[0]) === 'all') { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | foreach ($tables as $table) { |
137 | 137 | $model = $this->_modelName($table); |
138 | 138 | $importOptions = array(); |
139 | - if (!empty($this->params['schema'])) { |
|
139 | + if ( ! empty($this->params['schema'])) { |
|
140 | 140 | $importOptions['schema'] = $model; |
141 | 141 | } |
142 | 142 | $this->bake($model, false, $importOptions); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $this->out(__d('cake_console', "Bake Fixture\nPath: %s", $this->getPath())); |
155 | 155 | $this->hr(); |
156 | 156 | |
157 | - if (!isset($this->connection)) { |
|
157 | + if ( ! isset($this->connection)) { |
|
158 | 158 | $this->connection = $this->DbConfig->getConfig(); |
159 | 159 | } |
160 | 160 | $modelName = $this->Model->getName($this->connection); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function importOptions($modelName) { |
173 | 173 | $options = array(); |
174 | 174 | |
175 | - if (!empty($this->params['schema'])) { |
|
175 | + if ( ! empty($this->params['schema'])) { |
|
176 | 176 | $options['schema'] = $modelName; |
177 | 177 | } else { |
178 | 178 | $doSchema = $this->in(__d('cake_console', 'Would you like to import schema for this fixture?'), array('y', 'n'), 'n'); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $options['schema'] = $modelName; |
181 | 181 | } |
182 | 182 | } |
183 | - if (!empty($this->params['records'])) { |
|
183 | + if ( ! empty($this->params['records'])) { |
|
184 | 184 | $doRecords = 'y'; |
185 | 185 | } else { |
186 | 186 | $doRecords = $this->in(__d('cake_console', 'Would you like to use record importing for this fixture?'), array('y', 'n'), 'n'); |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | $table = $schema = $records = $import = $modelImport = null; |
212 | 212 | $importBits = array(); |
213 | 213 | |
214 | - if (!$useTable) { |
|
214 | + if ( ! $useTable) { |
|
215 | 215 | $useTable = Inflector::tableize($model); |
216 | 216 | } elseif ($useTable != Inflector::tableize($model)) { |
217 | 217 | $table = $useTable; |
218 | 218 | } |
219 | 219 | |
220 | - if (!empty($importOptions)) { |
|
220 | + if ( ! empty($importOptions)) { |
|
221 | 221 | if (isset($importOptions['schema'])) { |
222 | 222 | $modelImport = true; |
223 | 223 | $importBits[] = "'model' => '{$importOptions['schema']}'"; |
@@ -228,15 +228,15 @@ discard block |
||
228 | 228 | if ($this->connection !== 'default') { |
229 | 229 | $importBits[] .= "'connection' => '{$this->connection}'"; |
230 | 230 | } |
231 | - if (!empty($importBits)) { |
|
231 | + if ( ! empty($importBits)) { |
|
232 | 232 | $import = sprintf("array(%s)", implode(', ', $importBits)); |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | 236 | $this->_Schema = new CakeSchema(); |
237 | 237 | $data = $this->_Schema->read(array('models' => false, 'connection' => $this->connection)); |
238 | - if (!isset($data['tables'][$useTable])) { |
|
239 | - $this->error('Could not find your selected table ' . $useTable); |
|
238 | + if ( ! isset($data['tables'][$useTable])) { |
|
239 | + $this->error('Could not find your selected table '.$useTable); |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | |
@@ -245,14 +245,14 @@ discard block |
||
245 | 245 | $schema = $this->_generateSchema($tableInfo); |
246 | 246 | } |
247 | 247 | |
248 | - if (empty($importOptions['records']) && !isset($importOptions['fromTable'])) { |
|
248 | + if (empty($importOptions['records']) && ! isset($importOptions['fromTable'])) { |
|
249 | 249 | $recordCount = 1; |
250 | 250 | if (isset($this->params['count'])) { |
251 | 251 | $recordCount = $this->params['count']; |
252 | 252 | } |
253 | 253 | $records = $this->_makeRecordString($this->_generateRecords($tableInfo, $recordCount)); |
254 | 254 | } |
255 | - if (!empty($this->params['records']) || isset($importOptions['fromTable'])) { |
|
255 | + if ( ! empty($this->params['records']) || isset($importOptions['fromTable'])) { |
|
256 | 256 | $records = $this->_makeRecordString($this->_getRecordsFromTable($model, $useTable)); |
257 | 257 | } |
258 | 258 | $out = $this->generateFixtureFile($model, compact('records', 'table', 'schema', 'import')); |
@@ -271,14 +271,14 @@ discard block |
||
271 | 271 | $vars = array_merge($defaults, $otherVars); |
272 | 272 | |
273 | 273 | $path = $this->getPath(); |
274 | - $filename = Inflector::camelize($model) . 'Fixture.php'; |
|
274 | + $filename = Inflector::camelize($model).'Fixture.php'; |
|
275 | 275 | |
276 | 276 | $this->Template->set('model', $model); |
277 | 277 | $this->Template->set($vars); |
278 | 278 | $content = $this->Template->generate('classes', 'fixture'); |
279 | 279 | |
280 | - $this->out("\n" . __d('cake_console', 'Baking test fixture for %s...', $model), 1, Shell::QUIET); |
|
281 | - $this->createFile($path . $filename, $content); |
|
280 | + $this->out("\n".__d('cake_console', 'Baking test fixture for %s...', $model), 1, Shell::QUIET); |
|
281 | + $this->createFile($path.$filename, $content); |
|
282 | 282 | return $content; |
283 | 283 | } |
284 | 284 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | public function getPath() { |
291 | 291 | $path = $this->path; |
292 | 292 | if (isset($this->plugin)) { |
293 | - $path = $this->_pluginPath($this->plugin) . 'Test' . DS . 'Fixture' . DS; |
|
293 | + $path = $this->_pluginPath($this->plugin).'Test'.DS.'Fixture'.DS; |
|
294 | 294 | } |
295 | 295 | return $path; |
296 | 296 | } |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | $insert = String::uuid(); |
338 | 338 | } else { |
339 | 339 | $insert = "Lorem ipsum dolor sit amet"; |
340 | - if (!empty($fieldInfo['length'])) { |
|
341 | - $insert = substr($insert, 0, (int)$fieldInfo['length'] - 2); |
|
340 | + if ( ! empty($fieldInfo['length'])) { |
|
341 | + $insert = substr($insert, 0, (int) $fieldInfo['length'] - 2); |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | break; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | if ($this->interactive) { |
412 | 412 | $condition = null; |
413 | 413 | $prompt = __d('cake_console', "Please provide a SQL fragment to use as conditions\nExample: WHERE 1=1"); |
414 | - while (!$condition) { |
|
414 | + while ( ! $condition) { |
|
415 | 415 | $condition = $this->in($prompt, null, 'WHERE 1=1'); |
416 | 416 | } |
417 | 417 | $prompt = __d('cake_console', "How many records do you want to import?"); |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $row = array(); |
434 | 434 | foreach ($record[$modelObject->alias] as $field => $value) { |
435 | 435 | if ($schema[$field]['type'] === 'boolean') { |
436 | - $value = (int)(bool)$value; |
|
436 | + $value = (int) (bool) $value; |
|
437 | 437 | } |
438 | 438 | $row[$field] = $value; |
439 | 439 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function initialize() { |
49 | 49 | $this->path = current(App::path('plugins')); |
50 | - $this->bootstrap = APP . 'Config' . DS . 'bootstrap.php'; |
|
50 | + $this->bootstrap = APP.'Config'.DS.'bootstrap.php'; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | $plugin = $this->in(__d('cake_console', 'Enter the name of the plugin in CamelCase format')); |
82 | 82 | } |
83 | 83 | |
84 | - if (!$this->bake($plugin)) { |
|
85 | - $this->error(__d('cake_console', "An error occurred trying to bake: %s in %s", $plugin, $this->path . $plugin)); |
|
84 | + if ( ! $this->bake($plugin)) { |
|
85 | + $this->error(__d('cake_console', "An error occurred trying to bake: %s in %s", $plugin, $this->path.$plugin)); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
@@ -99,33 +99,33 @@ discard block |
||
99 | 99 | } |
100 | 100 | $this->hr(); |
101 | 101 | $this->out(__d('cake_console', "<info>Plugin Name:</info> %s", $plugin)); |
102 | - $this->out(__d('cake_console', "<info>Plugin Directory:</info> %s", $this->path . $plugin)); |
|
102 | + $this->out(__d('cake_console', "<info>Plugin Directory:</info> %s", $this->path.$plugin)); |
|
103 | 103 | $this->hr(); |
104 | 104 | |
105 | 105 | $looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n', 'q'), 'y'); |
106 | 106 | |
107 | 107 | if (strtolower($looksGood) === 'y') { |
108 | - $Folder = new Folder($this->path . $plugin); |
|
108 | + $Folder = new Folder($this->path.$plugin); |
|
109 | 109 | $directories = array( |
110 | - 'Config' . DS . 'Schema', |
|
111 | - 'Model' . DS . 'Behavior', |
|
112 | - 'Model' . DS . 'Datasource', |
|
113 | - 'Console' . DS . 'Command' . DS . 'Task', |
|
114 | - 'Controller' . DS . 'Component', |
|
110 | + 'Config'.DS.'Schema', |
|
111 | + 'Model'.DS.'Behavior', |
|
112 | + 'Model'.DS.'Datasource', |
|
113 | + 'Console'.DS.'Command'.DS.'Task', |
|
114 | + 'Controller'.DS.'Component', |
|
115 | 115 | 'Lib', |
116 | - 'View' . DS . 'Helper', |
|
117 | - 'Test' . DS . 'Case' . DS . 'Controller' . DS . 'Component', |
|
118 | - 'Test' . DS . 'Case' . DS . 'View' . DS . 'Helper', |
|
119 | - 'Test' . DS . 'Case' . DS . 'Model' . DS . 'Behavior', |
|
120 | - 'Test' . DS . 'Fixture', |
|
116 | + 'View'.DS.'Helper', |
|
117 | + 'Test'.DS.'Case'.DS.'Controller'.DS.'Component', |
|
118 | + 'Test'.DS.'Case'.DS.'View'.DS.'Helper', |
|
119 | + 'Test'.DS.'Case'.DS.'Model'.DS.'Behavior', |
|
120 | + 'Test'.DS.'Fixture', |
|
121 | 121 | 'Vendor', |
122 | 122 | 'webroot' |
123 | 123 | ); |
124 | 124 | |
125 | 125 | foreach ($directories as $directory) { |
126 | - $dirPath = $this->path . $plugin . DS . $directory; |
|
126 | + $dirPath = $this->path.$plugin.DS.$directory; |
|
127 | 127 | $Folder->create($dirPath); |
128 | - new File($dirPath . DS . 'empty', true); |
|
128 | + new File($dirPath.DS.'empty', true); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | foreach ($Folder->messages() as $message) { |
@@ -133,33 +133,33 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | $errors = $Folder->errors(); |
136 | - if (!empty($errors)) { |
|
136 | + if ( ! empty($errors)) { |
|
137 | 137 | foreach ($errors as $message) { |
138 | 138 | $this->error($message); |
139 | 139 | } |
140 | 140 | return false; |
141 | 141 | } |
142 | 142 | |
143 | - $controllerFileName = $plugin . 'AppController.php'; |
|
143 | + $controllerFileName = $plugin.'AppController.php'; |
|
144 | 144 | |
145 | 145 | $out = "<?php\n\n"; |
146 | 146 | $out .= "App::uses('AppController', 'Controller');\n\n"; |
147 | 147 | $out .= "class {$plugin}AppController extends AppController {\n\n"; |
148 | 148 | $out .= "}\n"; |
149 | - $this->createFile($this->path . $plugin . DS . 'Controller' . DS . $controllerFileName, $out); |
|
149 | + $this->createFile($this->path.$plugin.DS.'Controller'.DS.$controllerFileName, $out); |
|
150 | 150 | |
151 | - $modelFileName = $plugin . 'AppModel.php'; |
|
151 | + $modelFileName = $plugin.'AppModel.php'; |
|
152 | 152 | |
153 | 153 | $out = "<?php\n\n"; |
154 | 154 | $out .= "App::uses('AppModel', 'Model');\n\n"; |
155 | 155 | $out .= "class {$plugin}AppModel extends AppModel {\n\n"; |
156 | 156 | $out .= "}\n"; |
157 | - $this->createFile($this->path . $plugin . DS . 'Model' . DS . $modelFileName, $out); |
|
157 | + $this->createFile($this->path.$plugin.DS.'Model'.DS.$modelFileName, $out); |
|
158 | 158 | |
159 | 159 | $this->_modifyBootstrap($plugin); |
160 | 160 | |
161 | 161 | $this->hr(); |
162 | - $this->out(__d('cake_console', '<success>Created:</success> %s in %s', $plugin, $this->path . $plugin), 2); |
|
162 | + $this->out(__d('cake_console', '<success>Created:</success> %s in %s', $plugin, $this->path.$plugin), 2); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | return true; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | protected function _modifyBootstrap($plugin) { |
175 | 175 | $bootstrap = new File($this->bootstrap, false); |
176 | 176 | $contents = $bootstrap->read(); |
177 | - if (!preg_match("@\n\s*CakePlugin::loadAll@", $contents)) { |
|
177 | + if ( ! preg_match("@\n\s*CakePlugin::loadAll@", $contents)) { |
|
178 | 178 | $bootstrap->append("\nCakePlugin::load('$plugin', array('bootstrap' => false, 'routes' => false));\n"); |
179 | 179 | $this->out(''); |
180 | 180 | $this->out(__d('cake_dev', '%s modified', $this->bootstrap)); |
@@ -190,16 +190,16 @@ discard block |
||
190 | 190 | public function findPath($pathOptions) { |
191 | 191 | $valid = false; |
192 | 192 | foreach ($pathOptions as $i => $path) { |
193 | - if (!is_dir($path)) { |
|
193 | + if ( ! is_dir($path)) { |
|
194 | 194 | unset($pathOptions[$i]); |
195 | 195 | } |
196 | 196 | } |
197 | 197 | $pathOptions = array_values($pathOptions); |
198 | 198 | |
199 | 199 | $max = count($pathOptions); |
200 | - while (!$valid) { |
|
200 | + while ( ! $valid) { |
|
201 | 201 | foreach ($pathOptions as $i => $option) { |
202 | - $this->out($i + 1 . '. ' . $option); |
|
202 | + $this->out($i + 1.'. '.$option); |
|
203 | 203 | } |
204 | 204 | $prompt = __d('cake_console', 'Choose a plugin path from the paths above.'); |
205 | 205 | $choice = $this->in($prompt, null, 1); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | public function getOptionParser() { |
219 | 219 | $parser = parent::getOptionParser(); |
220 | 220 | return $parser->description(__d('cake_console', |
221 | - 'Create the directory structure, AppModel and AppController classes for a new plugin. ' . |
|
221 | + 'Create the directory structure, AppModel and AppController classes for a new plugin. '. |
|
222 | 222 | 'Can create plugins in any of your bootstrapped plugin paths.' |
223 | 223 | ))->addArgument('name', array( |
224 | 224 | 'help' => __d('cake_console', 'CamelCased name of the plugin to create.') |
@@ -108,7 +108,7 @@ |
||
108 | 108 | * @param string|array $one A string or an array of data. |
109 | 109 | * @param string|array $two Value in case $one is a string (which then works as the key). |
110 | 110 | * Unused if $one is an associative array, otherwise serves as the values to $one's keys. |
111 | - * @return void |
|
111 | + * @return false|null |
|
112 | 112 | */ |
113 | 113 | public function set($one, $two = null) { |
114 | 114 | if (is_array($one)) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function execute() { |
84 | 84 | parent::execute(); |
85 | 85 | $count = count($this->args); |
86 | - if (!$count) { |
|
86 | + if ( ! $count) { |
|
87 | 87 | $this->_interactive(); |
88 | 88 | } |
89 | 89 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | |
115 | 115 | if ($type) { |
116 | 116 | $type = Inflector::camelize($type); |
117 | - if (!isset($this->classTypes[$type])) { |
|
117 | + if ( ! isset($this->classTypes[$type])) { |
|
118 | 118 | $this->error(__d('cake_console', 'Incorrect type provided. Please choose one of %s', implode(', ', array_keys($this->classTypes)))); |
119 | 119 | } |
120 | 120 | } else { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | public function bake($type, $className) { |
135 | 135 | $plugin = null; |
136 | 136 | if ($this->plugin) { |
137 | - $plugin = $this->plugin . '.'; |
|
137 | + $plugin = $this->plugin.'.'; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | $realType = $this->mapType($type, $plugin); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | list($preConstruct, $construction, $postConstruct) = $this->generateConstructor($type, $fullClassName, $plugin); |
160 | 160 | $uses = $this->generateUses($type, $realType, $fullClassName); |
161 | 161 | |
162 | - $this->out("\n" . __d('cake_console', 'Baking test case for %s %s ...', $className, $type), 1, Shell::QUIET); |
|
162 | + $this->out("\n".__d('cake_console', 'Baking test case for %s %s ...', $className, $type), 1, Shell::QUIET); |
|
163 | 163 | |
164 | 164 | $this->Template->set('fixtures', $this->_fixtures); |
165 | 165 | $this->Template->set('plugin', $plugin); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $keys = array(); |
192 | 192 | $i = 0; |
193 | 193 | foreach ($this->classTypes as $option => $package) { |
194 | - $this->out(++$i . '. ' . $option); |
|
194 | + $this->out(++$i.'. '.$option); |
|
195 | 195 | $keys[] = $i; |
196 | 196 | } |
197 | 197 | $keys[] = 'q'; |
@@ -214,15 +214,15 @@ discard block |
||
214 | 214 | $typeLength = strlen($type); |
215 | 215 | $type = $this->classTypes[$type]; |
216 | 216 | if ($this->plugin) { |
217 | - $plugin = $this->plugin . '.'; |
|
218 | - $options = App::objects($plugin . $type); |
|
217 | + $plugin = $this->plugin.'.'; |
|
218 | + $options = App::objects($plugin.$type); |
|
219 | 219 | } else { |
220 | 220 | $options = App::objects($type); |
221 | 221 | } |
222 | 222 | $this->out(__d('cake_console', 'Choose a %s class', $objectType)); |
223 | 223 | $keys = array(); |
224 | 224 | foreach ($options as $key => $option) { |
225 | - $this->out(++$key . '. ' . $option); |
|
225 | + $this->out(++$key.'. '.$option); |
|
226 | 226 | $keys[] = $key; |
227 | 227 | } |
228 | 228 | while (empty($selection)) { |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | if ($position !== false && (strlen($class) - $position) === strlen($type)) { |
306 | 306 | return $class; |
307 | 307 | } |
308 | - return $class . $type; |
|
308 | + return $class.$type; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | } |
324 | 324 | $real = $this->classTypes[$type]; |
325 | 325 | if ($plugin) { |
326 | - $real = trim($plugin, '.') . '.' . $real; |
|
326 | + $real = trim($plugin, '.').'.'.$real; |
|
327 | 327 | } |
328 | 328 | return $real; |
329 | 329 | } |
@@ -392,16 +392,16 @@ discard block |
||
392 | 392 | $associated = $subject->getAssociated(); |
393 | 393 | foreach ($associated as $alias => $type) { |
394 | 394 | $className = $subject->{$alias}->name; |
395 | - if (!isset($this->_fixtures[$className])) { |
|
395 | + if ( ! isset($this->_fixtures[$className])) { |
|
396 | 396 | $this->_processModel($subject->{$alias}); |
397 | 397 | } |
398 | 398 | if ($type === 'hasAndBelongsToMany') { |
399 | - if (!empty($subject->hasAndBelongsToMany[$alias]['with'])) { |
|
399 | + if ( ! empty($subject->hasAndBelongsToMany[$alias]['with'])) { |
|
400 | 400 | list(, $joinModel) = pluginSplit($subject->hasAndBelongsToMany[$alias]['with']); |
401 | 401 | } else { |
402 | 402 | $joinModel = Inflector::classify($subject->hasAndBelongsToMany[$alias]['joinTable']); |
403 | 403 | } |
404 | - if (!isset($this->_fixtures[$joinModel])) { |
|
404 | + if ( ! isset($this->_fixtures[$joinModel])) { |
|
405 | 405 | $this->_processModel($subject->{$joinModel}); |
406 | 406 | } |
407 | 407 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | protected function _processController($subject) { |
419 | 419 | $subject->constructClasses(); |
420 | 420 | $models = array(Inflector::classify($subject->name)); |
421 | - if (!empty($subject->uses)) { |
|
421 | + if ( ! empty($subject->uses)) { |
|
422 | 422 | $models = $subject->uses; |
423 | 423 | } |
424 | 424 | foreach ($models as $model) { |
@@ -436,11 +436,11 @@ discard block |
||
436 | 436 | */ |
437 | 437 | protected function _addFixture($name) { |
438 | 438 | if ($this->plugin) { |
439 | - $prefix = 'plugin.' . Inflector::underscore($this->plugin) . '.'; |
|
439 | + $prefix = 'plugin.'.Inflector::underscore($this->plugin).'.'; |
|
440 | 440 | } else { |
441 | 441 | $prefix = 'app.'; |
442 | 442 | } |
443 | - $fixture = $prefix . Inflector::underscore($name); |
|
443 | + $fixture = $prefix.Inflector::underscore($name); |
|
444 | 444 | $this->_fixtures[$name] = $fixture; |
445 | 445 | } |
446 | 446 | |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | * @return string filename the test should be created on. |
534 | 534 | */ |
535 | 535 | public function testCaseFileName($type, $className) { |
536 | - $path = $this->getPath() . 'Case' . DS; |
|
536 | + $path = $this->getPath().'Case'.DS; |
|
537 | 537 | $type = Inflector::camelize($type); |
538 | 538 | if (isset($this->classTypes[$type])) { |
539 | - $path .= $this->classTypes[$type] . DS; |
|
539 | + $path .= $this->classTypes[$type].DS; |
|
540 | 540 | } |
541 | 541 | $className = $this->getRealClassName($type, $className); |
542 | - return str_replace('/', DS, $path) . Inflector::camelize($className) . 'Test.php'; |
|
542 | + return str_replace('/', DS, $path).Inflector::camelize($className).'Test.php'; |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | if ($this->params['dry-run']) { |
72 | 72 | $this->out(__d('cake_console', '<warning>Dry-run mode enabled!</warning>'), 1, Shell::QUIET); |
73 | 73 | } |
74 | - if ($this->params['git'] && !is_dir('.git')) { |
|
74 | + if ($this->params['git'] && ! is_dir('.git')) { |
|
75 | 75 | $this->out(__d('cake_console', '<warning>No git repository detected!</warning>'), 1, Shell::QUIET); |
76 | 76 | } |
77 | 77 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | * @return void |
101 | 101 | */ |
102 | 102 | public function tests() { |
103 | - $this->_paths = array(APP . 'tests' . DS); |
|
104 | - if (!empty($this->params['plugin'])) { |
|
105 | - $this->_paths = array(App::pluginPath($this->params['plugin']) . 'tests' . DS); |
|
103 | + $this->_paths = array(APP.'tests'.DS); |
|
104 | + if ( ! empty($this->params['plugin'])) { |
|
105 | + $this->_paths = array(App::pluginPath($this->params['plugin']).'tests'.DS); |
|
106 | 106 | } |
107 | 107 | $patterns = array( |
108 | 108 | array( |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | public function locations() { |
128 | 128 | $cwd = getcwd(); |
129 | 129 | |
130 | - if (!empty($this->params['plugin'])) { |
|
130 | + if ( ! empty($this->params['plugin'])) { |
|
131 | 131 | chdir(App::pluginPath($this->params['plugin'])); |
132 | 132 | } |
133 | 133 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $Folder = new Folder('plugins'); |
136 | 136 | list($plugins) = $Folder->read(); |
137 | 137 | foreach ($plugins as $plugin) { |
138 | - chdir($cwd . DS . 'plugins' . DS . $plugin); |
|
138 | + chdir($cwd.DS.'plugins'.DS.$plugin); |
|
139 | 139 | $this->out(__d('cake_console', 'Upgrading locations for plugin %s', $plugin)); |
140 | 140 | $this->locations(); |
141 | 141 | } |
@@ -145,24 +145,24 @@ discard block |
||
145 | 145 | } |
146 | 146 | $moves = array( |
147 | 147 | 'config' => 'Config', |
148 | - 'Config' . DS . 'schema' => 'Config' . DS . 'Schema', |
|
148 | + 'Config'.DS.'schema' => 'Config'.DS.'Schema', |
|
149 | 149 | 'libs' => 'Lib', |
150 | 150 | 'tests' => 'Test', |
151 | 151 | 'views' => 'View', |
152 | 152 | 'models' => 'Model', |
153 | - 'Model' . DS . 'behaviors' => 'Model' . DS . 'Behavior', |
|
154 | - 'Model' . DS . 'datasources' => 'Model' . DS . 'Datasource', |
|
155 | - 'Test' . DS . 'cases' => 'Test' . DS . 'Case', |
|
156 | - 'Test' . DS . 'fixtures' => 'Test' . DS . 'Fixture', |
|
157 | - 'vendors' . DS . 'shells' . DS . 'templates' => 'Console' . DS . 'Templates', |
|
153 | + 'Model'.DS.'behaviors' => 'Model'.DS.'Behavior', |
|
154 | + 'Model'.DS.'datasources' => 'Model'.DS.'Datasource', |
|
155 | + 'Test'.DS.'cases' => 'Test'.DS.'Case', |
|
156 | + 'Test'.DS.'fixtures' => 'Test'.DS.'Fixture', |
|
157 | + 'vendors'.DS.'shells'.DS.'templates' => 'Console'.DS.'Templates', |
|
158 | 158 | ); |
159 | 159 | foreach ($moves as $old => $new) { |
160 | 160 | if (is_dir($old)) { |
161 | 161 | $this->out(__d('cake_console', 'Moving %s to %s', $old, $new)); |
162 | - if (!$this->params['dry-run']) { |
|
162 | + if ( ! $this->params['dry-run']) { |
|
163 | 163 | if ($this->params['git']) { |
164 | - exec('git mv -f ' . escapeshellarg($old) . ' ' . escapeshellarg($old . '__')); |
|
165 | - exec('git mv -f ' . escapeshellarg($old . '__') . ' ' . escapeshellarg($new)); |
|
164 | + exec('git mv -f '.escapeshellarg($old).' '.escapeshellarg($old.'__')); |
|
165 | + exec('git mv -f '.escapeshellarg($old.'__').' '.escapeshellarg($new)); |
|
166 | 166 | } else { |
167 | 167 | $Folder = new Folder($old); |
168 | 168 | $Folder->move($new); |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | public function helpers() { |
215 | 215 | $this->_paths = array_diff(App::path('views'), App::core('views')); |
216 | 216 | |
217 | - if (!empty($this->params['plugin'])) { |
|
218 | - $this->_paths = array(App::pluginPath($this->params['plugin']) . 'views' . DS); |
|
217 | + if ( ! empty($this->params['plugin'])) { |
|
218 | + $this->_paths = array(App::pluginPath($this->params['plugin']).'views'.DS); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | $patterns = array(); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | CakePlugin::load($plugin); |
230 | 230 | $pluginHelpers = array_merge( |
231 | 231 | $pluginHelpers, |
232 | - App::objects('helper', App::pluginPath($plugin) . DS . 'views' . DS . 'helpers' . DS, false) |
|
232 | + App::objects('helper', App::pluginPath($plugin).DS.'views'.DS.'helpers'.DS, false) |
|
233 | 233 | ); |
234 | 234 | } |
235 | 235 | $helpers = array_merge($pluginHelpers, $helpers); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $this->_paths = array( |
260 | 260 | APP |
261 | 261 | ); |
262 | - if (!empty($this->params['plugin'])) { |
|
262 | + if ( ! empty($this->params['plugin'])) { |
|
263 | 263 | $this->_paths = array(App::pluginPath($this->params['plugin'])); |
264 | 264 | } |
265 | 265 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $this->_paths = array( |
299 | 299 | APP |
300 | 300 | ); |
301 | - if (!empty($this->params['plugin'])) { |
|
301 | + if ( ! empty($this->params['plugin'])) { |
|
302 | 302 | $this->_paths = array(App::pluginPath($this->params['plugin'])); |
303 | 303 | } |
304 | 304 | $patterns = array( |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | |
354 | 354 | $this->_paths = array_merge($views, $controllers, $components); |
355 | 355 | |
356 | - if (!empty($this->params['plugin'])) { |
|
356 | + if ( ! empty($this->params['plugin'])) { |
|
357 | 357 | $pluginPath = App::pluginPath($this->params['plugin']); |
358 | 358 | $this->_paths = array( |
359 | - $pluginPath . 'controllers' . DS, |
|
360 | - $pluginPath . 'controllers' . DS . 'components' . DS, |
|
361 | - $pluginPath . 'views' . DS, |
|
359 | + $pluginPath.'controllers'.DS, |
|
360 | + $pluginPath.'controllers'.DS.'components'.DS, |
|
361 | + $pluginPath.'views'.DS, |
|
362 | 362 | ); |
363 | 363 | } |
364 | 364 | $patterns = array( |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $this->_paths = array( |
406 | 406 | APP |
407 | 407 | ); |
408 | - if (!empty($this->params['plugin'])) { |
|
408 | + if ( ! empty($this->params['plugin'])) { |
|
409 | 409 | $this->_paths = array(App::pluginPath($this->params['plugin'])); |
410 | 410 | } |
411 | 411 | $patterns = array( |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $this->_paths = array( |
428 | 428 | APP |
429 | 429 | ); |
430 | - if (!empty($this->params['plugin'])) { |
|
430 | + if ( ! empty($this->params['plugin'])) { |
|
431 | 431 | $this->_paths = array(App::pluginPath($this->params['plugin'])); |
432 | 432 | } |
433 | 433 | $patterns = array( |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | */ |
510 | 510 | public function components() { |
511 | 511 | $this->_paths = App::Path('Controller/Component'); |
512 | - if (!empty($this->params['plugin'])) { |
|
512 | + if ( ! empty($this->params['plugin'])) { |
|
513 | 513 | $this->_paths = App::Path('Controller/Component', $this->params['plugin']); |
514 | 514 | } |
515 | 515 | $patterns = array( |
@@ -534,11 +534,11 @@ discard block |
||
534 | 534 | |
535 | 535 | $this->_paths = array_merge($controllers, $components); |
536 | 536 | |
537 | - if (!empty($this->params['plugin'])) { |
|
537 | + if ( ! empty($this->params['plugin'])) { |
|
538 | 538 | $pluginPath = App::pluginPath($this->params['plugin']); |
539 | 539 | $this->_paths = array( |
540 | - $pluginPath . 'controllers' . DS, |
|
541 | - $pluginPath . 'controllers' . DS . 'components' . DS, |
|
540 | + $pluginPath.'controllers'.DS, |
|
541 | + $pluginPath.'controllers'.DS.'components'.DS, |
|
542 | 542 | ); |
543 | 543 | } |
544 | 544 | $patterns = array( |
@@ -569,27 +569,27 @@ discard block |
||
569 | 569 | * @return void |
570 | 570 | */ |
571 | 571 | protected function _moveViewFiles() { |
572 | - if (!is_dir('View')) { |
|
572 | + if ( ! is_dir('View')) { |
|
573 | 573 | return; |
574 | 574 | } |
575 | 575 | |
576 | 576 | $dirs = scandir('View'); |
577 | 577 | foreach ($dirs as $old) { |
578 | - if (!is_dir('View' . DS . $old) || $old === '.' || $old === '..') { |
|
578 | + if ( ! is_dir('View'.DS.$old) || $old === '.' || $old === '..') { |
|
579 | 579 | continue; |
580 | 580 | } |
581 | 581 | |
582 | - $new = 'View' . DS . Inflector::camelize($old); |
|
583 | - $old = 'View' . DS . $old; |
|
582 | + $new = 'View'.DS.Inflector::camelize($old); |
|
583 | + $old = 'View'.DS.$old; |
|
584 | 584 | if ($new === $old) { |
585 | 585 | continue; |
586 | 586 | } |
587 | 587 | |
588 | 588 | $this->out(__d('cake_console', 'Moving %s to %s', $old, $new)); |
589 | - if (!$this->params['dry-run']) { |
|
589 | + if ( ! $this->params['dry-run']) { |
|
590 | 590 | if ($this->params['git']) { |
591 | - exec('git mv -f ' . escapeshellarg($old) . ' ' . escapeshellarg($old . '__')); |
|
592 | - exec('git mv -f ' . escapeshellarg($old . '__') . ' ' . escapeshellarg($new)); |
|
591 | + exec('git mv -f '.escapeshellarg($old).' '.escapeshellarg($old.'__')); |
|
592 | + exec('git mv -f '.escapeshellarg($old.'__').' '.escapeshellarg($new)); |
|
593 | 593 | } else { |
594 | 594 | $Folder = new Folder($old); |
595 | 595 | $Folder->move($new); |
@@ -605,10 +605,10 @@ discard block |
||
605 | 605 | */ |
606 | 606 | protected function _moveAppClasses() { |
607 | 607 | $files = array( |
608 | - APP . 'app_controller.php' => APP . 'Controller' . DS . 'AppController.php', |
|
609 | - APP . 'controllers' . DS . 'app_controller.php' => APP . 'Controller' . DS . 'AppController.php', |
|
610 | - APP . 'app_model.php' => APP . 'Model' . DS . 'AppModel.php', |
|
611 | - APP . 'models' . DS . 'app_model.php' => APP . 'Model' . DS . 'AppModel.php', |
|
608 | + APP.'app_controller.php' => APP.'Controller'.DS.'AppController.php', |
|
609 | + APP.'controllers'.DS.'app_controller.php' => APP.'Controller'.DS.'AppController.php', |
|
610 | + APP.'app_model.php' => APP.'Model'.DS.'AppModel.php', |
|
611 | + APP.'models'.DS.'app_model.php' => APP.'Model'.DS.'AppModel.php', |
|
612 | 612 | ); |
613 | 613 | foreach ($files as $old => $new) { |
614 | 614 | if (file_exists($old)) { |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | continue; |
619 | 619 | } |
620 | 620 | if ($this->params['git']) { |
621 | - exec('git mv -f ' . escapeshellarg($old) . ' ' . escapeshellarg($old . '__')); |
|
622 | - exec('git mv -f ' . escapeshellarg($old . '__') . ' ' . escapeshellarg($new)); |
|
621 | + exec('git mv -f '.escapeshellarg($old).' '.escapeshellarg($old.'__')); |
|
622 | + exec('git mv -f '.escapeshellarg($old.'__').' '.escapeshellarg($new)); |
|
623 | 623 | } else { |
624 | 624 | rename($old, $new); |
625 | 625 | } |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | * @return void |
639 | 639 | */ |
640 | 640 | protected function _movePhpFiles($path, $options) { |
641 | - if (!is_dir($path)) { |
|
641 | + if ( ! is_dir($path)) { |
|
642 | 642 | return; |
643 | 643 | } |
644 | 644 | |
@@ -659,11 +659,11 @@ discard block |
||
659 | 659 | |
660 | 660 | $cwd = getcwd(); |
661 | 661 | foreach ($this->_files as &$file) { |
662 | - $file = $cwd . DS . $file; |
|
662 | + $file = $cwd.DS.$file; |
|
663 | 663 | |
664 | 664 | $contents = file_get_contents($file); |
665 | 665 | preg_match($options['regex'], $contents, $match); |
666 | - if (!$match) { |
|
666 | + if ( ! $match) { |
|
667 | 667 | continue; |
668 | 668 | } |
669 | 669 | |
@@ -681,18 +681,18 @@ discard block |
||
681 | 681 | } |
682 | 682 | |
683 | 683 | preg_match('@^.*[\\\/]plugins[\\\/](.*?)[\\\/]@', $file, $match); |
684 | - $base = $cwd . DS; |
|
684 | + $base = $cwd.DS; |
|
685 | 685 | $plugin = false; |
686 | 686 | if ($match) { |
687 | 687 | $base = $match[0]; |
688 | 688 | $plugin = $match[1]; |
689 | 689 | } |
690 | 690 | |
691 | - if ($options['checkFolder'] && !empty($this->_map[$type])) { |
|
691 | + if ($options['checkFolder'] && ! empty($this->_map[$type])) { |
|
692 | 692 | $folder = str_replace('/', DS, $this->_map[$type]); |
693 | - $new = $base . $folder . DS . $class . '.php'; |
|
693 | + $new = $base.$folder.DS.$class.'.php'; |
|
694 | 694 | } else { |
695 | - $new = dirname($file) . DS . $class . '.php'; |
|
695 | + $new = dirname($file).DS.$class.'.php'; |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | if ($file === $new) { |
@@ -700,15 +700,15 @@ discard block |
||
700 | 700 | } |
701 | 701 | |
702 | 702 | $dir = dirname($new); |
703 | - if (!is_dir($dir)) { |
|
703 | + if ( ! is_dir($dir)) { |
|
704 | 704 | new Folder($dir, true); |
705 | 705 | } |
706 | 706 | |
707 | 707 | $this->out(__d('cake_console', 'Moving %s to %s', $file, $new), 1, Shell::VERBOSE); |
708 | - if (!$this->params['dry-run']) { |
|
708 | + if ( ! $this->params['dry-run']) { |
|
709 | 709 | if ($this->params['git']) { |
710 | - exec('git mv -f ' . escapeshellarg($file) . ' ' . escapeshellarg($file . '__')); |
|
711 | - exec('git mv -f ' . escapeshellarg($file . '__') . ' ' . escapeshellarg($new)); |
|
710 | + exec('git mv -f '.escapeshellarg($file).' '.escapeshellarg($file.'__')); |
|
711 | + exec('git mv -f '.escapeshellarg($file.'__').' '.escapeshellarg($new)); |
|
712 | 712 | } else { |
713 | 713 | rename($file, $new); |
714 | 714 | } |
@@ -741,12 +741,12 @@ discard block |
||
741 | 741 | protected function _findFiles($extensions = '') { |
742 | 742 | $this->_files = array(); |
743 | 743 | foreach ($this->_paths as $path) { |
744 | - if (!is_dir($path)) { |
|
744 | + if ( ! is_dir($path)) { |
|
745 | 745 | continue; |
746 | 746 | } |
747 | 747 | $Iterator = new RegexIterator( |
748 | 748 | new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)), |
749 | - '/^.+\.(' . $extensions . ')$/i', |
|
749 | + '/^.+\.('.$extensions.')$/i', |
|
750 | 750 | RegexIterator::MATCH |
751 | 751 | ); |
752 | 752 | foreach ($Iterator as $file) { |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | } |
774 | 774 | |
775 | 775 | $this->out(__d('cake_console', 'Done updating %s', $file), 1); |
776 | - if (!$this->params['dry-run']) { |
|
776 | + if ( ! $this->params['dry-run']) { |
|
777 | 777 | file_put_contents($file, $contents); |
778 | 778 | } |
779 | 779 | } |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | ); |
810 | 810 | |
811 | 811 | return parent::getOptionParser() |
812 | - ->description(__d('cake_console', "A shell to help automate upgrading from CakePHP 1.3 to 2.0. \n" . |
|
812 | + ->description(__d('cake_console', "A shell to help automate upgrading from CakePHP 1.3 to 2.0. \n". |
|
813 | 813 | "Be sure to have a backup of your application before running these commands.")) |
814 | 814 | ->addSubcommand('all', array( |
815 | 815 | 'help' => __d('cake_console', 'Run all upgrade commands.'), |
@@ -81,7 +81,7 @@ |
||
81 | 81 | $message = __d('cake_console', '%s in [%s, line %s]', $description, $file, $line); |
82 | 82 | $stderr->write(__d('cake_console', "<error>%s Error:</error> %s\n", $name, $message)); |
83 | 83 | |
84 | - if (!Configure::read('debug')) { |
|
84 | + if ( ! Configure::read('debug')) { |
|
85 | 85 | CakeLog::write($log, $message); |
86 | 86 | } |
87 | 87 |
@@ -59,7 +59,7 @@ |
||
59 | 59 | public function read() { |
60 | 60 | if ($this->_canReadline) { |
61 | 61 | $line = readline(''); |
62 | - if (!empty($line)) { |
|
62 | + if ( ! empty($line)) { |
|
63 | 63 | readline_add_history($line); |
64 | 64 | } |
65 | 65 | return $line; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | public function __construct($name, $help = '', $required = false, $choices = array()) { |
64 | 64 | if (is_array($name) && isset($name['name'])) { |
65 | 65 | foreach ($name as $key => $value) { |
66 | - $this->{'_' . $key} = $value; |
|
66 | + $this->{'_'.$key} = $value; |
|
67 | 67 | } |
68 | 68 | } else { |
69 | 69 | $this->_name = $name; |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | $name = str_pad($name, $width, ' '); |
95 | 95 | } |
96 | 96 | $optional = ''; |
97 | - if (!$this->isRequired()) { |
|
97 | + if ( ! $this->isRequired()) { |
|
98 | 98 | $optional = __d('cake_console', ' <comment>(optional)</comment>'); |
99 | 99 | } |
100 | - if (!empty($this->_choices)) { |
|
100 | + if ( ! empty($this->_choices)) { |
|
101 | 101 | $optional .= __d('cake_console', ' <comment>(choices: %s)</comment>', implode('|', $this->_choices)); |
102 | 102 | } |
103 | 103 | return sprintf('%s%s%s', $name, $this->_help, $optional); |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function usage() { |
112 | 112 | $name = $this->_name; |
113 | - if (!empty($this->_choices)) { |
|
113 | + if ( ! empty($this->_choices)) { |
|
114 | 114 | $name = implode('|', $this->_choices); |
115 | 115 | } |
116 | - $name = '<' . $name . '>'; |
|
117 | - if (!$this->isRequired()) { |
|
118 | - $name = '[' . $name . ']'; |
|
116 | + $name = '<'.$name.'>'; |
|
117 | + if ( ! $this->isRequired()) { |
|
118 | + $name = '['.$name.']'; |
|
119 | 119 | } |
120 | 120 | return $name; |
121 | 121 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @return boolean |
127 | 127 | */ |
128 | 128 | public function isRequired() { |
129 | - return (bool)$this->_required; |
|
129 | + return (bool) $this->_required; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | if (empty($this->_choices)) { |
141 | 141 | return true; |
142 | 142 | } |
143 | - if (!in_array($value, $this->_choices)) { |
|
143 | + if ( ! in_array($value, $this->_choices)) { |
|
144 | 144 | throw new ConsoleException( |
145 | 145 | __d('cake_console', '"%s" is not a valid value for %s. Please use one of "%s"', |
146 | 146 | $value, $this->_name, implode(', ', $this->_choices) |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function __construct($name, $short = null, $help = '', $boolean = false, $default = '', $choices = array()) { |
81 | 81 | if (is_array($name) && isset($name['name'])) { |
82 | 82 | foreach ($name as $key => $value) { |
83 | - $this->{'_' . $key} = $value; |
|
83 | + $this->{'_'.$key} = $value; |
|
84 | 84 | } |
85 | 85 | } else { |
86 | 86 | $this->_name = $name; |
@@ -123,14 +123,14 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function help($width = 0) { |
125 | 125 | $default = $short = ''; |
126 | - if (!empty($this->_default) && $this->_default !== true) { |
|
126 | + if ( ! empty($this->_default) && $this->_default !== true) { |
|
127 | 127 | $default = __d('cake_console', ' <comment>(default: %s)</comment>', $this->_default); |
128 | 128 | } |
129 | - if (!empty($this->_choices)) { |
|
129 | + if ( ! empty($this->_choices)) { |
|
130 | 130 | $default .= __d('cake_console', ' <comment>(choices: %s)</comment>', implode('|', $this->_choices)); |
131 | 131 | } |
132 | - if (!empty($this->_short)) { |
|
133 | - $short = ', -' . $this->_short; |
|
132 | + if ( ! empty($this->_short)) { |
|
133 | + $short = ', -'.$this->_short; |
|
134 | 134 | } |
135 | 135 | $name = sprintf('--%s%s', $this->_name, $short); |
136 | 136 | if (strlen($name) < $width) { |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | * @return string |
146 | 146 | */ |
147 | 147 | public function usage() { |
148 | - $name = empty($this->_short) ? '--' . $this->_name : '-' . $this->_short; |
|
148 | + $name = empty($this->_short) ? '--'.$this->_name : '-'.$this->_short; |
|
149 | 149 | $default = ''; |
150 | - if (!empty($this->_default) && $this->_default !== true) { |
|
151 | - $default = ' ' . $this->_default; |
|
150 | + if ( ! empty($this->_default) && $this->_default !== true) { |
|
151 | + $default = ' '.$this->_default; |
|
152 | 152 | } |
153 | - if (!empty($this->_choices)) { |
|
154 | - $default = ' ' . implode('|', $this->_choices); |
|
153 | + if ( ! empty($this->_choices)) { |
|
154 | + $default = ' '.implode('|', $this->_choices); |
|
155 | 155 | } |
156 | 156 | return sprintf('[%s%s]', $name, $default); |
157 | 157 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @return boolean |
172 | 172 | */ |
173 | 173 | public function isBoolean() { |
174 | - return (bool)$this->_boolean; |
|
174 | + return (bool) $this->_boolean; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | if (empty($this->_choices)) { |
186 | 186 | return true; |
187 | 187 | } |
188 | - if (!in_array($value, $this->_choices)) { |
|
188 | + if ( ! in_array($value, $this->_choices)) { |
|
189 | 189 | throw new ConsoleException( |
190 | 190 | __d('cake_console', '"%s" is not a valid value for --%s. Please use one of "%s"', |
191 | 191 | $value, $this->_name, implode(', ', $this->_choices) |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function xml(SimpleXmlElement $parent) { |
204 | 204 | $option = $parent->addChild('option'); |
205 | - $option->addAttribute('name', '--' . $this->_name); |
|
205 | + $option->addAttribute('name', '--'.$this->_name); |
|
206 | 206 | $short = ''; |
207 | 207 | if (strlen($this->_short)) { |
208 | 208 | $short = $this->_short; |
209 | 209 | } |
210 | - $option->addAttribute('short', '-' . $short); |
|
210 | + $option->addAttribute('short', '-'.$short); |
|
211 | 211 | $option->addAttribute('boolean', $this->_boolean); |
212 | 212 | $option->addChild('default', $this->_default); |
213 | 213 | $choices = $option->addChild('choices'); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | public function __construct($name, $help = '', $parser = null) { |
57 | 57 | if (is_array($name) && isset($name['name'])) { |
58 | 58 | foreach ($name as $key => $value) { |
59 | - $this->{'_' . $key} = $value; |
|
59 | + $this->{'_'.$key} = $value; |
|
60 | 60 | } |
61 | 61 | } else { |
62 | 62 | $this->_name = $name; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if (strlen($name) < $width) { |
90 | 90 | $name = str_pad($name, $width, ' '); |
91 | 91 | } |
92 | - return $name . $this->_help; |
|
92 | + return $name.$this->_help; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |