Fix most of the coding standards issues in Console/

This commit is contained in:
mark_story 2012-03-03 18:55:07 -05:00
parent 2a7bee0a5c
commit db8c6b5c78
36 changed files with 146 additions and 158 deletions

View file

@ -200,7 +200,7 @@ class AclShell extends AppShell {
}
$this->out(__d('cake_console', 'Path:'));
$this->hr();
for ($i = 0; $i < count($nodes); $i++) {
for ($i = 0, $len = count($nodes); $i < $len; $i++) {
$this->_outputNode($class, $nodes[$i], $i);
}
}
@ -218,7 +218,7 @@ class AclShell extends AppShell {
$data = $node[$class];
if ($data['alias']) {
$this->out($indent . "[" . $data['id'] . "] " . $data['alias']);
} else {
} else {
$this->out($indent . "[" . $data['id'] . "] " . $data['model'] . '.' . $data['foreign_key']);
}
}
@ -366,8 +366,9 @@ class AclShell extends AppShell {
'help' => __d('cake_console', 'Type of node to create.')
);
$parser->description(__d('cake_console', 'A console tool for managing the DbAcl'))
->addSubcommand('create', array(
$parser->description(
__d('cake_console', 'A console tool for managing the DbAcl')
)->addSubcommand('create', array(
'help' => __d('cake_console', 'Create a new ACL node'),
'parser' => array(
'description' => __d('cake_console', 'Creates a new ACL object <node> under the parent'),
@ -514,8 +515,9 @@ class AclShell extends AppShell {
if (!isset($this->args[0]) || !isset($this->args[1])) {
return false;
}
extract($this->_dataVars($this->args[0]));
$key = is_numeric($this->args[1]) ? $secondary_id : 'alias';
$dataVars = $this->_dataVars($this->args[0]);
extract($dataVars);
$key = is_numeric($this->args[1]) ? $dataVars['secondary_id'] : 'alias';
$conditions = array($class . '.' . $key => $this->args[1]);
$possibility = $this->Acl->{$class}->find('all', compact('conditions'));
if (empty($possibility)) {
@ -602,4 +604,5 @@ class AclShell extends AppShell {
$vars['class'] = $class;
return $vars;
}
}

View file

@ -92,7 +92,7 @@ class ApiShell extends AppShell {
$this->error(__d('cake_console', '%s not found', $class));
}
$parsed = $this->_parseClass($path . $class .'.php', $class);
$parsed = $this->_parseClass($path . $class . '.php', $class);
if (!empty($parsed)) {
if (isset($this->params['method'])) {
@ -166,14 +166,14 @@ class ApiShell extends AppShell {
$commands = array(
'path' => "\t<type>\n" .
"\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n".
"\t\tAvailable values:\n\n".
"\t\tbehavior\tLook for class in CakePHP behavior path\n".
"\t\tcache\tLook for class in CakePHP cache path\n".
"\t\tcontroller\tLook for class in CakePHP controller path\n".
"\t\tcomponent\tLook for class in CakePHP component path\n".
"\t\thelper\tLook for class in CakePHP helper path\n".
"\t\tmodel\tLook for class in CakePHP model path\n".
"\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n" .
"\t\tAvailable values:\n\n" .
"\t\tbehavior\tLook for class in CakePHP behavior path\n" .
"\t\tcache\tLook for class in CakePHP cache path\n" .
"\t\tcontroller\tLook for class in CakePHP controller path\n" .
"\t\tcomponent\tLook for class in CakePHP component path\n" .
"\t\thelper\tLook for class in CakePHP helper path\n" .
"\t\tmodel\tLook for class in CakePHP model path\n" .
"\t\tview\tLook for class in CakePHP view path\n",
'className' => "\t<className>\n" .
"\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n"
@ -203,7 +203,7 @@ class ApiShell extends AppShell {
$parsed = array();
if (!class_exists($class)) {
if (!include_once($path)) {
if (!include_once $path) {
$this->err(__d('cake_console', '%s could not be found', $path));
}
}
@ -234,4 +234,5 @@ class ApiShell extends AppShell {
ksort($parsed);
return $parsed;
}
}

View file

@ -209,9 +209,9 @@ class BakeShell extends AppShell {
public function getOptionParser() {
$parser = parent::getOptionParser();
return $parser->description(__d('cake_console',
'The Bake script generates controllers, views and models for your application.'
. ' If run with no command line arguments, Bake guides the user through the class creation process.'
. ' You can customize the generation process by telling Bake where different parts of your application are using command line arguments.'
'The Bake script generates controllers, views and models for your application.' .
' If run with no command line arguments, Bake guides the user through the class creation process.' .
' You can customize the generation process by telling Bake where different parts of your application are using command line arguments.'
))->addSubcommand('all', array(
'help' => __d('cake_console', 'Bake a complete MVC. optional <name> of a Model'),
))->addSubcommand('project', array(

View file

@ -1,9 +1,5 @@
<?php
/**
* Command list Shell
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@ -46,7 +42,7 @@ class CommandListShell extends AppShell {
public function main() {
if (empty($this->params['xml'])) {
$this->out(__d('cake_console', "<info>Current Paths:</info>"), 2);
$this->out(" -app: ". APP_DIR);
$this->out(" -app: " . APP_DIR);
$this->out(" -working: " . rtrim(APP, DS));
$this->out(" -root: " . rtrim(ROOT, DS));
$this->out(" -core: " . rtrim(CORE_PATH, DS));
@ -234,4 +230,5 @@ class CommandListShell extends AppShell {
'boolean' => true
));
}
}

View file

@ -1,9 +1,5 @@
<?php
/**
* CakePHP Console Shell
*
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
@ -343,7 +339,7 @@ class ConsoleShell extends AppShell {
Router::reload();
extract(Router::getNamedExpressions());
if (!@include(APP . 'Config' . DS . 'routes.php')) {
if (!@include APP . 'Config' . DS . 'routes.php') {
return false;
}
CakePlugin::routes();
@ -359,4 +355,5 @@ class ConsoleShell extends AppShell {
}
return true;
}
}

View file

@ -117,4 +117,5 @@ class I18nShell extends AppShell {
'parser' => $this->Extract->getOptionParser()
));
}
}

View file

@ -58,7 +58,7 @@ class SchemaShell extends AppShell {
$this->_welcome();
$this->out('Cake Schema Shell');
$this->hr();
$name = $path = $connection = $plugin = null;
if (!empty($this->params['name'])) {
$name = $this->params['name'];
@ -168,7 +168,7 @@ class SchemaShell extends AppShell {
$count = 0;
if (!empty($result[1])) {
foreach ($result[1] as $file) {
if (preg_match('/'.preg_quote($fileName).'(?:[_\d]*)?\.php$/', $file)) {
if (preg_match('/' . preg_quote($fileName) . '(?:[_\d]*)?\.php$/', $file)) {
$count++;
}
}
@ -216,7 +216,7 @@ class SchemaShell extends AppShell {
}
}
$db = ConnectionManager::getDataSource($this->Schema->connection);
$contents = "\n\n" . $db->dropSchema($Schema) . "\n\n". $db->createSchema($Schema);
$contents = "\n\n" . $db->dropSchema($Schema) . "\n\n" . $db->createSchema($Schema);
if ($write) {
if (strpos($write, '.sql') === false) {
@ -419,7 +419,7 @@ class SchemaShell extends AppShell {
try {
$db->execute($sql);
} catch (PDOException $e) {
$error = $table . ': ' . $e->getMessage();
$error = $table . ': ' . $e->getMessage();
}
$Schema->after(array($event => $table, 'errors' => $error));
@ -529,4 +529,5 @@ class SchemaShell extends AppShell {
));
return $parser;
}
}

View file

@ -145,17 +145,16 @@ class ControllerTask extends BakeTask {
$useDynamicScaffold = 'n';
$wannaBakeCrud = 'y';
$question[] = __d('cake_console', "Would you like to build your controller interactively?");
if (file_exists($this->path . $controllerName .'Controller.php')) {
if (file_exists($this->path . $controllerName . 'Controller.php')) {
$question[] = __d('cake_console', "Warning: Choosing no will overwrite the %sController.", $controllerName);
}
$doItInteractive = $this->in(implode("\n", $question), array('y','n'), 'y');
$doItInteractive = $this->in(implode("\n", $question), array('y', 'n'), 'y');
if (strtolower($doItInteractive) == 'y') {
$this->interactive = true;
$useDynamicScaffold = $this->in(
__d('cake_console', "Would you like to use dynamic scaffolding?"), array('y','n'), 'n'
__d('cake_console', "Would you like to use dynamic scaffolding?"), array('y', 'n'), 'n'
);
if (strtolower($useDynamicScaffold) == 'y') {
@ -233,7 +232,7 @@ class ControllerTask extends BakeTask {
$output = '';
$length = count($$var);
foreach ($$var as $i => $propElement) {
if ($i != $length -1) {
if ($i != $length - 1) {
$output .= ucfirst($propElement) . ', ';
} else {
$output .= ucfirst($propElement);
@ -468,48 +467,4 @@ class ControllerTask extends BakeTask {
))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.'));
}
/**
* Displays help contents
*
* @return void
*/
public function help() {
$this->hr();
$this->out("Usage: cake bake controller <arg1> <arg2>...");
$this->hr();
$this->out('Arguments:');
$this->out();
$this->out("<name>");
$this->out("\tName of the controller to bake. Can use Plugin.name");
$this->out("\tas a shortcut for plugin baking.");
$this->out();
$this->out('Params:');
$this->out();
$this->out('-connection <config>');
$this->out("\tset db config <config>. uses 'default' if none is specified");
$this->out();
$this->out('Commands:');
$this->out();
$this->out("controller <name>");
$this->out("\tbakes controller with var \$scaffold");
$this->out();
$this->out("controller <name> public");
$this->out("\tbakes controller with basic crud actions");
$this->out("\t(index, view, add, edit, delete)");
$this->out();
$this->out("controller <name> admin");
$this->out("\tbakes a controller with basic crud actions for one of the");
$this->out("\tConfigure::read('Routing.prefixes') methods.");
$this->out();
$this->out("controller <name> public admin");
$this->out("\tbakes a controller with basic crud actions for one");
$this->out("\tConfigure::read('Routing.prefixes') and non admin methods.");
$this->out("\t(index, view, add, edit, delete,");
$this->out("\tadmin_index, admin_view, admin_edit, admin_add, admin_delete)");
$this->out();
$this->out("controller all");
$this->out("\tbakes all controllers with CRUD methods.");
$this->out();
$this->_stop();
}
}

View file

@ -364,7 +364,7 @@ class DbConfigTask extends AppShell {
$connections = array_keys($configs);
if (count($connections) > 1) {
$useDbConfig = $this->in(__d('cake_console', 'Use Database Config') .':', $connections, $useDbConfig);
$useDbConfig = $this->in(__d('cake_console', 'Use Database Config') . ':', $connections, $useDbConfig);
}
return $useDbConfig;
}
@ -380,4 +380,5 @@ class DbConfigTask extends AppShell {
__d('cake_console', 'Bake new database configuration settings.')
);
}
}

View file

@ -584,8 +584,10 @@ class ExtractTask extends AppShell {
*/
protected function _getStrings(&$position, $target) {
$strings = array();
while (count($strings) < $target && ($this->_tokens[$position] == ',' || $this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING)) {
if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING && $this->_tokens[$position+1] == '.') {
$count = count($strings);
while ($count < $target && ($this->_tokens[$position] == ',' || $this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING)) {
$count = count($strings);
if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING && $this->_tokens[$position + 1] == '.') {
$string = '';
while ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING || $this->_tokens[$position] == '.') {
if ($this->_tokens[$position][0] == T_CONSTANT_ENCAPSED_STRING) {
@ -668,7 +670,7 @@ class ExtractTask extends AppShell {
}
$exclude[] = preg_quote($e, '/');
}
$pattern = '/' . implode('|', $exclude) . '/';
$pattern = '/' . implode('|', $exclude) . '/';
}
foreach ($this->_paths as $path) {
$Folder = new Folder($path);
@ -694,4 +696,5 @@ class ExtractTask extends AppShell {
protected function _isExtractingApp() {
return $this->_paths === array(APP);
}
}

View file

@ -86,7 +86,7 @@ class FixtureTask extends BakeTask {
'help' => __d('cake_console', 'Used with --count and <name>/all commands to pull [n] records from the live tables, where [n] is either --count or the default of 10'),
'short' => 'r',
'boolean' => true
))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.'));;
))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.'));
}
/**
@ -388,7 +388,7 @@ class FixtureTask extends BakeTask {
$condition = $this->in($prompt, null, 'WHERE 1=1');
}
$prompt = __d('cake_console', "How many records do you want to import?");
$recordCount = $this->in($prompt, null, 10);
$recordCount = $this->in($prompt, null, 10);
} else {
$condition = 'WHERE 1=1';
$recordCount = (isset($this->params['count']) ? $this->params['count'] : 10);

View file

@ -170,7 +170,7 @@ class ModelTask extends BakeTask {
$max = count($options);
while (!$valid) {
foreach ($options as $i => $option) {
$this->out($i + 1 .'. ' . $option);
$this->out($i + 1 . '. ' . $option);
}
if (empty($prompt)) {
$prompt = __d('cake_console', 'Make a selection from the choices above');
@ -297,7 +297,7 @@ class ModelTask extends BakeTask {
*/
protected function _printAssociation($modelName, $type, $associations) {
if (!empty($associations[$type])) {
for ($i = 0; $i < count($associations[$type]); $i++) {
for ($i = 0, $len = count($associations[$type]); $i < $len; $i++) {
$out = "\t" . $modelName . ' ' . $type . ' ' . $associations[$type][$i]['alias'];
$this->out($out);
}
@ -414,7 +414,7 @@ class ModelTask extends BakeTask {
for ($i = 1; $i < $defaultChoice; $i++) {
$prompt .= $i . ' - ' . $this->_validations[$i] . "\n";
}
$prompt .= __d('cake_console', "%s - Do not do any validation on this field.\n", $defaultChoice);
$prompt .= __d('cake_console', "%s - Do not do any validation on this field.\n", $defaultChoice);
$prompt .= __d('cake_console', "... or enter in a valid regex validation string.\n");
$methods = array_flip($this->_validations);
@ -498,11 +498,14 @@ class ModelTask extends BakeTask {
}
if (empty($this->_tables)) {
$this->_tables = (array) $this->getAllTables();
$this->_tables = (array)$this->getAllTables();
}
$associations = array(
'belongsTo' => array(), 'hasMany' => array(), 'hasOne' => array(), 'hasAndBelongsToMany' => array()
'belongsTo' => array(),
'hasMany' => array(),
'hasOne' => array(),
'hasAndBelongsToMany' => array()
);
$associations = $this->findBelongsTo($model, $associations);
@ -780,13 +783,19 @@ class ModelTask extends BakeTask {
} else {
$data['name'] = $name;
}
$defaults = array('associations' => array(), 'validate' => array(), 'primaryKey' => 'id',
'useTable' => null, 'useDbConfig' => 'default', 'displayField' => null);
$defaults = array(
'associations' => array(),
'validate' => array(),
'primaryKey' => 'id',
'useTable' => null,
'useDbConfig' => 'default',
'displayField' => null
);
$data = array_merge($defaults, $data);
$pluginPath = '';
if ($this->plugin) {
$pluginPath = $this->plugin . '.';
$pluginPath = $this->plugin . '.';
}
$this->Template->set($data);
@ -824,7 +833,7 @@ class ModelTask extends BakeTask {
* @return array
*/
public function listAll($useDbConfig = null) {
$this->_tables = (array) $this->getAllTables($useDbConfig);
$this->_tables = (array)$this->getAllTables($useDbConfig);
$this->_modelNames = array();
$count = count($this->_tables);
@ -926,7 +935,7 @@ class ModelTask extends BakeTask {
}
if ($enteredModel == '' || intval($enteredModel) > count($this->_modelNames)) {
$this->err(__d('cake_console', "The model name you supplied was empty,\n" .
$this->err(__d('cake_console', "The model name you supplied was empty,\n" .
"or the number you selected was not an option. Please try again."));
$enteredModel = '';
}
@ -975,4 +984,5 @@ class ModelTask extends BakeTask {
$this->Fixture->plugin = $this->plugin;
$this->Fixture->bake($className, $useTable);
}
}

View file

@ -135,7 +135,7 @@ class PluginTask extends AppShell {
$out = "<?php\n\n";
$out .= "class {$plugin}AppController extends AppController {\n\n";
$out .= "}\n\n";
$this->createFile($this->path . $plugin. DS . 'Controller' . DS . $controllerFileName, $out);
$this->createFile($this->path . $plugin . DS . 'Controller' . DS . $controllerFileName, $out);
$modelFileName = $plugin . 'AppModel.php';
@ -167,7 +167,7 @@ class PluginTask extends AppShell {
$max = count($pathOptions);
while (!$valid) {
foreach ($pathOptions as $i => $option) {
$this->out($i + 1 .'. ' . $option);
$this->out($i + 1 . '. ' . $option);
}
$prompt = __d('cake_console', 'Choose a plugin path from the paths above.');
$choice = $this->in($prompt);
@ -191,7 +191,6 @@ class PluginTask extends AppShell {
))->addArgument('name', array(
'help' => __d('cake_console', 'CamelCased name of the plugin to create.')
));
}
}

View file

@ -54,7 +54,6 @@ class ProjectTask extends AppShell {
$project = $this->in($prompt, null, APP . 'myapp');
}
if ($project && !Folder::isAbsolute($project) && isset($_SERVER['PWD'])) {
$project = $_SERVER['PWD'] . DS . $project;
}
@ -112,7 +111,7 @@ class ProjectTask extends AppShell {
$this->out(__d('cake_console', ' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/index.php', CAKE_CORE_INCLUDE_PATH));
$this->out(__d('cake_console', ' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/test.php', CAKE_CORE_INCLUDE_PATH));
} else {
$this->err(__d('cake_console', 'Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path . 'webroot' .DS .'index.php'));
$this->err(__d('cake_console', 'Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path . 'webroot' . DS .'index.php'));
$success = false;
}
if ($success && $hardCode) {
@ -231,8 +230,8 @@ class ProjectTask extends AppShell {
$app = basename($dir);
$path = $dir . 'View' . DS . 'Pages' . DS;
$source = CAKE . 'Console' . DS . 'Templates' . DS .'default' . DS . 'views' . DS . 'home.ctp';
include($source);
return $this->createFile($path.'home.ctp', $output);
include $source;
return $this->createFile($path . 'home.ctp', $output);
}
/**
@ -282,7 +281,7 @@ class ProjectTask extends AppShell {
*
* @param string $path Project path
* @return boolean Success
*/
*/
public function securityCipherSeed($path) {
$File = new File($path . 'Config' . DS . 'core.php');
$contents = $File->read();

View file

@ -74,7 +74,7 @@ class TemplateTask extends AppShell {
foreach ($plugins as $plugin) {
$paths[] = $this->_pluginPath($plugin) . 'Console' . DS;
}
$paths = array_merge($paths, App::path('Console'));
// TEMPORARY TODO remove when all paths are DS terminated
@ -149,7 +149,7 @@ class TemplateTask extends AppShell {
extract($this->templateVars);
ob_start();
ob_implicit_flush(0);
include($templateFile);
include $templateFile;
$content = ob_get_clean();
return $content;
}
@ -214,4 +214,5 @@ class TemplateTask extends AppShell {
$this->err(__d('cake_console', 'Could not find template for %s', $filename));
return false;
}
}

View file

@ -46,7 +46,7 @@ class TestTask extends BakeTask {
*
* @var array
*/
public $classTypes = array(
public $classTypes = array(
'Model' => 'Model',
'Controller' => 'Controller',
'Component' => 'Controller/Component',
@ -276,9 +276,9 @@ class TestTask extends BakeTask {
if (strtolower($type) == 'model' || empty($this->classTypes[$type])) {
return $class;
}
$position = strpos($class, $type);
if ($position !== false && strlen($class) - $position == strlen($type)) {
return $class;
}
@ -291,6 +291,7 @@ class TestTask extends BakeTask {
* @param string $type The type of thing having a test generated.
* @param string $plugin The plugin name.
* @return string
* @throws CakeException When invalid object types are requested.
*/
public function mapType($type, $plugin) {
$type = ucfirst($type);
@ -397,8 +398,8 @@ class TestTask extends BakeTask {
protected function _addFixture($name) {
$parent = get_parent_class($name);
$prefix = 'app.';
if (strtolower($parent) != 'appmodel' && strtolower(substr($parent, -8)) == 'appmodel') {
$pluginName = substr($parent, 0, strlen($parent) -8);
if (strtolower($parent) != 'appmodel' && strtolower(substr($parent, - 8)) == 'appmodel') {
$pluginName = substr($parent, 0, strlen($parent) - 8);
$prefix = 'plugin.' . Inflector::underscore($pluginName) . '.';
}
$fixture = $prefix . Inflector::underscore($name);
@ -530,4 +531,5 @@ class TestTask extends BakeTask {
'help' => __d('cake_console', 'CamelCased name of the plugin to bake tests for.')
))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.'));
}
}

View file

@ -133,7 +133,7 @@ class ViewTask extends BakeTask {
* @return array Array of action names that should be baked
*/
protected function _methodsToBake() {
$methods = array_diff(
$methods = array_diff(
array_map('strtolower', get_class_methods($this->controllerName . 'Controller')),
array_map('strtolower', get_class_methods('AppController'))
);
@ -459,9 +459,10 @@ class ViewTask extends BakeTask {
$associations[$type][$assocKey]['displayField'] = $model->{$assocKey}->displayField;
$associations[$type][$assocKey]['foreignKey'] = $assocData['foreignKey'];
$associations[$type][$assocKey]['controller'] = Inflector::pluralize(Inflector::underscore($modelClass));
$associations[$type][$assocKey]['fields'] = array_keys($model->{$assocKey}->schema(true));
$associations[$type][$assocKey]['fields'] = array_keys($model->{$assocKey}->schema(true));
}
}
return $associations;
}
}

View file

@ -192,7 +192,6 @@ class TestShell extends Shell {
'output' => 'text',
);
if (strpos($this->args[0], '.php')) {
$category = $this->_mapFileToCategory($this->args[0]);
$params['case'] = $this->_mapFileToCase($this->args[0], $category);
@ -312,7 +311,7 @@ class TestShell extends Shell {
}
while ($choice = $this->in(__d('cake_console', 'What test case would you like to run?'), null, 'q')) {
if (is_numeric($choice) && isset($cases[$choice])) {
if (is_numeric($choice) && isset($cases[$choice])) {
$this->args[0] = $category;
$this->args[1] = $cases[$choice];
$this->_run($this->_parseArgs(), $this->_runnerOptions());
@ -385,7 +384,7 @@ class TestShell extends Shell {
if (!file_exists($testFile) && $throwOnMissingFile) {
throw new Exception(__d('cake_dev', 'Test case %s not found', $testFile));
}
return $testCase;
}
@ -431,4 +430,5 @@ class TestShell extends Shell {
}
return 'app';
}
}

View file

@ -207,4 +207,5 @@ class TestsuiteShell extends TestShell {
$this->_run($args, $this->_runnerOptions());
}
}

View file

@ -169,7 +169,7 @@ class UpgradeShell extends AppShell {
}
}
}
$this->_moveViewFiles();
$this->_moveAppClasses();
@ -234,7 +234,7 @@ class UpgradeShell extends AppShell {
$helpers = array_merge($pluginHelpers, $helpers);
foreach ($helpers as $helper) {
$helper = preg_replace('/Helper$/', '', $helper);
$oldHelper = strtolower(substr($helper, 0, 1)).substr($helper, 1);
$oldHelper = strtolower(substr($helper, 0, 1)) . substr($helper, 1);
$patterns[] = array(
"\${$oldHelper} to \$this->{$helper}",
"/\\\${$oldHelper}->/",
@ -355,7 +355,7 @@ class UpgradeShell extends AppShell {
$pluginPath = App::pluginPath($this->params['plugin']);
$this->_paths = array(
$pluginPath . 'controllers' . DS,
$pluginPath . 'controllers' . DS . 'components' .DS,
$pluginPath . 'controllers' . DS . 'components' . DS,
$pluginPath . 'views' . DS,
);
}
@ -536,7 +536,7 @@ class UpgradeShell extends AppShell {
$pluginPath = App::pluginPath($this->params['plugin']);
$this->_paths = array(
$pluginPath . 'controllers' . DS,
$pluginPath . 'controllers' . DS . 'components' .DS,
$pluginPath . 'controllers' . DS . 'components' . DS,
);
}
$patterns = array(
@ -604,7 +604,7 @@ class UpgradeShell extends AppShell {
protected function _moveAppClasses() {
$files = array(
APP . 'app_controller.php' => APP . 'Controller' . DS . 'AppController.php',
APP . 'controllers' . DS .'app_controller.php' => APP . 'Controller' . DS . 'AppController.php',
APP . 'controllers' . DS . 'app_controller.php' => APP . 'Controller' . DS . 'AppController.php',
APP . 'app_model.php' => APP . 'Model' . DS . 'AppModel.php',
APP . 'models' . DS . 'app_model.php' => APP . 'Model' . DS . 'AppModel.php',
);
@ -706,7 +706,7 @@ class UpgradeShell extends AppShell {
if (!$this->params['dry-run']) {
if ($this->params['git']) {
exec('git mv -f ' . escapeshellarg($file) . ' ' . escapeshellarg($file . '__'));
exec('git mv -f ' . escapeshellarg($file. '__') . ' ' . escapeshellarg($new));
exec('git mv -f ' . escapeshellarg($file . '__') . ' ' . escapeshellarg($new));
} else {
rename($file, $new);
}
@ -854,4 +854,5 @@ class UpgradeShell extends AppShell {
'parser' => $subcommandParser
));
}
}

View file

@ -22,6 +22,7 @@
* @package Cake.Console
*/
class ConsoleInput {
/**
* Input value.
*
@ -46,4 +47,5 @@ class ConsoleInput {
public function read() {
return fgets($this->_input);
}
}
}

View file

@ -23,6 +23,7 @@
* @package Cake.Console
*/
class ConsoleInputArgument {
/**
* Name of the argument.
*
@ -125,7 +126,7 @@ class ConsoleInputArgument {
* @return boolean
*/
public function isRequired() {
return (bool) $this->_required;
return (bool)$this->_required;
}
/**
@ -165,4 +166,5 @@ class ConsoleInputArgument {
}
return $parent;
}
}

View file

@ -24,6 +24,7 @@
* @package Cake.Console
*/
class ConsoleInputOption {
/**
* Name of the option
*
@ -171,7 +172,7 @@ class ConsoleInputOption {
* @return boolean
*/
public function isBoolean() {
return (bool) $this->_boolean;
return (bool)$this->_boolean;
}
/**
@ -216,4 +217,5 @@ class ConsoleInputOption {
}
return $parent;
}
}

View file

@ -117,4 +117,5 @@ class ConsoleInputSubcommand {
$command->addAttribute('help', $this->_help);
return $parent;
}
}

View file

@ -551,6 +551,7 @@ class ConsoleOptionParser {
* @param string $option The option to parse.
* @param array $params The params to append the parsed value into
* @return array Params with $option added in.
* @throws ConsoleException When unknown short options are encountered.
*/
protected function _parseShortOption($option, $params) {
$key = substr($option, 1);
@ -597,7 +598,6 @@ class ConsoleOptionParser {
}
}
/**
* Check to see if $name has an option (short/long) defined for it.
*

View file

@ -284,4 +284,5 @@ class ConsoleOutput {
public function __destruct() {
fclose($this->_output);
}
}

View file

@ -29,6 +29,7 @@ App::uses('String', 'Utility');
* @since CakePHP(tm) v 2.0
*/
class HelpFormatter {
/**
* The maximum number of arguments shown when generating usage.
*
@ -196,4 +197,5 @@ class HelpFormatter {
}
return $string ? $xml->asXml() : $xml;
}
}

View file

@ -400,7 +400,7 @@ class Shell extends Object {
*/
protected function _displayHelp($command) {
$format = 'text';
if (!empty($this->args[0]) && $this->args[0] == 'xml') {
if (!empty($this->args[0]) && $this->args[0] == 'xml') {
$format = 'xml';
$this->stdout->outputAs(ConsoleOutput::RAW);
} else {
@ -812,4 +812,5 @@ class Shell extends Object {
}
return current(App::path('plugins')) . $pluginName . DS;
}
}

View file

@ -328,4 +328,5 @@ class ShellDispatcher {
protected function _stop($status = 0) {
exit($status);
}
}

View file

@ -24,6 +24,7 @@ App::uses('ObjectCollection', 'Utility');
* @package Cake.Console
*/
class TaskCollection extends ObjectCollection {
/**
* Shell to use to set params to tasks.
*

View file

@ -39,29 +39,29 @@ class DbAclSchema extends CakeSchema {
}
public $acos = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'model' => array('type' => 'string', 'null' => true),
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'alias' => array('type' => 'string', 'null' => true),
'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
);
public $aros = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'model' => array('type' => 'string', 'null' => true),
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'alias' => array('type' => 'string', 'null' => true),
'lft' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'rght' => array('type' => 'integer', 'null' => true, 'default' => NULL, 'length' => 10),
'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
);
public $aros_acos = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
'aro_id' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
'aco_id' => array('type' => 'integer', 'null' => false, 'length' => 10),
'_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),

View file

@ -39,13 +39,13 @@ class i18nSchema extends CakeSchema {
}
public $i18n = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),
'model' => array('type' => 'string', 'null' => false, 'key' => 'index'),
'foreign_key' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
'field' => array('type' => 'string', 'null' => false, 'key' => 'index'),
'content' => array('type' => 'text', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
);
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),
'model' => array('type' => 'string', 'null' => false, 'key' => 'index'),
'foreign_key' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
'field' => array('type' => 'string', 'null' => false, 'key' => 'index'),
'content' => array('type' => 'text', 'null' => true, 'default' => null),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
);
}

View file

@ -39,10 +39,10 @@ class SessionsSchema extends CakeSchema {
}
public $cake_sessions = array(
'id' => array('type' => 'string', 'null' => false, 'key' => 'primary'),
'data' => array('type' => 'text', 'null' => true, 'default' => NULL),
'expires' => array('type' => 'integer', 'null' => true, 'default' => NULL),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
);
'id' => array('type' => 'string', 'null' => false, 'key' => 'primary'),
'data' => array('type' => 'text', 'null' => true, 'default' => null),
'expires' => array('type' => 'integer', 'null' => true, 'default' => null),
'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
);
}

View file

@ -25,7 +25,7 @@ if (function_exists('ini_set')) {
ini_set('include_path', $root . PATH_SEPARATOR . __CAKE_PATH__ . PATH_SEPARATOR . ini_get('include_path'));
}
if (!include($dispatcher)) {
if (!include $dispatcher) {
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
}
unset($paths, $path, $dispatcher, $root, $ds);

View file

@ -55,7 +55,7 @@ class PagesController extends AppController {
if (!$count) {
$this->redirect('/');
}
$page = $subpage = $title_for_layout = null;
$page = $subpage = $title = null;
if (!empty($path[0])) {
$page = $path[0];
@ -64,9 +64,11 @@ class PagesController extends AppController {
$subpage = $path[1];
}
if (!empty($path[$count - 1])) {
$title_for_layout = Inflector::humanize($path[$count - 1]);
$title = Inflector::humanize($path[$count - 1]);
}
$this->set(compact('page', 'subpage', 'title_for_layout'));
$this->set(compact('page', 'subpage'));
$this->set('title_for_layout', $title);
$this->render(implode('/', $path));
}
}

View file

@ -33,7 +33,7 @@ if (!$found && function_exists('ini_set')) {
ini_set('include_path', $root . $ds . PATH_SEPARATOR . ini_get('include_path'));
}
if (!include($dispatcher)) {
if (!include $dispatcher) {
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
}
unset($paths, $path, $found, $dispatcher, $root, $ds);