@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | /** |
| 357 | 357 | * Initialize ACL database. |
| 358 | 358 | * |
| 359 | - * @return mixed |
|
| 359 | + * @return boolean |
|
| 360 | 360 | */ |
| 361 | 361 | public function initdb() { |
| 362 | 362 | return $this->dispatchShell('schema create DbAcl'); |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | /** |
| 366 | 366 | * Get the option parser. |
| 367 | 367 | * |
| 368 | - * @return void |
|
| 368 | + * @return ConsoleOptionParser |
|
| 369 | 369 | */ |
| 370 | 370 | public function getOptionParser() { |
| 371 | 371 | $parser = parent::getOptionParser(); |
@@ -71,27 +71,27 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $class = Configure::read('Acl.classname'); |
| 73 | 73 | list($plugin, $class) = pluginSplit($class, true); |
| 74 | - App::uses($class, $plugin . 'Controller/Component/Acl'); |
|
| 75 | - if (!in_array($class, array('DbAcl', 'DB_ACL')) && !is_subclass_of($class, 'DbAcl')) { |
|
| 74 | + App::uses($class, $plugin.'Controller/Component/Acl'); |
|
| 75 | + if ( ! in_array($class, array('DbAcl', 'DB_ACL')) && ! is_subclass_of($class, 'DbAcl')) { |
|
| 76 | 76 | $out = "--------------------------------------------------\n"; |
| 77 | - $out .= __d('cake_console', 'Error: Your current CakePHP configuration is set to an ACL implementation other than DB.') . "\n"; |
|
| 78 | - $out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n"; |
|
| 77 | + $out .= __d('cake_console', 'Error: Your current CakePHP configuration is set to an ACL implementation other than DB.')."\n"; |
|
| 78 | + $out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script')."\n"; |
|
| 79 | 79 | $out .= "--------------------------------------------------\n"; |
| 80 | - $out .= __d('cake_console', 'Current ACL Classname: %s', $class) . "\n"; |
|
| 80 | + $out .= __d('cake_console', 'Current ACL Classname: %s', $class)."\n"; |
|
| 81 | 81 | $out .= "--------------------------------------------------\n"; |
| 82 | 82 | $this->err($out); |
| 83 | 83 | return $this->_stop(); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | if ($this->command) { |
| 87 | - if (!config('database')) { |
|
| 87 | + if ( ! config('database')) { |
|
| 88 | 88 | $this->out(__d('cake_console', 'Your database configuration was not found. Take a moment to create one.')); |
| 89 | 89 | $this->args = null; |
| 90 | 90 | return $this->DbConfig->execute(); |
| 91 | 91 | } |
| 92 | - require_once APP . 'Config' . DS . 'database.php'; |
|
| 92 | + require_once APP.'Config'.DS.'database.php'; |
|
| 93 | 93 | |
| 94 | - if (!in_array($this->command, array('initdb'))) { |
|
| 94 | + if ( ! in_array($this->command, array('initdb'))) { |
|
| 95 | 95 | $collection = new ComponentCollection(); |
| 96 | 96 | $this->Acl = new AclComponent($collection); |
| 97 | 97 | $controller = new Controller(); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $class = ucfirst($this->args[0]); |
| 121 | 121 | $parent = $this->parseIdentifier($this->args[1]); |
| 122 | 122 | |
| 123 | - if (!empty($parent) && $parent !== '/' && $parent !== 'root') { |
|
| 123 | + if ( ! empty($parent) && $parent !== '/' && $parent !== 'root') { |
|
| 124 | 124 | $parent = $this->_getNodeId($class, $parent); |
| 125 | 125 | } else { |
| 126 | 126 | $parent = null; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | if (is_string($data) && $data !== '/') { |
| 131 | 131 | $data = array('alias' => $data); |
| 132 | 132 | } elseif (is_string($data)) { |
| 133 | - $this->error(__d('cake_console', '/ can not be used as an alias!') . __d('cake_console', " / is the root, please supply a sub alias")); |
|
| 133 | + $this->error(__d('cake_console', '/ can not be used as an alias!').__d('cake_console', " / is the root, please supply a sub alias")); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $data['parent_id'] = $parent; |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | if ($this->Acl->{$class}->find('all', array('conditions' => $identifier))) { |
| 160 | - if (!$this->Acl->{$class}->deleteAll($identifier)) { |
|
| 161 | - $this->error(__d('cake_console', 'Node Not Deleted. ') . __d('cake_console', 'There was an error deleting the %s.', $class) . "\n"); |
|
| 160 | + if ( ! $this->Acl->{$class}->deleteAll($identifier)) { |
|
| 161 | + $this->error(__d('cake_console', 'Node Not Deleted. ').__d('cake_console', 'There was an error deleting the %s.', $class)."\n"); |
|
| 162 | 162 | } |
| 163 | 163 | $this->out(__d('cake_console', '<success>%s deleted.</success>', $class), 2); |
| 164 | 164 | } else { |
| 165 | - $this->error(__d('cake_console', 'Node Not Deleted. ') . __d('cake_console', 'There was an error deleting the %s. Node does not exist.', $class) . "\n"); |
|
| 165 | + $this->error(__d('cake_console', 'Node Not Deleted. ').__d('cake_console', 'There was an error deleting the %s. Node does not exist.', $class)."\n"); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
@@ -183,10 +183,10 @@ discard block |
||
| 183 | 183 | ) |
| 184 | 184 | ); |
| 185 | 185 | $this->Acl->{$class}->create(); |
| 186 | - if (!$this->Acl->{$class}->save($data)) { |
|
| 186 | + if ( ! $this->Acl->{$class}->save($data)) { |
|
| 187 | 187 | $this->out(__d('cake_console', 'Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.')); |
| 188 | 188 | } else { |
| 189 | - $this->out(__d('cake_console', 'Node parent set to %s', $this->args[2]) . "\n"); |
|
| 189 | + $this->out(__d('cake_console', 'Node parent set to %s', $this->args[2])."\n"); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -227,9 +227,9 @@ discard block |
||
| 227 | 227 | $indent = str_repeat(' ', $indent); |
| 228 | 228 | $data = $node[$class]; |
| 229 | 229 | if ($data['alias']) { |
| 230 | - $this->out($indent . "[" . $data['id'] . "] " . $data['alias']); |
|
| 230 | + $this->out($indent."[".$data['id']."] ".$data['alias']); |
|
| 231 | 231 | } else { |
| 232 | - $this->out($indent . "[" . $data['id'] . "] " . $data['model'] . '.' . $data['foreign_key']); |
|
| 232 | + $this->out($indent."[".$data['id']."] ".$data['model'].'.'.$data['foreign_key']); |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
@@ -305,18 +305,18 @@ discard block |
||
| 305 | 305 | $identity = $this->parseIdentifier($this->args[1]); |
| 306 | 306 | |
| 307 | 307 | $topNode = $this->Acl->{$class}->find('first', array( |
| 308 | - 'conditions' => array($class . '.id' => $this->_getNodeId($class, $identity)) |
|
| 308 | + 'conditions' => array($class.'.id' => $this->_getNodeId($class, $identity)) |
|
| 309 | 309 | )); |
| 310 | 310 | |
| 311 | 311 | $nodes = $this->Acl->{$class}->find('all', array( |
| 312 | 312 | 'conditions' => array( |
| 313 | - $class . '.lft >=' => $topNode[$class]['lft'], |
|
| 314 | - $class . '.lft <=' => $topNode[$class]['rght'] |
|
| 313 | + $class.'.lft >=' => $topNode[$class]['lft'], |
|
| 314 | + $class.'.lft <=' => $topNode[$class]['rght'] |
|
| 315 | 315 | ), |
| 316 | - 'order' => $class . '.lft ASC' |
|
| 316 | + 'order' => $class.'.lft ASC' |
|
| 317 | 317 | )); |
| 318 | 318 | } else { |
| 319 | - $nodes = $this->Acl->{$class}->find('all', array('order' => $class . '.lft ASC')); |
|
| 319 | + $nodes = $this->Acl->{$class}->find('all', array('order' => $class.'.lft ASC')); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | if (empty($nodes)) { |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $this->error(__d('cake_console', '%s not found', $this->args[0]), __d('cake_console', 'No tree returned.')); |
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | - $this->out($class . ' tree:'); |
|
| 329 | + $this->out($class.' tree:'); |
|
| 330 | 330 | $this->hr(); |
| 331 | 331 | |
| 332 | 332 | $stack = array(); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | |
| 335 | 335 | foreach ($nodes as $n) { |
| 336 | 336 | $stack[] = $n; |
| 337 | - if (!empty($last)) { |
|
| 337 | + if ( ! empty($last)) { |
|
| 338 | 338 | $end = end($stack); |
| 339 | 339 | if ($end[$class]['rght'] > $last) { |
| 340 | 340 | foreach ($stack as $k => $v) { |
@@ -523,13 +523,13 @@ discard block |
||
| 523 | 523 | * @return boolean Success |
| 524 | 524 | */ |
| 525 | 525 | public function nodeExists() { |
| 526 | - if (!isset($this->args[0]) || !isset($this->args[1])) { |
|
| 526 | + if ( ! isset($this->args[0]) || ! isset($this->args[1])) { |
|
| 527 | 527 | return false; |
| 528 | 528 | } |
| 529 | 529 | $dataVars = $this->_dataVars($this->args[0]); |
| 530 | 530 | extract($dataVars); |
| 531 | 531 | $key = is_numeric($this->args[1]) ? $dataVars['secondary_id'] : 'alias'; |
| 532 | - $conditions = array($class . '.' . $key => $this->args[1]); |
|
| 532 | + $conditions = array($class.'.'.$key => $this->args[1]); |
|
| 533 | 533 | $possibility = $this->Acl->{$class}->find('all', compact('conditions')); |
| 534 | 534 | if (empty($possibility)) { |
| 535 | 535 | $this->error(__d('cake_console', '%s not found', $this->args[1]), __d('cake_console', 'No tree returned.')); |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | $aco = $this->parseIdentifier($aco); |
| 593 | 593 | } |
| 594 | 594 | $action = '*'; |
| 595 | - if (isset($this->args[2]) && !in_array($this->args[2], array('', 'all'))) { |
|
| 595 | + if (isset($this->args[2]) && ! in_array($this->args[2], array('', 'all'))) { |
|
| 596 | 596 | $action = $this->args[2]; |
| 597 | 597 | } |
| 598 | 598 | return compact('aro', 'aco', 'action', 'aroName', 'acoName'); |
@@ -605,14 +605,14 @@ discard block |
||
| 605 | 605 | * @return array Variables |
| 606 | 606 | */ |
| 607 | 607 | protected function _dataVars($type = null) { |
| 608 | - if (!$type) { |
|
| 608 | + if ( ! $type) { |
|
| 609 | 609 | $type = $this->args[0]; |
| 610 | 610 | } |
| 611 | 611 | $vars = array(); |
| 612 | 612 | $class = ucwords($type); |
| 613 | 613 | $vars['secondary_id'] = (strtolower($class) === 'aro') ? 'foreign_key' : 'object_id'; |
| 614 | 614 | $vars['data_name'] = $type; |
| 615 | - $vars['table_name'] = $type . 's'; |
|
| 615 | + $vars['table_name'] = $type.'s'; |
|
| 616 | 616 | $vars['class'] = $class; |
| 617 | 617 | return $vars; |
| 618 | 618 | } |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | * @param array $contents |
| 412 | 412 | * @param string $event |
| 413 | 413 | * @param CakeSchema $Schema |
| 414 | - * @return void |
|
| 414 | + * @return null|false |
|
| 415 | 415 | */ |
| 416 | 416 | protected function _run($contents, $event, CakeSchema $Schema) { |
| 417 | 417 | if (empty($contents)) { |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | /** |
| 455 | 455 | * get the option parser |
| 456 | 456 | * |
| 457 | - * @return void |
|
| 457 | + * @return ConsoleOptionParser |
|
| 458 | 458 | */ |
| 459 | 459 | public function getOptionParser() { |
| 460 | 460 | $plugin = array( |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | Configure::write('Cache.disable', 1); |
| 57 | 57 | |
| 58 | 58 | $name = $path = $connection = $plugin = null; |
| 59 | - if (!empty($this->params['name'])) { |
|
| 59 | + if ( ! empty($this->params['name'])) { |
|
| 60 | 60 | $name = $this->params['name']; |
| 61 | - } elseif (!empty($this->args[0]) && $this->args[0] !== 'snapshot') { |
|
| 61 | + } elseif ( ! empty($this->args[0]) && $this->args[0] !== 'snapshot') { |
|
| 62 | 62 | $name = $this->params['name'] = $this->args[0]; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | $file = $this->params['file']; |
| 81 | 81 | |
| 82 | - if (!empty($this->params['path'])) { |
|
| 82 | + if ( ! empty($this->params['path'])) { |
|
| 83 | 83 | $path = $this->params['path']; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if (!empty($this->params['connection'])) { |
|
| 86 | + if ( ! empty($this->params['connection'])) { |
|
| 87 | 87 | $connection = $this->params['connection']; |
| 88 | 88 | } |
| 89 | - if (!empty($this->params['plugin'])) { |
|
| 89 | + if ( ! empty($this->params['plugin'])) { |
|
| 90 | 90 | $plugin = $this->params['plugin']; |
| 91 | 91 | if (empty($name)) { |
| 92 | 92 | $name = $plugin; |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | * @return void |
| 104 | 104 | */ |
| 105 | 105 | public function view() { |
| 106 | - $File = new File($this->Schema->path . DS . $this->params['file']); |
|
| 106 | + $File = new File($this->Schema->path.DS.$this->params['file']); |
|
| 107 | 107 | if ($File->exists()) { |
| 108 | 108 | $this->out($File->read()); |
| 109 | 109 | return $this->_stop(); |
| 110 | 110 | } |
| 111 | - $file = $this->Schema->path . DS . $this->params['file']; |
|
| 111 | + $file = $this->Schema->path.DS.$this->params['file']; |
|
| 112 | 112 | $this->err(__d('cake_console', 'Schema file (%s) could not be found.', $file)); |
| 113 | 113 | return $this->_stop(); |
| 114 | 114 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | $options = array(); |
| 125 | 125 | if ($this->params['force']) { |
| 126 | 126 | $options['models'] = false; |
| 127 | - } elseif (!empty($this->params['models'])) { |
|
| 127 | + } elseif ( ! empty($this->params['models'])) { |
|
| 128 | 128 | $options['models'] = String::tokenize($this->params['models']); |
| 129 | 129 | } |
| 130 | 130 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $snapshot = true; |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if (!$snapshot && file_exists($this->Schema->path . DS . $this->params['file'])) { |
|
| 136 | + if ( ! $snapshot && file_exists($this->Schema->path.DS.$this->params['file'])) { |
|
| 137 | 137 | $snapshot = true; |
| 138 | 138 | $prompt = __d('cake_console', "Schema file exists.\n [O]verwrite\n [S]napshot\n [Q]uit\nWould you like to do?"); |
| 139 | 139 | $result = strtolower($this->in($prompt, array('o', 's', 'q'), 's')); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | Configure::write('Cache.disable', $cacheDisable); |
| 155 | 155 | |
| 156 | - if (!empty($this->params['exclude']) && !empty($content)) { |
|
| 156 | + if ( ! empty($this->params['exclude']) && ! empty($content)) { |
|
| 157 | 157 | $excluded = String::tokenize($this->params['exclude']); |
| 158 | 158 | foreach ($excluded as $table) { |
| 159 | 159 | unset($content['tables'][$table]); |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $count = 0; |
| 174 | - if (!empty($result[1])) { |
|
| 174 | + if ( ! empty($result[1])) { |
|
| 175 | 175 | foreach ($result[1] as $file) { |
| 176 | - if (preg_match('/' . preg_quote($fileName) . '(?:[_\d]*)?\.php$/', $file)) { |
|
| 176 | + if (preg_match('/'.preg_quote($fileName).'(?:[_\d]*)?\.php$/', $file)) { |
|
| 177 | 177 | $count++; |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $content['file'] = $fileName . '_' . $count . '.php'; |
|
| 188 | + $content['file'] = $fileName.'_'.$count.'.php'; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | if ($this->Schema->write($content)) { |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | public function dump() { |
| 209 | 209 | $write = false; |
| 210 | 210 | $Schema = $this->Schema->load(); |
| 211 | - if (!$Schema) { |
|
| 211 | + if ( ! $Schema) { |
|
| 212 | 212 | $this->err(__d('cake_console', 'Schema could not be loaded')); |
| 213 | 213 | return $this->_stop(); |
| 214 | 214 | } |
| 215 | - if (!empty($this->params['write'])) { |
|
| 215 | + if ( ! empty($this->params['write'])) { |
|
| 216 | 216 | if ($this->params['write'] == 1) { |
| 217 | 217 | $write = Inflector::underscore($this->Schema->name); |
| 218 | 218 | } else { |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | $db = ConnectionManager::getDataSource($this->Schema->connection); |
| 223 | - $contents = "\n\n" . $db->dropSchema($Schema) . "\n\n" . $db->createSchema($Schema); |
|
| 223 | + $contents = "\n\n".$db->dropSchema($Schema)."\n\n".$db->createSchema($Schema); |
|
| 224 | 224 | |
| 225 | 225 | if ($write) { |
| 226 | 226 | if (strpos($write, '.sql') === false) { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | if (strpos($write, DS) !== false) { |
| 230 | 230 | $File = new File($write, true); |
| 231 | 231 | } else { |
| 232 | - $File = new File($this->Schema->path . DS . $write, true); |
|
| 232 | + $File = new File($this->Schema->path.DS.$write, true); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if ($File->write($contents)) { |
@@ -270,14 +270,14 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | protected function _loadSchema() { |
| 272 | 272 | $name = $plugin = null; |
| 273 | - if (!empty($this->params['name'])) { |
|
| 273 | + if ( ! empty($this->params['name'])) { |
|
| 274 | 274 | $name = $this->params['name']; |
| 275 | 275 | } |
| 276 | - if (!empty($this->params['plugin'])) { |
|
| 276 | + if ( ! empty($this->params['plugin'])) { |
|
| 277 | 277 | $plugin = $this->params['plugin']; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if (!empty($this->params['dry'])) { |
|
| 280 | + if ( ! empty($this->params['dry'])) { |
|
| 281 | 281 | $this->_dry = true; |
| 282 | 282 | $this->out(__d('cake_console', 'Performing a dry run.')); |
| 283 | 283 | } |
@@ -287,16 +287,16 @@ discard block |
||
| 287 | 287 | 'plugin' => $plugin, |
| 288 | 288 | 'connection' => $this->params['connection'], |
| 289 | 289 | ); |
| 290 | - if (!empty($this->params['snapshot'])) { |
|
| 290 | + if ( ! empty($this->params['snapshot'])) { |
|
| 291 | 291 | $fileName = rtrim($this->Schema->file, '.php'); |
| 292 | - $options['file'] = $fileName . '_' . $this->params['snapshot'] . '.php'; |
|
| 292 | + $options['file'] = $fileName.'_'.$this->params['snapshot'].'.php'; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | $Schema = $this->Schema->load($options); |
| 296 | 296 | |
| 297 | - if (!$Schema) { |
|
| 297 | + if ( ! $Schema) { |
|
| 298 | 298 | $this->err(__d('cake_console', 'The chosen schema could not be loaded. Attempted to load:')); |
| 299 | - $this->err(__d('cake_console', 'File: %s', $this->Schema->path . DS . $this->Schema->file)); |
|
| 299 | + $this->err(__d('cake_console', 'File: %s', $this->Schema->path.DS.$this->Schema->file)); |
|
| 300 | 300 | $this->err(__d('cake_console', 'Name: %s', $this->Schema->name)); |
| 301 | 301 | return $this->_stop(); |
| 302 | 302 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | |
| 321 | 321 | $drop = $create = array(); |
| 322 | 322 | |
| 323 | - if (!$table) { |
|
| 323 | + if ( ! $table) { |
|
| 324 | 324 | foreach ($Schema->tables as $table => $fields) { |
| 325 | 325 | $drop[$table] = $db->dropSchema($Schema, $table); |
| 326 | 326 | $create[$table] = $db->createSchema($Schema, $table); |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | return $this->_stop(); |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - $this->out("\n" . __d('cake_console', 'The following table(s) will be dropped.')); |
|
| 337 | + $this->out("\n".__d('cake_console', 'The following table(s) will be dropped.')); |
|
| 338 | 338 | $this->out(array_keys($drop)); |
| 339 | 339 | |
| 340 | 340 | if ($this->in(__d('cake_console', 'Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n') === 'y') { |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $this->_run($drop, 'drop', $Schema); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - $this->out("\n" . __d('cake_console', 'The following table(s) will be created.')); |
|
| 345 | + $this->out("\n".__d('cake_console', 'The following table(s) will be created.')); |
|
| 346 | 346 | $this->out(array_keys($create)); |
| 347 | 347 | |
| 348 | 348 | if ($this->in(__d('cake_console', 'Are you sure you want to create the table(s)?'), array('y', 'n'), 'y') === 'y') { |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | return $this->_stop(); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - $this->out("\n" . __d('cake_console', 'The following statements will run.')); |
|
| 397 | + $this->out("\n".__d('cake_console', 'The following statements will run.')); |
|
| 398 | 398 | $this->out(array_map('trim', $contents)); |
| 399 | 399 | if ($this->in(__d('cake_console', 'Are you sure you want to alter the tables?'), array('y', 'n'), 'n') === 'y') { |
| 400 | 400 | $this->out(); |
@@ -429,19 +429,19 @@ discard block |
||
| 429 | 429 | $this->out(__d('cake_console', 'Dry run for %s :', $table)); |
| 430 | 430 | $this->out($sql); |
| 431 | 431 | } else { |
| 432 | - if (!$Schema->before(array($event => $table))) { |
|
| 432 | + if ( ! $Schema->before(array($event => $table))) { |
|
| 433 | 433 | return false; |
| 434 | 434 | } |
| 435 | 435 | $error = null; |
| 436 | 436 | try { |
| 437 | 437 | $db->execute($sql); |
| 438 | 438 | } catch (PDOException $e) { |
| 439 | - $error = $table . ': ' . $e->getMessage(); |
|
| 439 | + $error = $table.': '.$e->getMessage(); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | $Schema->after(array($event => $table, 'errors' => $error)); |
| 443 | 443 | |
| 444 | - if (!empty($error)) { |
|
| 444 | + if ( ! empty($error)) { |
|
| 445 | 445 | $this->err($error); |
| 446 | 446 | } else { |
| 447 | 447 | $this->out(__d('cake_console', '%s updated.', $table)); |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | ); |
| 469 | 469 | $path = array( |
| 470 | 470 | 'help' => __d('cake_console', 'Path to read and write schema.php'), |
| 471 | - 'default' => APP . 'Config' . DS . 'Schema' |
|
| 471 | + 'default' => APP.'Config'.DS.'Schema' |
|
| 472 | 472 | ); |
| 473 | 473 | $file = array( |
| 474 | 474 | 'help' => __d('cake_console', 'File name to read and write.'), |
@@ -136,7 +136,7 @@ |
||
| 136 | 136 | /** |
| 137 | 137 | * Interactive |
| 138 | 138 | * |
| 139 | - * @return void |
|
| 139 | + * @return false|string |
|
| 140 | 140 | */ |
| 141 | 141 | protected function _interactive() { |
| 142 | 142 | $this->interactive = true; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if (isset($this->args[0])) { |
| 64 | - if (!isset($this->connection)) { |
|
| 64 | + if ( ! isset($this->connection)) { |
|
| 65 | 65 | $this->connection = 'default'; |
| 66 | 66 | } |
| 67 | 67 | if (strtolower($this->args[0]) === 'all') { |
@@ -71,15 +71,15 @@ discard block |
||
| 71 | 71 | $controller = $this->_controllerName($this->args[0]); |
| 72 | 72 | $actions = ''; |
| 73 | 73 | |
| 74 | - if (!empty($this->params['public'])) { |
|
| 75 | - $this->out(__d('cake_console', 'Baking basic crud methods for ') . $controller); |
|
| 74 | + if ( ! empty($this->params['public'])) { |
|
| 75 | + $this->out(__d('cake_console', 'Baking basic crud methods for ').$controller); |
|
| 76 | 76 | $actions .= $this->bakeActions($controller); |
| 77 | 77 | } |
| 78 | - if (!empty($this->params['admin'])) { |
|
| 78 | + if ( ! empty($this->params['admin'])) { |
|
| 79 | 79 | $admin = $this->Project->getPrefix(); |
| 80 | 80 | if ($admin) { |
| 81 | 81 | $this->out(__d('cake_console', 'Adding %s methods', $admin)); |
| 82 | - $actions .= "\n" . $this->bakeActions($controller, $admin); |
|
| 82 | + $actions .= "\n".$this->bakeActions($controller, $admin); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | if (empty($actions)) { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $unitTestExists = $this->_checkUnitTest(); |
| 107 | 107 | |
| 108 | 108 | $admin = false; |
| 109 | - if (!empty($this->params['admin'])) { |
|
| 109 | + if ( ! empty($this->params['admin'])) { |
|
| 110 | 110 | $admin = $this->Project->getPrefix(); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $actions = $this->bakeActions($controller); |
| 120 | 120 | if ($admin) { |
| 121 | 121 | $this->out(__d('cake_console', 'Adding %s methods', $admin)); |
| 122 | - $actions .= "\n" . $this->bakeActions($controller, $admin); |
|
| 122 | + $actions .= "\n".$this->bakeActions($controller, $admin); |
|
| 123 | 123 | } |
| 124 | 124 | if ($this->bake($controller, $actions) && $unitTestExists) { |
| 125 | 125 | $this->bakeTest($controller); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if (!$controllersCreated) { |
|
| 131 | + if ( ! $controllersCreated) { |
|
| 132 | 132 | $this->out(__d('cake_console', 'No Controllers were baked, Models need to exist before Controllers can be baked.')); |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $wannaBakeCrud = 'y'; |
| 162 | 162 | |
| 163 | 163 | $question[] = __d('cake_console', "Would you like to build your controller interactively?"); |
| 164 | - if (file_exists($this->path . $controllerName . 'Controller.php')) { |
|
| 164 | + if (file_exists($this->path.$controllerName.'Controller.php')) { |
|
| 165 | 165 | $question[] = __d('cake_console', "Warning: Choosing no will overwrite the %sController.", $controllerName); |
| 166 | 166 | } |
| 167 | 167 | $doItInteractive = $this->in(implode("\n", $question), array('y', 'n'), 'y'); |
@@ -252,12 +252,12 @@ discard block |
||
| 252 | 252 | $length = count($$var); |
| 253 | 253 | foreach ($$var as $i => $propElement) { |
| 254 | 254 | if ($i != $length - 1) { |
| 255 | - $output .= ucfirst($propElement) . ', '; |
|
| 255 | + $output .= ucfirst($propElement).', '; |
|
| 256 | 256 | } else { |
| 257 | 257 | $output .= ucfirst($propElement); |
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | - $this->out($title . "\n\t" . $output); |
|
| 260 | + $this->out($title."\n\t".$output); |
|
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | $this->hr(); |
@@ -294,8 +294,8 @@ discard block |
||
| 294 | 294 | if ($plugin) { |
| 295 | 295 | $plugin .= '.'; |
| 296 | 296 | } |
| 297 | - App::uses($modelImport, $plugin . 'Model'); |
|
| 298 | - if (!class_exists($modelImport)) { |
|
| 297 | + App::uses($modelImport, $plugin.'Model'); |
|
| 298 | + if ( ! class_exists($modelImport)) { |
|
| 299 | 299 | $this->err(__d('cake_console', 'You must have a model for this class to build basic methods. Please try again.')); |
| 300 | 300 | return $this->_stop(); |
| 301 | 301 | } |
@@ -328,16 +328,16 @@ discard block |
||
| 328 | 328 | * @return string Baked controller |
| 329 | 329 | */ |
| 330 | 330 | public function bake($controllerName, $actions = '', $helpers = null, $components = null) { |
| 331 | - $this->out("\n" . __d('cake_console', 'Baking controller class for %s...', $controllerName), 1, Shell::QUIET); |
|
| 331 | + $this->out("\n".__d('cake_console', 'Baking controller class for %s...', $controllerName), 1, Shell::QUIET); |
|
| 332 | 332 | |
| 333 | 333 | $isScaffold = ($actions === 'scaffold') ? true : false; |
| 334 | 334 | |
| 335 | 335 | $this->Template->set(array( |
| 336 | 336 | 'plugin' => $this->plugin, |
| 337 | - 'pluginPath' => empty($this->plugin) ? '' : $this->plugin . '.' |
|
| 337 | + 'pluginPath' => empty($this->plugin) ? '' : $this->plugin.'.' |
|
| 338 | 338 | )); |
| 339 | 339 | |
| 340 | - if (!in_array('Paginator', (array)$components)) { |
|
| 340 | + if ( ! in_array('Paginator', (array) $components)) { |
|
| 341 | 341 | $components[] = 'Paginator'; |
| 342 | 342 | } |
| 343 | 343 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $contents = $this->Template->generate('classes', 'controller'); |
| 346 | 346 | |
| 347 | 347 | $path = $this->getPath(); |
| 348 | - $filename = $path . $controllerName . 'Controller.php'; |
|
| 348 | + $filename = $path.$controllerName.'Controller.php'; |
|
| 349 | 349 | if ($this->createFile($filename, $contents)) { |
| 350 | 350 | return $contents; |
| 351 | 351 | } |
@@ -444,14 +444,14 @@ discard block |
||
| 444 | 444 | $controllers = $this->listAll($useDbConfig); |
| 445 | 445 | $enteredController = ''; |
| 446 | 446 | |
| 447 | - while (!$enteredController) { |
|
| 447 | + while ( ! $enteredController) { |
|
| 448 | 448 | $enteredController = $this->in(__d('cake_console', "Enter a number from the list above,\ntype in the name of another controller, or 'q' to exit"), null, 'q'); |
| 449 | 449 | if ($enteredController === 'q') { |
| 450 | 450 | $this->out(__d('cake_console', 'Exit')); |
| 451 | 451 | return $this->_stop(); |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if (!$enteredController || intval($enteredController) > count($controllers)) { |
|
| 454 | + if ( ! $enteredController || intval($enteredController) > count($controllers)) { |
|
| 455 | 455 | $this->err(__d('cake_console', "The Controller name you supplied was empty,\nor the number you selected was not an option. Please try again.")); |
| 456 | 456 | $enteredController = ''; |
| 457 | 457 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | /** |
| 83 | 83 | * Interactive interface |
| 84 | 84 | * |
| 85 | - * @return void |
|
| 85 | + * @return boolean |
|
| 86 | 86 | */ |
| 87 | 87 | protected function _interactive() { |
| 88 | 88 | $this->hr(); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * Assembles and writes database.php |
| 248 | 248 | * |
| 249 | 249 | * @param array $configs Configuration settings to use |
| 250 | - * @return boolean Success |
|
| 250 | + * @return null|boolean Success |
|
| 251 | 251 | */ |
| 252 | 252 | public function bake($configs) { |
| 253 | 253 | if (!is_dir($this->path)) { |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | 66 | public function initialize() { |
| 67 | - $this->path = APP . 'Config' . DS; |
|
| 67 | + $this->path = APP.'Config'.DS; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -91,10 +91,10 @@ discard block |
||
| 91 | 91 | $done = false; |
| 92 | 92 | $dbConfigs = array(); |
| 93 | 93 | |
| 94 | - while (!$done) { |
|
| 94 | + while ( ! $done) { |
|
| 95 | 95 | $name = ''; |
| 96 | 96 | |
| 97 | - while (!$name) { |
|
| 97 | + while ( ! $name) { |
|
| 98 | 98 | $name = $this->in(__d('cake_console', "Name:"), null, 'default'); |
| 99 | 99 | if (preg_match('/[^a-z0-9_]/i', $name)) { |
| 100 | 100 | $name = ''; |
@@ -115,12 +115,12 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $host = ''; |
| 118 | - while (!$host) { |
|
| 118 | + while ( ! $host) { |
|
| 119 | 119 | $host = $this->in(__d('cake_console', 'Database Host:'), null, 'localhost'); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $port = ''; |
| 123 | - while (!$port) { |
|
| 123 | + while ( ! $port) { |
|
| 124 | 124 | $port = $this->in(__d('cake_console', 'Port?'), null, 'n'); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -129,16 +129,16 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | $login = ''; |
| 132 | - while (!$login) { |
|
| 132 | + while ( ! $login) { |
|
| 133 | 133 | $login = $this->in(__d('cake_console', 'User:'), null, 'root'); |
| 134 | 134 | } |
| 135 | 135 | $password = ''; |
| 136 | 136 | $blankPassword = false; |
| 137 | 137 | |
| 138 | - while (!$password && !$blankPassword) { |
|
| 138 | + while ( ! $password && ! $blankPassword) { |
|
| 139 | 139 | $password = $this->in(__d('cake_console', 'Password:')); |
| 140 | 140 | |
| 141 | - if (!$password) { |
|
| 141 | + if ( ! $password) { |
|
| 142 | 142 | $blank = $this->in(__d('cake_console', 'The password you supplied was empty. Use an empty password?'), array('y', 'n'), 'n'); |
| 143 | 143 | if ($blank === 'y') { |
| 144 | 144 | $blankPassword = true; |
@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | $database = ''; |
| 150 | - while (!$database) { |
|
| 150 | + while ( ! $database) { |
|
| 151 | 151 | $database = $this->in(__d('cake_console', 'Database Name:'), null, 'cake'); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | $prefix = ''; |
| 155 | - while (!$prefix) { |
|
| 155 | + while ( ! $prefix) { |
|
| 156 | 156 | $prefix = $this->in(__d('cake_console', 'Table Prefix?'), null, 'n'); |
| 157 | 157 | } |
| 158 | 158 | if (strtolower($prefix) === 'n') { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | $encoding = ''; |
| 163 | - while (!$encoding) { |
|
| 163 | + while ( ! $encoding) { |
|
| 164 | 164 | $encoding = $this->in(__d('cake_console', 'Table encoding?'), null, 'n'); |
| 165 | 165 | } |
| 166 | 166 | if (strtolower($encoding) === 'n') { |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | $schema = ''; |
| 171 | 171 | if ($datasource === 'postgres') { |
| 172 | - while (!$schema) { |
|
| 172 | + while ( ! $schema) { |
|
| 173 | 173 | $schema = $this->in(__d('cake_console', 'Table schema?'), null, 'n'); |
| 174 | 174 | } |
| 175 | 175 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | $config = compact('name', 'datasource', 'persistent', 'host', 'login', 'password', 'database', 'prefix', 'encoding', 'port', 'schema'); |
| 181 | 181 | |
| 182 | - while (!$this->_verify($config)) { |
|
| 182 | + while ( ! $this->_verify($config)) { |
|
| 183 | 183 | $this->_interactive(); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -250,12 +250,12 @@ discard block |
||
| 250 | 250 | * @return boolean Success |
| 251 | 251 | */ |
| 252 | 252 | public function bake($configs) { |
| 253 | - if (!is_dir($this->path)) { |
|
| 253 | + if ( ! is_dir($this->path)) { |
|
| 254 | 254 | $this->err(__d('cake_console', '%s not found', $this->path)); |
| 255 | 255 | return false; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - $filename = $this->path . 'database.php'; |
|
| 258 | + $filename = $this->path.'database.php'; |
|
| 259 | 259 | $oldConfigs = array(); |
| 260 | 260 | |
| 261 | 261 | if (file_exists($filename)) { |
@@ -266,17 +266,17 @@ discard block |
||
| 266 | 266 | foreach ($temp as $configName => $info) { |
| 267 | 267 | $info = array_merge($this->_defaultConfig, $info); |
| 268 | 268 | |
| 269 | - if (!isset($info['schema'])) { |
|
| 269 | + if ( ! isset($info['schema'])) { |
|
| 270 | 270 | $info['schema'] = null; |
| 271 | 271 | } |
| 272 | - if (!isset($info['encoding'])) { |
|
| 272 | + if ( ! isset($info['encoding'])) { |
|
| 273 | 273 | $info['encoding'] = null; |
| 274 | 274 | } |
| 275 | - if (!isset($info['port'])) { |
|
| 275 | + if ( ! isset($info['port'])) { |
|
| 276 | 276 | $info['port'] = null; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - $info['persistent'] = var_export((bool)$info['persistent'], true); |
|
| 279 | + $info['persistent'] = var_export((bool) $info['persistent'], true); |
|
| 280 | 280 | |
| 281 | 281 | $oldConfigs[] = array( |
| 282 | 282 | 'name' => $configName, |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | $out .= "}\n"; |
| 345 | - $filename = $this->path . 'database.php'; |
|
| 345 | + $filename = $this->path.'database.php'; |
|
| 346 | 346 | return $this->createFile($filename, $out); |
| 347 | 347 | } |
| 348 | 348 | |
@@ -356,13 +356,13 @@ discard block |
||
| 356 | 356 | $configs = ConnectionManager::enumConnectionObjects(); |
| 357 | 357 | |
| 358 | 358 | $useDbConfig = key($configs); |
| 359 | - if (!is_array($configs) || empty($configs)) { |
|
| 359 | + if ( ! is_array($configs) || empty($configs)) { |
|
| 360 | 360 | return $this->execute(); |
| 361 | 361 | } |
| 362 | 362 | $connections = array_keys($configs); |
| 363 | 363 | |
| 364 | 364 | if (count($connections) > 1) { |
| 365 | - $useDbConfig = $this->in(__d('cake_console', 'Use Database Config') . ':', $connections, $useDbConfig); |
|
| 365 | + $useDbConfig = $this->in(__d('cake_console', 'Use Database Config').':', $connections, $useDbConfig); |
|
| 366 | 366 | } |
| 367 | 367 | return $useDbConfig; |
| 368 | 368 | } |
@@ -378,7 +378,7 @@ |
||
| 378 | 378 | * Parse tokens |
| 379 | 379 | * |
| 380 | 380 | * @param string $functionName Function name that indicates translatable string (e.g: '__') |
| 381 | - * @param array $map Array containing what variables it will find (e.g: category, domain, singular, plural) |
|
| 381 | + * @param string[] $map Array containing what variables it will find (e.g: category, domain, singular, plural) |
|
| 382 | 382 | * @return void |
| 383 | 383 | */ |
| 384 | 384 | protected function _parse($functionName, $map) { |
@@ -150,17 +150,17 @@ discard block |
||
| 150 | 150 | * @return void |
| 151 | 151 | */ |
| 152 | 152 | public function execute() { |
| 153 | - if (!empty($this->params['exclude'])) { |
|
| 153 | + if ( ! empty($this->params['exclude'])) { |
|
| 154 | 154 | $this->_exclude = explode(',', $this->params['exclude']); |
| 155 | 155 | } |
| 156 | - if (isset($this->params['files']) && !is_array($this->params['files'])) { |
|
| 156 | + if (isset($this->params['files']) && ! is_array($this->params['files'])) { |
|
| 157 | 157 | $this->_files = explode(',', $this->params['files']); |
| 158 | 158 | } |
| 159 | 159 | if (isset($this->params['paths'])) { |
| 160 | 160 | $this->_paths = explode(',', $this->params['paths']); |
| 161 | 161 | } elseif (isset($this->params['plugin'])) { |
| 162 | 162 | $plugin = Inflector::camelize($this->params['plugin']); |
| 163 | - if (!CakePlugin::loaded($plugin)) { |
|
| 163 | + if ( ! CakePlugin::loaded($plugin)) { |
|
| 164 | 164 | CakePlugin::load($plugin); |
| 165 | 165 | } |
| 166 | 166 | $this->_paths = array(CakePlugin::path($plugin)); |
@@ -170,44 +170,44 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if (isset($this->params['extract-core'])) { |
| 173 | - $this->_extractCore = !(strtolower($this->params['extract-core']) === 'no'); |
|
| 173 | + $this->_extractCore = ! (strtolower($this->params['extract-core']) === 'no'); |
|
| 174 | 174 | } else { |
| 175 | 175 | $response = $this->in(__d('cake_console', 'Would you like to extract the messages from the CakePHP core?'), array('y', 'n'), 'n'); |
| 176 | 176 | $this->_extractCore = strtolower($response) === 'y'; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | - if (!empty($this->params['exclude-plugins']) && $this->_isExtractingApp()) { |
|
| 179 | + if ( ! empty($this->params['exclude-plugins']) && $this->_isExtractingApp()) { |
|
| 180 | 180 | $this->_exclude = array_merge($this->_exclude, App::path('plugins')); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if (!empty($this->params['ignore-model-validation']) || (!$this->_isExtractingApp() && empty($plugin))) { |
|
| 183 | + if ( ! empty($this->params['ignore-model-validation']) || ( ! $this->_isExtractingApp() && empty($plugin))) { |
|
| 184 | 184 | $this->_extractValidation = false; |
| 185 | 185 | } |
| 186 | - if (!empty($this->params['validation-domain'])) { |
|
| 186 | + if ( ! empty($this->params['validation-domain'])) { |
|
| 187 | 187 | $this->_validationDomain = $this->params['validation-domain']; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | if ($this->_extractCore) { |
| 191 | 191 | $this->_paths[] = CAKE; |
| 192 | 192 | $this->_exclude = array_merge($this->_exclude, array( |
| 193 | - CAKE . 'Test', |
|
| 194 | - CAKE . 'Console' . DS . 'Templates' |
|
| 193 | + CAKE.'Test', |
|
| 194 | + CAKE.'Console'.DS.'Templates' |
|
| 195 | 195 | )); |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | if (isset($this->params['output'])) { |
| 199 | 199 | $this->_output = $this->params['output']; |
| 200 | 200 | } elseif (isset($this->params['plugin'])) { |
| 201 | - $this->_output = $this->_paths[0] . DS . 'Locale'; |
|
| 201 | + $this->_output = $this->_paths[0].DS.'Locale'; |
|
| 202 | 202 | } else { |
| 203 | - $message = __d('cake_console', "What is the path you would like to output?\n[Q]uit", $this->_paths[0] . DS . 'Locale'); |
|
| 203 | + $message = __d('cake_console', "What is the path you would like to output?\n[Q]uit", $this->_paths[0].DS.'Locale'); |
|
| 204 | 204 | while (true) { |
| 205 | - $response = $this->in($message, null, rtrim($this->_paths[0], DS) . DS . 'Locale'); |
|
| 205 | + $response = $this->in($message, null, rtrim($this->_paths[0], DS).DS.'Locale'); |
|
| 206 | 206 | if (strtoupper($response) === 'Q') { |
| 207 | 207 | $this->out(__d('cake_console', 'Extract Aborted')); |
| 208 | 208 | return $this->_stop(); |
| 209 | 209 | } elseif ($this->_isPathUsable($response)) { |
| 210 | - $this->_output = $response . DS; |
|
| 210 | + $this->_output = $response.DS; |
|
| 211 | 211 | break; |
| 212 | 212 | } else { |
| 213 | 213 | $this->err(__d('cake_console', 'The directory path you supplied was not found. Please try again.')); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | if (isset($this->params['merge'])) { |
| 220 | - $this->_merge = !(strtolower($this->params['merge']) === 'no'); |
|
| 220 | + $this->_merge = ! (strtolower($this->params['merge']) === 'no'); |
|
| 221 | 221 | } else { |
| 222 | 222 | $this->out(); |
| 223 | 223 | $response = $this->in(__d('cake_console', 'Would you like to merge all domain and category strings into the default.pot file?'), array('y', 'n'), 'n'); |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | $this->_searchFiles(); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - $this->_output = rtrim($this->_output, DS) . DS; |
|
| 232 | - if (!$this->_isPathUsable($this->_output)) { |
|
| 231 | + $this->_output = rtrim($this->_output, DS).DS; |
|
| 232 | + if ( ! $this->_isPathUsable($this->_output)) { |
|
| 233 | 233 | $this->err(__d('cake_console', 'The output directory %s was not found or writable.', $this->_output)); |
| 234 | 234 | return $this->_stop(); |
| 235 | 235 | } |
@@ -280,9 +280,9 @@ discard block |
||
| 280 | 280 | $this->hr(); |
| 281 | 281 | $this->out(__d('cake_console', 'Paths:')); |
| 282 | 282 | foreach ($this->_paths as $path) { |
| 283 | - $this->out(' ' . $path); |
|
| 283 | + $this->out(' '.$path); |
|
| 284 | 284 | } |
| 285 | - $this->out(__d('cake_console', 'Output Directory: ') . $this->_output); |
|
| 285 | + $this->out(__d('cake_console', 'Output Directory: ').$this->_output); |
|
| 286 | 286 | $this->hr(); |
| 287 | 287 | $this->_extractTokens(); |
| 288 | 288 | $this->_extractValidationMessages(); |
@@ -322,15 +322,15 @@ discard block |
||
| 322 | 322 | ->addOption('ignore-model-validation', array( |
| 323 | 323 | 'boolean' => true, |
| 324 | 324 | 'default' => false, |
| 325 | - 'help' => __d('cake_console', 'Ignores validation messages in the $validate property.' . |
|
| 326 | - ' If this flag is not set and the command is run from the same app directory,' . |
|
| 325 | + 'help' => __d('cake_console', 'Ignores validation messages in the $validate property.'. |
|
| 326 | + ' If this flag is not set and the command is run from the same app directory,'. |
|
| 327 | 327 | ' all messages in model validation rules will be extracted as tokens.') |
| 328 | 328 | )) |
| 329 | 329 | ->addOption('validation-domain', array( |
| 330 | 330 | 'help' => __d('cake_console', 'If set to a value, the localization domain to be used for model validation messages.') |
| 331 | 331 | )) |
| 332 | 332 | ->addOption('exclude', array( |
| 333 | - 'help' => __d('cake_console', 'Comma separated list of directories to exclude.' . |
|
| 333 | + 'help' => __d('cake_console', 'Comma separated list of directories to exclude.'. |
|
| 334 | 334 | ' Any path containing a path segment with the provided values will be skipped. E.g. test,vendors') |
| 335 | 335 | )) |
| 336 | 336 | ->addOption('overwrite', array( |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | $this->_tokens = array(); |
| 361 | 361 | foreach ($allTokens as $token) { |
| 362 | - if (!is_array($token) || ($token[0] != T_WHITESPACE && $token[0] != T_INLINE_HTML)) { |
|
| 362 | + if ( ! is_array($token) || ($token[0] != T_WHITESPACE && $token[0] != T_INLINE_HTML)) { |
|
| 363 | 363 | $this->_tokens[] = $token; |
| 364 | 364 | } |
| 365 | 365 | } |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | while (($tokenCount - $count) > 1) { |
| 390 | 390 | $countToken = $this->_tokens[$count]; |
| 391 | 391 | $firstParenthesis = $this->_tokens[$count + 1]; |
| 392 | - if (!is_array($countToken)) { |
|
| 392 | + if ( ! is_array($countToken)) { |
|
| 393 | 393 | $count++; |
| 394 | 394 | continue; |
| 395 | 395 | } |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $position = $count; |
| 400 | 400 | $depth = 0; |
| 401 | 401 | |
| 402 | - while (!$depth) { |
|
| 402 | + while ( ! $depth) { |
|
| 403 | 403 | if ($this->_tokens[$position] === '(') { |
| 404 | 404 | $depth++; |
| 405 | 405 | } elseif ($this->_tokens[$position] === ')') { |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | * @return void |
| 441 | 441 | */ |
| 442 | 442 | protected function _extractValidationMessages() { |
| 443 | - if (!$this->_extractValidation) { |
|
| 443 | + if ( ! $this->_extractValidation) { |
|
| 444 | 444 | return; |
| 445 | 445 | } |
| 446 | 446 | |
@@ -461,19 +461,19 @@ discard block |
||
| 461 | 461 | */ |
| 462 | 462 | protected function _extractPluginValidationMessages($plugin = null) { |
| 463 | 463 | App::uses('AppModel', 'Model'); |
| 464 | - if (!empty($plugin)) { |
|
| 465 | - if (!CakePlugin::loaded($plugin)) { |
|
| 464 | + if ( ! empty($plugin)) { |
|
| 465 | + if ( ! CakePlugin::loaded($plugin)) { |
|
| 466 | 466 | return; |
| 467 | 467 | } |
| 468 | - App::uses($plugin . 'AppModel', $plugin . '.Model'); |
|
| 469 | - $plugin = $plugin . '.'; |
|
| 468 | + App::uses($plugin.'AppModel', $plugin.'.Model'); |
|
| 469 | + $plugin = $plugin.'.'; |
|
| 470 | 470 | } |
| 471 | - $models = App::objects($plugin . 'Model', null, false); |
|
| 471 | + $models = App::objects($plugin.'Model', null, false); |
|
| 472 | 472 | |
| 473 | 473 | foreach ($models as $model) { |
| 474 | - App::uses($model, $plugin . 'Model'); |
|
| 474 | + App::uses($model, $plugin.'Model'); |
|
| 475 | 475 | $reflection = new ReflectionClass($model); |
| 476 | - if (!$reflection->isSubClassOf('Model')) { |
|
| 476 | + if ( ! $reflection->isSubClassOf('Model')) { |
|
| 477 | 477 | continue; |
| 478 | 478 | } |
| 479 | 479 | $properties = $reflection->getDefaultProperties(); |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | |
| 485 | 485 | $file = $reflection->getFileName(); |
| 486 | 486 | $domain = $this->_validationDomain; |
| 487 | - if (!empty($properties['validationDomain'])) { |
|
| 487 | + if ( ! empty($properties['validationDomain'])) { |
|
| 488 | 488 | $domain = $properties['validationDomain']; |
| 489 | 489 | } |
| 490 | 490 | foreach ($validate as $field => $rules) { |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | * @return void |
| 506 | 506 | */ |
| 507 | 507 | protected function _processValidationRules($field, $rules, $file, $domain, $category = 'LC_MESSAGES') { |
| 508 | - if (!is_array($rules)) { |
|
| 508 | + if ( ! is_array($rules)) { |
|
| 509 | 509 | return; |
| 510 | 510 | } |
| 511 | 511 | |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $msgid = $this->_formatString(sprintf("'%s'", $msgid)); |
| 530 | 530 | $details = array( |
| 531 | 531 | 'file' => $file, |
| 532 | - 'line' => 'validation for field ' . $field |
|
| 532 | + 'line' => 'validation for field '.$field |
|
| 533 | 533 | ); |
| 534 | 534 | $this->_addTranslation($category, $domain, $msgid, $details); |
| 535 | 535 | } |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | */ |
| 544 | 544 | protected function _buildFiles() { |
| 545 | 545 | $paths = $this->_paths; |
| 546 | - $paths[] = realpath(APP) . DS; |
|
| 546 | + $paths[] = realpath(APP).DS; |
|
| 547 | 547 | foreach ($this->_translations as $category => $domains) { |
| 548 | 548 | foreach ($domains as $domain => $translations) { |
| 549 | 549 | foreach ($translations as $msgid => $details) { |
@@ -552,10 +552,10 @@ discard block |
||
| 552 | 552 | $occurrences = array(); |
| 553 | 553 | foreach ($files as $file => $lines) { |
| 554 | 554 | $lines = array_unique($lines); |
| 555 | - $occurrences[] = $file . ':' . implode(';', $lines); |
|
| 555 | + $occurrences[] = $file.':'.implode(';', $lines); |
|
| 556 | 556 | } |
| 557 | 557 | $occurrences = implode("\n#: ", $occurrences); |
| 558 | - $header = '#: ' . str_replace(DS, '/', str_replace($paths, '', $occurrences)) . "\n"; |
|
| 558 | + $header = '#: '.str_replace(DS, '/', str_replace($paths, '', $occurrences))."\n"; |
|
| 559 | 559 | |
| 560 | 560 | if ($plural === false) { |
| 561 | 561 | $sentence = "msgid \"{$msgid}\"\n"; |
@@ -586,13 +586,13 @@ discard block |
||
| 586 | 586 | * @return void |
| 587 | 587 | */ |
| 588 | 588 | protected function _store($category, $domain, $header, $sentence) { |
| 589 | - if (!isset($this->_storage[$category])) { |
|
| 589 | + if ( ! isset($this->_storage[$category])) { |
|
| 590 | 590 | $this->_storage[$category] = array(); |
| 591 | 591 | } |
| 592 | - if (!isset($this->_storage[$category][$domain])) { |
|
| 592 | + if ( ! isset($this->_storage[$category][$domain])) { |
|
| 593 | 593 | $this->_storage[$category][$domain] = array(); |
| 594 | 594 | } |
| 595 | - if (!isset($this->_storage[$category][$domain][$sentence])) { |
|
| 595 | + if ( ! isset($this->_storage[$category][$domain][$sentence])) { |
|
| 596 | 596 | $this->_storage[$category][$domain][$sentence] = $header; |
| 597 | 597 | } else { |
| 598 | 598 | $this->_storage[$category][$domain][$sentence] .= $header; |
@@ -606,22 +606,22 @@ discard block |
||
| 606 | 606 | */ |
| 607 | 607 | protected function _writeFiles() { |
| 608 | 608 | $overwriteAll = false; |
| 609 | - if (!empty($this->params['overwrite'])) { |
|
| 609 | + if ( ! empty($this->params['overwrite'])) { |
|
| 610 | 610 | $overwriteAll = true; |
| 611 | 611 | } |
| 612 | 612 | foreach ($this->_storage as $category => $domains) { |
| 613 | 613 | foreach ($domains as $domain => $sentences) { |
| 614 | 614 | $output = $this->_writeHeader(); |
| 615 | 615 | foreach ($sentences as $sentence => $header) { |
| 616 | - $output .= $header . $sentence; |
|
| 616 | + $output .= $header.$sentence; |
|
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - $filename = $domain . '.pot'; |
|
| 619 | + $filename = $domain.'.pot'; |
|
| 620 | 620 | if ($category === 'LC_MESSAGES') { |
| 621 | - $File = new File($this->_output . $filename); |
|
| 621 | + $File = new File($this->_output.$filename); |
|
| 622 | 622 | } else { |
| 623 | - new Folder($this->_output . $category, true); |
|
| 624 | - $File = new File($this->_output . $category . DS . $filename); |
|
| 623 | + new Folder($this->_output.$category, true); |
|
| 624 | + $File = new File($this->_output.$category.DS.$filename); |
|
| 625 | 625 | } |
| 626 | 626 | $response = ''; |
| 627 | 627 | while ($overwriteAll === false && $File->exists() && strtoupper($response) !== 'Y') { |
@@ -633,9 +633,9 @@ discard block |
||
| 633 | 633 | ); |
| 634 | 634 | if (strtoupper($response) === 'N') { |
| 635 | 635 | $response = ''; |
| 636 | - while (!$response) { |
|
| 637 | - $response = $this->in(__d('cake_console', "What would you like to name this file?"), null, 'new_' . $filename); |
|
| 638 | - $File = new File($this->_output . $response); |
|
| 636 | + while ( ! $response) { |
|
| 637 | + $response = $this->in(__d('cake_console', "What would you like to name this file?"), null, 'new_'.$filename); |
|
| 638 | + $File = new File($this->_output.$response); |
|
| 639 | 639 | $filename = $response; |
| 640 | 640 | } |
| 641 | 641 | } elseif (strtoupper($response) === 'A') { |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | $output .= "msgid \"\"\n"; |
| 662 | 662 | $output .= "msgstr \"\"\n"; |
| 663 | 663 | $output .= "\"Project-Id-Version: PROJECT VERSION\\n\"\n"; |
| 664 | - $output .= "\"POT-Creation-Date: " . date("Y-m-d H:iO") . "\\n\"\n"; |
|
| 664 | + $output .= "\"POT-Creation-Date: ".date("Y-m-d H:iO")."\\n\"\n"; |
|
| 665 | 665 | $output .= "\"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\\n\"\n"; |
| 666 | 666 | $output .= "\"Last-Translator: NAME <EMAIL@ADDRESS>\\n\"\n"; |
| 667 | 667 | $output .= "\"Language-Team: LANGUAGE <EMAIL@ADDRESS>\\n\"\n"; |
@@ -761,20 +761,20 @@ discard block |
||
| 761 | 761 | */ |
| 762 | 762 | protected function _searchFiles() { |
| 763 | 763 | $pattern = false; |
| 764 | - if (!empty($this->_exclude)) { |
|
| 764 | + if ( ! empty($this->_exclude)) { |
|
| 765 | 765 | $exclude = array(); |
| 766 | 766 | foreach ($this->_exclude as $e) { |
| 767 | 767 | if (DS !== '\\' && $e[0] !== DS) { |
| 768 | - $e = DS . $e; |
|
| 768 | + $e = DS.$e; |
|
| 769 | 769 | } |
| 770 | 770 | $exclude[] = preg_quote($e, '/'); |
| 771 | 771 | } |
| 772 | - $pattern = '/' . implode('|', $exclude) . '/'; |
|
| 772 | + $pattern = '/'.implode('|', $exclude).'/'; |
|
| 773 | 773 | } |
| 774 | 774 | foreach ($this->_paths as $path) { |
| 775 | 775 | $Folder = new Folder($path); |
| 776 | 776 | $files = $Folder->findRecursive('.*\.(php|ctp|thtml|inc|tpl)', true); |
| 777 | - if (!empty($pattern)) { |
|
| 777 | + if ( ! empty($pattern)) { |
|
| 778 | 778 | foreach ($files as $i => $file) { |
| 779 | 779 | if (preg_match($pattern, $file)) { |
| 780 | 780 | unset($files[$i]); |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | /** |
| 187 | 187 | * Handles interactive baking |
| 188 | 188 | * |
| 189 | - * @return boolean |
|
| 189 | + * @return false|null |
|
| 190 | 190 | */ |
| 191 | 191 | protected function _interactive() { |
| 192 | 192 | $this->hr(); |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | /** |
| 368 | 368 | * Populate the _validations array |
| 369 | 369 | * |
| 370 | - * @return void |
|
| 370 | + * @return string[] |
|
| 371 | 371 | */ |
| 372 | 372 | public function initValidations() { |
| 373 | 373 | $options = $choices = array(); |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | /** |
| 671 | 671 | * Interact with the user and confirm associations. |
| 672 | 672 | * |
| 673 | - * @param array $model Temporary Model instance. |
|
| 673 | + * @param Model $model Temporary Model instance. |
|
| 674 | 674 | * @param array $associations Array of associations to be confirmed. |
| 675 | 675 | * @return array Array of confirmed associations |
| 676 | 676 | */ |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | $this->_interactive(); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if (!empty($this->args[0])) { |
|
| 94 | + if ( ! empty($this->args[0])) { |
|
| 95 | 95 | $this->interactive = false; |
| 96 | - if (!isset($this->connection)) { |
|
| 96 | + if ( ! isset($this->connection)) { |
|
| 97 | 97 | $this->connection = 'default'; |
| 98 | 98 | } |
| 99 | 99 | if (strtolower($this->args[0]) === 'all') { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @return Model Model instance |
| 143 | 143 | */ |
| 144 | 144 | protected function _getModelObject($className, $table = null) { |
| 145 | - if (!$table) { |
|
| 145 | + if ( ! $table) { |
|
| 146 | 146 | $table = Inflector::tableize($className); |
| 147 | 147 | } |
| 148 | 148 | $object = new Model(array('name' => $className, 'table' => $table, 'ds' => $this->connection)); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | public function inOptions($options, $prompt = null, $default = null) { |
| 168 | 168 | $valid = false; |
| 169 | 169 | $max = count($options); |
| 170 | - while (!$valid) { |
|
| 170 | + while ( ! $valid) { |
|
| 171 | 171 | $len = strlen(count($options) + 1); |
| 172 | 172 | foreach ($options as $i => $option) { |
| 173 | 173 | $this->out(sprintf("%${len}d. %s", $i + 1, $option)); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $useTable = $this->getTable($currentModelName); |
| 205 | 205 | $db = ConnectionManager::getDataSource($this->connection); |
| 206 | 206 | $fullTableName = $db->fullTableName($useTable); |
| 207 | - if (!in_array($useTable, $this->_tables)) { |
|
| 207 | + if ( ! in_array($useTable, $this->_tables)) { |
|
| 208 | 208 | $prompt = __d('cake_console', "The table %s doesn't exist or could not be automatically detected\ncontinue anyway?", $useTable); |
| 209 | 209 | $continue = $this->in($prompt, array('y', 'n')); |
| 210 | 210 | if (strtolower($continue) === 'n') { |
@@ -221,13 +221,13 @@ discard block |
||
| 221 | 221 | } catch (Exception $e) { |
| 222 | 222 | $fields = array($tempModel->primaryKey); |
| 223 | 223 | } |
| 224 | - if (!array_key_exists('id', $fields)) { |
|
| 224 | + if ( ! array_key_exists('id', $fields)) { |
|
| 225 | 225 | $primaryKey = $this->findPrimaryKey($fields); |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | if ($knownToExist) { |
| 229 | 229 | $displayField = $tempModel->hasField(array('name', 'title')); |
| 230 | - if (!$displayField) { |
|
| 230 | + if ( ! $displayField) { |
|
| 231 | 231 | $displayField = $this->findDisplayField($tempModel->schema()); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -259,10 +259,10 @@ discard block |
||
| 259 | 259 | if ($primaryKey !== 'id') { |
| 260 | 260 | $this->out(__d('cake_console', 'Primary Key: %s', $primaryKey)); |
| 261 | 261 | } |
| 262 | - if (!empty($validate)) { |
|
| 262 | + if ( ! empty($validate)) { |
|
| 263 | 263 | $this->out(__d('cake_console', 'Validation: %s', print_r($validate, true))); |
| 264 | 264 | } |
| 265 | - if (!empty($associations)) { |
|
| 265 | + if ( ! empty($associations)) { |
|
| 266 | 266 | $this->out(__d('cake_console', 'Associations:')); |
| 267 | 267 | $assocKeys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'); |
| 268 | 268 | foreach ($assocKeys as $assocKey) { |
@@ -296,9 +296,9 @@ discard block |
||
| 296 | 296 | * @return void |
| 297 | 297 | */ |
| 298 | 298 | protected function _printAssociation($modelName, $type, $associations) { |
| 299 | - if (!empty($associations[$type])) { |
|
| 299 | + if ( ! empty($associations[$type])) { |
|
| 300 | 300 | for ($i = 0, $len = count($associations[$type]); $i < $len; $i++) { |
| 301 | - $out = "\t" . $modelName . ' ' . $type . ' ' . $associations[$type][$i]['alias']; |
|
| 301 | + $out = "\t".$modelName.' '.$type.' '.$associations[$type][$i]['alias']; |
|
| 302 | 302 | $this->out($out); |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | * @return array $validate Array of user selected validations. |
| 346 | 346 | */ |
| 347 | 347 | public function doValidation($model) { |
| 348 | - if (!$model instanceof Model) { |
|
| 348 | + if ( ! $model instanceof Model) { |
|
| 349 | 349 | return false; |
| 350 | 350 | } |
| 351 | 351 | $fields = $model->schema(); |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | $this->initValidations(); |
| 358 | 358 | foreach ($fields as $fieldName => $field) { |
| 359 | 359 | $validation = $this->fieldValidation($fieldName, $field, $model->primaryKey); |
| 360 | - if (!empty($validation)) { |
|
| 360 | + if ( ! empty($validation)) { |
|
| 361 | 361 | $validate[$fieldName] = $validation; |
| 362 | 362 | } |
| 363 | 363 | } |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | $optionText = ''; |
| 413 | 413 | for ($i = 1, $m = $defaultChoice / 2; $i <= $m; $i++) { |
| 414 | 414 | $line = sprintf("%2d. %s", $i, $this->_validations[$i]); |
| 415 | - $optionText .= $line . str_repeat(" ", 31 - strlen($line)); |
|
| 415 | + $optionText .= $line.str_repeat(" ", 31 - strlen($line)); |
|
| 416 | 416 | if ($m + $i !== $defaultChoice) { |
| 417 | 417 | $optionText .= sprintf("%2d. %s\n", $m + $i, $this->_validations[$m + $i]); |
| 418 | 418 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | $prompt = __d('cake_console', "... or enter in a valid regex validation string.\n"); |
| 426 | 426 | $methods = array_flip($this->_validations); |
| 427 | 427 | $guess = $defaultChoice; |
| 428 | - if ($metaData['null'] != 1 && !in_array($fieldName, array($primaryKey, 'created', 'modified', 'updated'))) { |
|
| 428 | + if ($metaData['null'] != 1 && ! in_array($fieldName, array($primaryKey, 'created', 'modified', 'updated'))) { |
|
| 429 | 429 | if ($fieldName === 'email') { |
| 430 | 430 | $guess = $methods['email']; |
| 431 | 431 | } elseif ($metaData['type'] === 'string' && $metaData['length'] == 36) { |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | $this->out(__d('cake_console', "You have already chosen that validation rule,\nplease choose again")); |
| 458 | 458 | continue; |
| 459 | 459 | } |
| 460 | - if (!isset($this->_validations[$choice]) && is_numeric($choice)) { |
|
| 460 | + if ( ! isset($this->_validations[$choice]) && is_numeric($choice)) { |
|
| 461 | 461 | $this->out(__d('cake_console', 'Please make a valid selection.')); |
| 462 | 462 | continue; |
| 463 | 463 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @return array Associations |
| 494 | 494 | */ |
| 495 | 495 | public function doAssociations($model) { |
| 496 | - if (!$model instanceof Model) { |
|
| 496 | + if ( ! $model instanceof Model) { |
|
| 497 | 497 | return false; |
| 498 | 498 | } |
| 499 | 499 | if ($this->interactive === true) { |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | } |
| 507 | 507 | |
| 508 | 508 | if (empty($this->_tables)) { |
| 509 | - $this->_tables = (array)$this->getAllTables(); |
|
| 509 | + $this->_tables = (array) $this->getAllTables(); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | $associations = array( |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | * @return array Behaviors |
| 546 | 546 | */ |
| 547 | 547 | public function doActsAs($model) { |
| 548 | - if (!$model instanceof Model) { |
|
| 548 | + if ( ! $model instanceof Model) { |
|
| 549 | 549 | return false; |
| 550 | 550 | } |
| 551 | 551 | $behaviors = array(); |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | ); |
| 583 | 583 | } elseif ($fieldName === 'parent_id') { |
| 584 | 584 | $associations['belongsTo'][] = array( |
| 585 | - 'alias' => 'Parent' . $model->name, |
|
| 585 | + 'alias' => 'Parent'.$model->name, |
|
| 586 | 586 | 'className' => $model->name, |
| 587 | 587 | 'foreignKey' => $fieldName, |
| 588 | 588 | ); |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | $tempOtherModel = $this->_getModelObject($this->_modelName($otherTable), $otherTable); |
| 605 | 605 | $tempFieldNames = array_keys($tempOtherModel->schema(true)); |
| 606 | 606 | |
| 607 | - $pattern = '/_' . preg_quote($model->table, '/') . '|' . preg_quote($model->table, '/') . '_/'; |
|
| 607 | + $pattern = '/_'.preg_quote($model->table, '/').'|'.preg_quote($model->table, '/').'_/'; |
|
| 608 | 608 | $possibleJoinTable = preg_match($pattern, $otherTable); |
| 609 | 609 | if ($possibleJoinTable) { |
| 610 | 610 | continue; |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | ); |
| 620 | 620 | } elseif ($otherTable === $model->table && $fieldName === 'parent_id') { |
| 621 | 621 | $assoc = array( |
| 622 | - 'alias' => 'Child' . $model->name, |
|
| 622 | + 'alias' => 'Child'.$model->name, |
|
| 623 | 623 | 'className' => $model->name, |
| 624 | 624 | 'foreignKey' => $fieldName |
| 625 | 625 | ); |
@@ -645,11 +645,11 @@ discard block |
||
| 645 | 645 | $foreignKey = $this->_modelKey($model->name); |
| 646 | 646 | foreach ($this->_tables as $otherTable) { |
| 647 | 647 | $tableName = null; |
| 648 | - $offset = strpos($otherTable, $model->table . '_'); |
|
| 649 | - $otherOffset = strpos($otherTable, '_' . $model->table); |
|
| 648 | + $offset = strpos($otherTable, $model->table.'_'); |
|
| 649 | + $otherOffset = strpos($otherTable, '_'.$model->table); |
|
| 650 | 650 | |
| 651 | 651 | if ($offset !== false) { |
| 652 | - $tableName = substr($otherTable, strlen($model->table . '_')); |
|
| 652 | + $tableName = substr($otherTable, strlen($model->table.'_')); |
|
| 653 | 653 | } elseif ($otherOffset !== false) { |
| 654 | 654 | $tableName = substr($otherTable, 0, $otherOffset); |
| 655 | 655 | } |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | */ |
| 677 | 677 | public function confirmAssociations(Model $model, $associations) { |
| 678 | 678 | foreach ($associations as $type => $settings) { |
| 679 | - if (!empty($associations[$type])) { |
|
| 679 | + if ( ! empty($associations[$type])) { |
|
| 680 | 680 | foreach ($associations[$type] as $i => $assoc) { |
| 681 | 681 | $prompt = "{$model->name} {$type} {$assoc['alias']}?"; |
| 682 | 682 | $response = $this->in($prompt, array('y', 'n'), 'y'); |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | $this->out(__d('cake_console', 'What is the association type?')); |
| 710 | 710 | $assocType = intval($this->inOptions($assocs, __d('cake_console', 'Enter a number'))); |
| 711 | 711 | |
| 712 | - $this->out(__d('cake_console', "For the following options be very careful to match your setup exactly.\n" . |
|
| 712 | + $this->out(__d('cake_console', "For the following options be very careful to match your setup exactly.\n". |
|
| 713 | 713 | "Any spelling mistakes will cause errors.")); |
| 714 | 714 | $this->hr(); |
| 715 | 715 | |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | $className = $this->in(__d('cake_console', 'What className will %s use?', $alias), null, $alias); |
| 718 | 718 | |
| 719 | 719 | if ($assocType === 0) { |
| 720 | - if (!empty($possibleKeys[$model->table])) { |
|
| 720 | + if ( ! empty($possibleKeys[$model->table])) { |
|
| 721 | 721 | $showKeys = $possibleKeys[$model->table]; |
| 722 | 722 | } else { |
| 723 | 723 | $showKeys = null; |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | $otherTable = Inflector::tableize($className); |
| 728 | 728 | if (in_array($otherTable, $this->_tables)) { |
| 729 | 729 | if ($assocType < 3) { |
| 730 | - if (!empty($possibleKeys[$otherTable])) { |
|
| 730 | + if ( ! empty($possibleKeys[$otherTable])) { |
|
| 731 | 731 | $showKeys = $possibleKeys[$otherTable]; |
| 732 | 732 | } else { |
| 733 | 733 | $showKeys = null; |
@@ -741,19 +741,19 @@ discard block |
||
| 741 | 741 | } |
| 742 | 742 | $suggestedForeignKey = $this->_modelKey($model->name); |
| 743 | 743 | } |
| 744 | - if (!empty($showKeys)) { |
|
| 744 | + if ( ! empty($showKeys)) { |
|
| 745 | 745 | $this->out(__d('cake_console', 'A helpful List of possible keys')); |
| 746 | 746 | $foreignKey = $this->inOptions($showKeys, __d('cake_console', 'What is the foreignKey?')); |
| 747 | 747 | $foreignKey = $showKeys[intval($foreignKey)]; |
| 748 | 748 | } |
| 749 | - if (!isset($foreignKey)) { |
|
| 749 | + if ( ! isset($foreignKey)) { |
|
| 750 | 750 | $foreignKey = $this->in(__d('cake_console', 'What is the foreignKey? Specify your own.'), null, $suggestedForeignKey); |
| 751 | 751 | } |
| 752 | 752 | if ($assocType === 3) { |
| 753 | 753 | $associationForeignKey = $this->in(__d('cake_console', 'What is the associationForeignKey?'), null, $this->_modelKey($model->name)); |
| 754 | 754 | $joinTable = $this->in(__d('cake_console', 'What is the joinTable?')); |
| 755 | 755 | } |
| 756 | - $associations[$assocs[$assocType]] = array_values((array)$associations[$assocs[$assocType]]); |
|
| 756 | + $associations[$assocs[$assocType]] = array_values((array) $associations[$assocs[$assocType]]); |
|
| 757 | 757 | $count = count($associations[$assocs[$assocType]]); |
| 758 | 758 | $i = ($count > 0) ? $count : 0; |
| 759 | 759 | $associations[$assocs[$assocType]][$i]['alias'] = $alias; |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | */ |
| 797 | 797 | public function bake($name, $data = array()) { |
| 798 | 798 | if ($name instanceof Model) { |
| 799 | - if (!$data) { |
|
| 799 | + if ( ! $data) { |
|
| 800 | 800 | $data = array(); |
| 801 | 801 | $data['associations'] = $this->doAssociations($name); |
| 802 | 802 | $data['validate'] = $this->doValidation($name); |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | |
| 824 | 824 | $pluginPath = ''; |
| 825 | 825 | if ($this->plugin) { |
| 826 | - $pluginPath = $this->plugin . '.'; |
|
| 826 | + $pluginPath = $this->plugin.'.'; |
|
| 827 | 827 | } |
| 828 | 828 | |
| 829 | 829 | $this->Template->set($data); |
@@ -834,8 +834,8 @@ discard block |
||
| 834 | 834 | $out = $this->Template->generate('classes', 'model'); |
| 835 | 835 | |
| 836 | 836 | $path = $this->getPath(); |
| 837 | - $filename = $path . $name . '.php'; |
|
| 838 | - $this->out("\n" . __d('cake_console', 'Baking model class for %s...', $name), 1, Shell::QUIET); |
|
| 837 | + $filename = $path.$name.'.php'; |
|
| 838 | + $this->out("\n".__d('cake_console', 'Baking model class for %s...', $name), 1, Shell::QUIET); |
|
| 839 | 839 | $this->createFile($filename, $out); |
| 840 | 840 | ClassRegistry::flush(); |
| 841 | 841 | return $out; |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | } |
| 894 | 894 | |
| 895 | 895 | if ($this->interactive === true) { |
| 896 | - if (!isset($useDbConfig)) { |
|
| 896 | + if ( ! isset($useDbConfig)) { |
|
| 897 | 897 | $useDbConfig = $this->connection; |
| 898 | 898 | } |
| 899 | 899 | $db = ConnectionManager::getDataSource($useDbConfig); |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | * @return array Array of tables in the database. |
| 920 | 920 | */ |
| 921 | 921 | public function getAllTables($useDbConfig = null) { |
| 922 | - if (!isset($useDbConfig)) { |
|
| 922 | + if ( ! isset($useDbConfig)) { |
|
| 923 | 923 | $useDbConfig = $this->connection; |
| 924 | 924 | } |
| 925 | 925 | |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | $usePrefix = empty($db->config['prefix']) ? '' : $db->config['prefix']; |
| 930 | 930 | if ($usePrefix) { |
| 931 | 931 | foreach ($db->listSources() as $table) { |
| 932 | - if (!strncmp($table, $usePrefix, strlen($usePrefix))) { |
|
| 932 | + if ( ! strncmp($table, $usePrefix, strlen($usePrefix))) { |
|
| 933 | 933 | $tables[] = substr($table, strlen($usePrefix)); |
| 934 | 934 | } |
| 935 | 935 | } |
@@ -955,8 +955,8 @@ discard block |
||
| 955 | 955 | |
| 956 | 956 | $enteredModel = ''; |
| 957 | 957 | |
| 958 | - while (!$enteredModel) { |
|
| 959 | - $enteredModel = $this->in(__d('cake_console', "Enter a number from the list above,\n" . |
|
| 958 | + while ( ! $enteredModel) { |
|
| 959 | + $enteredModel = $this->in(__d('cake_console', "Enter a number from the list above,\n". |
|
| 960 | 960 | "type in the name of another model, or 'q' to exit"), null, 'q'); |
| 961 | 961 | |
| 962 | 962 | if ($enteredModel === 'q') { |
@@ -964,8 +964,8 @@ discard block |
||
| 964 | 964 | return $this->_stop(); |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | - if (!$enteredModel || intval($enteredModel) > count($this->_modelNames)) { |
|
| 968 | - $this->err(__d('cake_console', "The model name you supplied was empty,\n" . |
|
| 967 | + if ( ! $enteredModel || intval($enteredModel) > count($this->_modelNames)) { |
|
| 968 | + $this->err(__d('cake_console', "The model name you supplied was empty,\n". |
|
| 969 | 969 | "or the number you selected was not an option. Please try again.")); |
| 970 | 970 | $enteredModel = ''; |
| 971 | 971 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | /** |
| 54 | 54 | * Execution method always used for tasks |
| 55 | 55 | * |
| 56 | - * @return void |
|
| 56 | + * @return false|null |
|
| 57 | 57 | */ |
| 58 | 58 | public function execute() { |
| 59 | 59 | if (isset($this->args[0])) { |
@@ -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.') |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * Checks that given project path does not already exist, and |
| 40 | 40 | * finds the app directory in it. Then it calls bake() with that information. |
| 41 | 41 | * |
| 42 | - * @return mixed |
|
| 42 | + * @return string|null |
|
| 43 | 43 | */ |
| 44 | 44 | public function execute() { |
| 45 | 45 | $project = null; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | * @param string $path Project path |
| 163 | 163 | * @param string $skel Path to copy from |
| 164 | 164 | * @param string $skip array of directories to skip when copying |
| 165 | - * @return mixed |
|
| 165 | + * @return boolean|null |
|
| 166 | 166 | */ |
| 167 | 167 | public function bake($path, $skel = null, $skip = array('empty')) { |
| 168 | 168 | if (!$skel && !empty($this->params['skel'])) { |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | * |
| 312 | 312 | * @param string $path Project path |
| 313 | 313 | * @param boolean $hardCode Whether or not define calls should be hardcoded. |
| 314 | - * @return boolean Success |
|
| 314 | + * @return boolean|null Success |
|
| 315 | 315 | */ |
| 316 | 316 | public function corePath($path, $hardCode = true) { |
| 317 | 317 | if (dirname($path) !== CAKE_CORE_INCLUDE_PATH) { |
@@ -50,21 +50,21 @@ discard block |
||
| 50 | 50 | if (empty($appContents)) { |
| 51 | 51 | $suggestedPath = rtrim(APP, DS); |
| 52 | 52 | } else { |
| 53 | - $suggestedPath = APP . 'myapp'; |
|
| 53 | + $suggestedPath = APP.'myapp'; |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - while (!$project) { |
|
| 57 | + while ( ! $project) { |
|
| 58 | 58 | $prompt = __d('cake_console', "What is the path to the project you want to bake?"); |
| 59 | 59 | $project = $this->in($prompt, null, $suggestedPath); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if ($project && !Folder::isAbsolute($project) && isset($_SERVER['PWD'])) { |
|
| 63 | - $project = $_SERVER['PWD'] . DS . $project; |
|
| 62 | + if ($project && ! Folder::isAbsolute($project) && isset($_SERVER['PWD'])) { |
|
| 63 | + $project = $_SERVER['PWD'].DS.$project; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $response = false; |
| 67 | - while (!$response && is_dir($project) === true && file_exists($project . 'Config' . 'core.php')) { |
|
| 67 | + while ( ! $response && is_dir($project) === true && file_exists($project.'Config'.'core.php')) { |
|
| 68 | 68 | $prompt = __d('cake_console', '<warning>A project already exists in this location:</warning> %s Overwrite?', $project); |
| 69 | 69 | $response = $this->in($prompt, array('y', 'n'), 'n'); |
| 70 | 70 | if (strtolower($response) === 'n') { |
@@ -79,14 +79,14 @@ discard block |
||
| 79 | 79 | if ($this->securitySalt($path) === true) { |
| 80 | 80 | $this->out(__d('cake_console', ' * Random hash key created for \'Security.salt\'')); |
| 81 | 81 | } else { |
| 82 | - $this->err(__d('cake_console', 'Unable to generate random hash for \'Security.salt\', you should change it in %s', APP . 'Config' . DS . 'core.php')); |
|
| 82 | + $this->err(__d('cake_console', 'Unable to generate random hash for \'Security.salt\', you should change it in %s', APP.'Config'.DS.'core.php')); |
|
| 83 | 83 | $success = false; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | if ($this->securityCipherSeed($path) === true) { |
| 87 | 87 | $this->out(__d('cake_console', ' * Random seed created for \'Security.cipherSeed\'')); |
| 88 | 88 | } else { |
| 89 | - $this->err(__d('cake_console', 'Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s', APP . 'Config' . DS . 'core.php')); |
|
| 89 | + $this->err(__d('cake_console', 'Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s', APP.'Config'.DS.'core.php')); |
|
| 90 | 90 | $success = false; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $this->out(__d('cake_console', ' * CAKE_CORE_INCLUDE_PATH set to %s in %s', CAKE_CORE_INCLUDE_PATH, 'webroot/index.php')); |
| 118 | 118 | $this->out(__d('cake_console', ' * CAKE_CORE_INCLUDE_PATH set to %s in %s', CAKE_CORE_INCLUDE_PATH, 'webroot/test.php')); |
| 119 | 119 | } else { |
| 120 | - $this->err(__d('cake_console', 'Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path . 'webroot' . DS . 'index.php')); |
|
| 120 | + $this->err(__d('cake_console', 'Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path.'webroot'.DS.'index.php')); |
|
| 121 | 121 | $success = false; |
| 122 | 122 | } |
| 123 | 123 | if ($success && $hardCode) { |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | $Folder = new Folder($path); |
| 128 | - if (!$Folder->chmod($path . 'tmp', 0777)) { |
|
| 129 | - $this->err(__d('cake_console', 'Could not set permissions on %s', $path . DS . 'tmp')); |
|
| 130 | - $this->out('chmod -R 0777 ' . $path . DS . 'tmp'); |
|
| 128 | + if ( ! $Folder->chmod($path.'tmp', 0777)) { |
|
| 129 | + $this->err(__d('cake_console', 'Could not set permissions on %s', $path.DS.'tmp')); |
|
| 130 | + $this->out('chmod -R 0777 '.$path.DS.'tmp'); |
|
| 131 | 131 | $success = false; |
| 132 | 132 | } |
| 133 | 133 | if ($success) { |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | public function cakeOnIncludePath() { |
| 148 | 148 | $paths = explode(PATH_SEPARATOR, ini_get('include_path')); |
| 149 | 149 | foreach ($paths as $path) { |
| 150 | - if (file_exists($path . DS . 'Cake' . DS . 'bootstrap.php')) { |
|
| 150 | + if (file_exists($path.DS.'Cake'.DS.'bootstrap.php')) { |
|
| 151 | 151 | return true; |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -165,23 +165,23 @@ discard block |
||
| 165 | 165 | * @return mixed |
| 166 | 166 | */ |
| 167 | 167 | public function bake($path, $skel = null, $skip = array('empty')) { |
| 168 | - if (!$skel && !empty($this->params['skel'])) { |
|
| 168 | + if ( ! $skel && ! empty($this->params['skel'])) { |
|
| 169 | 169 | $skel = $this->params['skel']; |
| 170 | 170 | } |
| 171 | - while (!$skel) { |
|
| 171 | + while ( ! $skel) { |
|
| 172 | 172 | $skel = $this->in( |
| 173 | 173 | __d('cake_console', "What is the path to the directory layout you wish to copy?"), |
| 174 | 174 | null, |
| 175 | - CAKE . 'Console' . DS . 'Templates' . DS . 'skel' |
|
| 175 | + CAKE.'Console'.DS.'Templates'.DS.'skel' |
|
| 176 | 176 | ); |
| 177 | - if (!$skel) { |
|
| 177 | + if ( ! $skel) { |
|
| 178 | 178 | $this->err(__d('cake_console', 'The directory path you supplied was empty. Please try again.')); |
| 179 | 179 | } else { |
| 180 | 180 | while (is_dir($skel) === false) { |
| 181 | 181 | $skel = $this->in( |
| 182 | 182 | __d('cake_console', 'Directory path does not exist please choose another:'), |
| 183 | 183 | null, |
| 184 | - CAKE . 'Console' . DS . 'Templates' . DS . 'skel' |
|
| 184 | + CAKE.'Console'.DS.'Templates'.DS.'skel' |
|
| 185 | 185 | ); |
| 186 | 186 | } |
| 187 | 187 | } |
@@ -189,8 +189,8 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | $app = basename($path); |
| 191 | 191 | |
| 192 | - $this->out(__d('cake_console', '<info>Skel Directory</info>: ') . $skel); |
|
| 193 | - $this->out(__d('cake_console', '<info>Will be copied to</info>: ') . $path); |
|
| 192 | + $this->out(__d('cake_console', '<info>Skel Directory</info>: ').$skel); |
|
| 193 | + $this->out(__d('cake_console', '<info>Will be copied to</info>: ').$path); |
|
| 194 | 194 | $this->hr(); |
| 195 | 195 | |
| 196 | 196 | $looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n', 'q'), 'y'); |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | switch (strtolower($looksGood)) { |
| 199 | 199 | case 'y': |
| 200 | 200 | $Folder = new Folder($skel); |
| 201 | - if (!empty($this->params['empty'])) { |
|
| 201 | + if ( ! empty($this->params['empty'])) { |
|
| 202 | 202 | $skip = array(); |
| 203 | 203 | } |
| 204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | foreach ($Folder->messages() as $message) { |
| 215 | - $this->out(String::wrap(' * ' . $message), 1, Shell::VERBOSE); |
|
| 215 | + $this->out(String::wrap(' * '.$message), 1, Shell::VERBOSE); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | return true; |
@@ -234,11 +234,11 @@ discard block |
||
| 234 | 234 | * @return boolean success |
| 235 | 235 | */ |
| 236 | 236 | public function consolePath($path) { |
| 237 | - $File = new File($path . 'Console' . DS . 'cake.php'); |
|
| 237 | + $File = new File($path.'Console'.DS.'cake.php'); |
|
| 238 | 238 | $contents = $File->read(); |
| 239 | 239 | if (preg_match('/(__CAKE_PATH__)/', $contents, $match)) { |
| 240 | 240 | $root = strpos(CAKE_CORE_INCLUDE_PATH, '/') === 0 ? " \$ds . '" : "'"; |
| 241 | - $replacement = $root . str_replace(DS, "' . \$ds . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "'"; |
|
| 241 | + $replacement = $root.str_replace(DS, "' . \$ds . '", trim(CAKE_CORE_INCLUDE_PATH, DS))."'"; |
|
| 242 | 242 | $result = str_replace($match[0], $replacement, $contents); |
| 243 | 243 | if ($File->write($result)) { |
| 244 | 244 | return true; |
@@ -255,11 +255,11 @@ discard block |
||
| 255 | 255 | * @return boolean Success |
| 256 | 256 | */ |
| 257 | 257 | public function securitySalt($path) { |
| 258 | - $File = new File($path . 'Config' . DS . 'core.php'); |
|
| 258 | + $File = new File($path.'Config'.DS.'core.php'); |
|
| 259 | 259 | $contents = $File->read(); |
| 260 | 260 | if (preg_match('/([\s]*Configure::write\(\'Security.salt\',[\s\'A-z0-9]*\);)/', $contents, $match)) { |
| 261 | 261 | $string = Security::generateAuthKey(); |
| 262 | - $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \'' . $string . '\');', $contents); |
|
| 262 | + $result = str_replace($match[0], "\t".'Configure::write(\'Security.salt\', \''.$string.'\');', $contents); |
|
| 263 | 263 | if ($File->write($result)) { |
| 264 | 264 | return true; |
| 265 | 265 | } |
@@ -275,12 +275,12 @@ discard block |
||
| 275 | 275 | * @return boolean Success |
| 276 | 276 | */ |
| 277 | 277 | public function securityCipherSeed($path) { |
| 278 | - $File = new File($path . 'Config' . DS . 'core.php'); |
|
| 278 | + $File = new File($path.'Config'.DS.'core.php'); |
|
| 279 | 279 | $contents = $File->read(); |
| 280 | 280 | if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) { |
| 281 | 281 | App::uses('Security', 'Utility'); |
| 282 | 282 | $string = substr(bin2hex(Security::generateAuthKey()), 0, 30); |
| 283 | - $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \'' . $string . '\');', $contents); |
|
| 283 | + $result = str_replace($match[0], "\t".'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents); |
|
| 284 | 284 | if ($File->write($result)) { |
| 285 | 285 | return true; |
| 286 | 286 | } |
@@ -297,10 +297,10 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | public function cachePrefix($dir) { |
| 299 | 299 | $app = basename($dir); |
| 300 | - $File = new File($dir . 'Config' . DS . 'core.php'); |
|
| 300 | + $File = new File($dir.'Config'.DS.'core.php'); |
|
| 301 | 301 | $contents = $File->read(); |
| 302 | 302 | if (preg_match('/(\$prefix = \'myapp_\';)/', $contents, $match)) { |
| 303 | - $result = str_replace($match[0], '$prefix = \'' . $app . '_\';', $contents); |
|
| 303 | + $result = str_replace($match[0], '$prefix = \''.$app.'_\';', $contents); |
|
| 304 | 304 | return $File->write($result); |
| 305 | 305 | } |
| 306 | 306 | return false; |
@@ -315,12 +315,12 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | public function corePath($path, $hardCode = true) { |
| 317 | 317 | if (dirname($path) !== CAKE_CORE_INCLUDE_PATH) { |
| 318 | - $filename = $path . 'webroot' . DS . 'index.php'; |
|
| 319 | - if (!$this->_replaceCorePath($filename, $hardCode)) { |
|
| 318 | + $filename = $path.'webroot'.DS.'index.php'; |
|
| 319 | + if ( ! $this->_replaceCorePath($filename, $hardCode)) { |
|
| 320 | 320 | return false; |
| 321 | 321 | } |
| 322 | - $filename = $path . 'webroot' . DS . 'test.php'; |
|
| 323 | - if (!$this->_replaceCorePath($filename, $hardCode)) { |
|
| 322 | + $filename = $path.'webroot'.DS.'test.php'; |
|
| 323 | + if ( ! $this->_replaceCorePath($filename, $hardCode)) { |
|
| 324 | 324 | return false; |
| 325 | 325 | } |
| 326 | 326 | return true; |
@@ -338,16 +338,16 @@ discard block |
||
| 338 | 338 | $contents = file_get_contents($filename); |
| 339 | 339 | |
| 340 | 340 | $root = strpos(CAKE_CORE_INCLUDE_PATH, '/') === 0 ? " DS . '" : "'"; |
| 341 | - $corePath = $root . str_replace(DS, "' . DS . '", trim(CAKE_CORE_INCLUDE_PATH, DS)) . "'"; |
|
| 341 | + $corePath = $root.str_replace(DS, "' . DS . '", trim(CAKE_CORE_INCLUDE_PATH, DS))."'"; |
|
| 342 | 342 | |
| 343 | 343 | $result = str_replace('__CAKE_PATH__', $corePath, $contents, $count); |
| 344 | 344 | if ($hardCode) { |
| 345 | 345 | $result = str_replace('//define(\'CAKE_CORE', 'define(\'CAKE_CORE', $result); |
| 346 | 346 | } |
| 347 | - if (!file_put_contents($filename, $result)) { |
|
| 347 | + if ( ! file_put_contents($filename, $result)) { |
|
| 348 | 348 | return false; |
| 349 | 349 | } |
| 350 | - return (bool)$count; |
|
| 350 | + return (bool) $count; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /** |
@@ -357,11 +357,11 @@ discard block |
||
| 357 | 357 | * @return boolean Success |
| 358 | 358 | */ |
| 359 | 359 | public function cakeAdmin($name) { |
| 360 | - $path = (empty($this->configPath)) ? APP . 'Config' . DS : $this->configPath; |
|
| 361 | - $File = new File($path . 'core.php'); |
|
| 360 | + $path = (empty($this->configPath)) ? APP.'Config'.DS : $this->configPath; |
|
| 361 | + $File = new File($path.'core.php'); |
|
| 362 | 362 | $contents = $File->read(); |
| 363 | 363 | if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) { |
| 364 | - $result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\'' . $name . '\'));', $contents); |
|
| 364 | + $result = str_replace($match[0], "\n".'Configure::write(\'Routing.prefixes\', array(\''.$name.'\'));', $contents); |
|
| 365 | 365 | if ($File->write($result)) { |
| 366 | 366 | Configure::write('Routing.prefixes', array($name)); |
| 367 | 367 | return true; |
@@ -378,9 +378,9 @@ discard block |
||
| 378 | 378 | public function getPrefix() { |
| 379 | 379 | $admin = ''; |
| 380 | 380 | $prefixes = Configure::read('Routing.prefixes'); |
| 381 | - if (!empty($prefixes)) { |
|
| 381 | + if ( ! empty($prefixes)) { |
|
| 382 | 382 | if (count($prefixes) === 1) { |
| 383 | - return $prefixes[0] . '_'; |
|
| 383 | + return $prefixes[0].'_'; |
|
| 384 | 384 | } |
| 385 | 385 | if ($this->interactive) { |
| 386 | 386 | $this->out(); |
@@ -390,11 +390,11 @@ discard block |
||
| 390 | 390 | foreach ($prefixes as $i => $prefix) { |
| 391 | 391 | $options[] = $i + 1; |
| 392 | 392 | if ($this->interactive) { |
| 393 | - $this->out($i + 1 . '. ' . $prefix); |
|
| 393 | + $this->out($i + 1.'. '.$prefix); |
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | $selection = $this->in(__d('cake_console', 'Please choose a prefix to bake with.'), $options, 1); |
| 397 | - return $prefixes[$selection - 1] . '_'; |
|
| 397 | + return $prefixes[$selection - 1].'_'; |
|
| 398 | 398 | } |
| 399 | 399 | if ($this->interactive) { |
| 400 | 400 | $this->hr(); |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | '/app/Config/core.php')); |
| 404 | 404 | $this->out(__d('cake_console', 'What would you like the prefix route to be?')); |
| 405 | 405 | $this->out(__d('cake_console', 'Example: %s', 'www.example.com/admin/controller')); |
| 406 | - while (!$admin) { |
|
| 406 | + while ( ! $admin) { |
|
| 407 | 407 | $admin = $this->in(__d('cake_console', 'Enter a routing prefix:'), null, 'admin'); |
| 408 | 408 | } |
| 409 | 409 | if ($this->cakeAdmin($admin) !== true) { |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | '/app/Config/core.php')); |
| 414 | 414 | return $this->_stop(); |
| 415 | 415 | } |
| 416 | - return $admin . '_'; |
|
| 416 | + return $admin.'_'; |
|
| 417 | 417 | } |
| 418 | 418 | return ''; |
| 419 | 419 | } |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | 'short' => 't', |
| 437 | 437 | 'help' => __d('cake_console', 'Theme to use when baking code.') |
| 438 | 438 | ))->addOption('skel', array( |
| 439 | - 'default' => current(App::core('Console')) . 'Templates' . DS . 'skel', |
|
| 439 | + 'default' => current(App::core('Console')).'Templates'.DS.'skel', |
|
| 440 | 440 | 'help' => __d('cake_console', 'The directory layout to use for the new application skeleton. Defaults to cake/Console/Templates/skel of CakePHP used to create the project.') |
| 441 | 441 | )); |
| 442 | 442 | } |
@@ -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)) { |
@@ -63,14 +63,14 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | $plugins = App::objects('plugin'); |
| 65 | 65 | foreach ($plugins as $plugin) { |
| 66 | - $paths[] = $this->_pluginPath($plugin) . 'Console' . DS; |
|
| 66 | + $paths[] = $this->_pluginPath($plugin).'Console'.DS; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $core = current(App::core('Console')); |
| 70 | 70 | $separator = DS === '/' ? '/' : '\\\\'; |
| 71 | - $core = preg_replace('#shells' . $separator . '$#', '', $core); |
|
| 71 | + $core = preg_replace('#shells'.$separator.'$#', '', $core); |
|
| 72 | 72 | |
| 73 | - $Folder = new Folder($core . 'Templates' . DS . 'default'); |
|
| 73 | + $Folder = new Folder($core.'Templates'.DS.'default'); |
|
| 74 | 74 | |
| 75 | 75 | $contents = $Folder->read(); |
| 76 | 76 | $themeFolders = $contents[0]; |
@@ -78,23 +78,23 @@ discard block |
||
| 78 | 78 | $paths[] = $core; |
| 79 | 79 | |
| 80 | 80 | foreach ($paths as $i => $path) { |
| 81 | - $paths[$i] = rtrim($path, DS) . DS; |
|
| 81 | + $paths[$i] = rtrim($path, DS).DS; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $themes = array(); |
| 85 | 85 | foreach ($paths as $path) { |
| 86 | - $Folder = new Folder($path . 'Templates', false); |
|
| 86 | + $Folder = new Folder($path.'Templates', false); |
|
| 87 | 87 | $contents = $Folder->read(); |
| 88 | 88 | $subDirs = $contents[0]; |
| 89 | 89 | foreach ($subDirs as $dir) { |
| 90 | 90 | if (empty($dir) || preg_match('@^skel$|_skel$@', $dir)) { |
| 91 | 91 | continue; |
| 92 | 92 | } |
| 93 | - $Folder = new Folder($path . 'Templates' . DS . $dir); |
|
| 93 | + $Folder = new Folder($path.'Templates'.DS.$dir); |
|
| 94 | 94 | $contents = $Folder->read(); |
| 95 | 95 | $subDirs = $contents[0]; |
| 96 | 96 | if (array_intersect($contents[0], $themeFolders)) { |
| 97 | - $templateDir = $path . 'Templates' . DS . $dir . DS; |
|
| 97 | + $templateDir = $path.'Templates'.DS.$dir.DS; |
|
| 98 | 98 | $themes[$dir] = $templateDir; |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $data = array($one => $two); |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if (!$data) { |
|
| 124 | + if ( ! $data) { |
|
| 125 | 125 | return false; |
| 126 | 126 | } |
| 127 | 127 | $this->templateVars = $data + $this->templateVars; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $paths = array_values($this->templatePaths); |
| 169 | 169 | return $paths[0]; |
| 170 | 170 | } |
| 171 | - if (!empty($this->params['theme']) && isset($this->templatePaths[$this->params['theme']])) { |
|
| 171 | + if ( ! empty($this->params['theme']) && isset($this->templatePaths[$this->params['theme']])) { |
|
| 172 | 172 | return $this->templatePaths[$this->params['theme']]; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $i = 1; |
| 181 | 181 | $indexedPaths = array(); |
| 182 | 182 | foreach ($this->templatePaths as $key => $path) { |
| 183 | - $this->out($i . '. ' . $key); |
|
| 183 | + $this->out($i.'. '.$key); |
|
| 184 | 184 | $indexedPaths[$i] = $path; |
| 185 | 185 | $i++; |
| 186 | 186 | } |
@@ -200,12 +200,12 @@ discard block |
||
| 200 | 200 | * @return string filename will exit program if template is not found. |
| 201 | 201 | */ |
| 202 | 202 | protected function _findTemplate($path, $directory, $filename) { |
| 203 | - $themeFile = $path . $directory . DS . $filename . '.ctp'; |
|
| 203 | + $themeFile = $path.$directory.DS.$filename.'.ctp'; |
|
| 204 | 204 | if (file_exists($themeFile)) { |
| 205 | 205 | return $themeFile; |
| 206 | 206 | } |
| 207 | 207 | foreach ($this->templatePaths as $path) { |
| 208 | - $templatePath = $path . $directory . DS . $filename . '.ctp'; |
|
| 208 | + $templatePath = $path.$directory.DS.$filename.'.ctp'; |
|
| 209 | 209 | if (file_exists($templatePath)) { |
| 210 | 210 | return $templatePath; |
| 211 | 211 | } |