Changed all public methods to specify public access.

This commit is contained in:
predominant 2010-04-05 13:19:38 +10:00
parent 14b6a7ac5e
commit 1497ec3910
139 changed files with 1278 additions and 2551 deletions

View file

@ -63,9 +63,8 @@ class AclShell extends Shell {
/**
* Override startup of the Shell
*
* @access public
*/
function startup() {
public function startup() {
if (isset($this->params['connection'])) {
$this->connection = $this->params['connection'];
}
@ -102,9 +101,8 @@ class AclShell extends Shell {
/**
* Override main() for help message hook
*
* @access public
*/
function main() {
public function main() {
$out = __("Available ACL commands:", true) . "\n";
$out .= "\t - create\n";
$out .= "\t - delete\n";
@ -124,9 +122,8 @@ class AclShell extends Shell {
/**
* Creates an ARO/ACO node
*
* @access public
*/
function create() {
public function create() {
$this->_checkArgs(3, 'create');
$this->checkNodeType();
extract($this->__dataVars());
@ -159,9 +156,8 @@ class AclShell extends Shell {
/**
* Delete an ARO/ACO node.
*
* @access public
*/
function delete() {
public function delete() {
$this->_checkArgs(2, 'delete');
$this->checkNodeType();
extract($this->__dataVars());
@ -178,9 +174,8 @@ class AclShell extends Shell {
/**
* Set parent for an ARO/ACO node.
*
* @access public
*/
function setParent() {
public function setParent() {
$this->_checkArgs(3, 'setParent');
$this->checkNodeType();
extract($this->__dataVars());
@ -204,9 +199,8 @@ class AclShell extends Shell {
/**
* Get path to specified ARO/ACO node.
*
* @access public
*/
function getPath() {
public function getPath() {
$this->_checkArgs(2, 'getPath');
$this->checkNodeType();
extract($this->__dataVars());
@ -250,9 +244,8 @@ class AclShell extends Shell {
/**
* Check permission for a given ARO to a given ACO.
*
* @access public
*/
function check() {
public function check() {
$this->_checkArgs(3, 'check');
extract($this->__getParams());
@ -266,9 +259,8 @@ class AclShell extends Shell {
/**
* Grant permission for a given ARO to a given ACO.
*
* @access public
*/
function grant() {
public function grant() {
$this->_checkArgs(3, 'grant');
extract($this->__getParams());
@ -282,9 +274,8 @@ class AclShell extends Shell {
/**
* Deny access for an ARO to an ACO.
*
* @access public
*/
function deny() {
public function deny() {
$this->_checkArgs(3, 'deny');
extract($this->__getParams());
@ -298,9 +289,8 @@ class AclShell extends Shell {
/**
* Set an ARO to inhermit permission to an ACO.
*
* @access public
*/
function inherit() {
public function inherit() {
$this->_checkArgs(3, 'inherit');
extract($this->__getParams());
@ -314,9 +304,8 @@ class AclShell extends Shell {
/**
* Show a specific ARO/ACO node.
*
* @access public
*/
function view() {
public function view() {
$this->_checkArgs(1, 'view');
$this->checkNodeType();
extract($this->__dataVars());
@ -376,9 +365,8 @@ class AclShell extends Shell {
/**
* Initialize ACL database.
*
* @access public
*/
function initdb() {
public function initdb() {
$this->Dispatch->args = array('schema', 'run', 'create', 'DbAcl');
$this->Dispatch->dispatch();
}
@ -386,9 +374,8 @@ class AclShell extends Shell {
/**
* Show help screen.
*
* @access public
*/
function help() {
public function help() {
$head = "-----------------------------------------------\n";
$head .= __("Usage: cake acl <command> <arg1> <arg2>...", true) . "\n";
$head .= "-----------------------------------------------\n";
@ -482,9 +469,8 @@ class AclShell extends Shell {
/**
* Check that first argument specifies a valid Node type (ARO/ACO)
*
* @access public
*/
function checkNodeType() {
public function checkNodeType() {
if (!isset($this->args[0])) {
return false;
}
@ -499,9 +485,8 @@ class AclShell extends Shell {
* @param string $type Node type (ARO/ACO)
* @param integer $id Node id
* @return boolean Success
* @access public
*/
function nodeExists() {
public function nodeExists() {
if (!$this->checkNodeType() && !isset($this->args[1])) {
return false;
}

View file

@ -39,9 +39,8 @@ class ApiShell extends Shell {
/**
* Override intialize of the Shell
*
* @access public
*/
function initialize() {
public function initialize() {
$this->paths = array_merge($this->paths, array(
'behavior' => LIBS . 'model' . DS . 'behaviors' . DS,
'cache' => LIBS . 'cache' . DS,
@ -57,9 +56,8 @@ class ApiShell extends Shell {
/**
* Override main() to handle action
*
* @access public
*/
function main() {
public function main() {
if (empty($this->args)) {
return $this->help();
}
@ -140,9 +138,8 @@ class ApiShell extends Shell {
/**
* Show help for this shell.
*
* @access public
*/
function help() {
public function help() {
$head = "Usage: cake api [<type>] <className> [-m <method>]\n";
$head .= "-----------------------------------------------\n";
$head .= "Parameters:\n\n";

View file

@ -42,9 +42,8 @@ class BakeShell extends Shell {
/**
* Override loadTasks() to handle paths
*
* @access public
*/
function loadTasks() {
public function loadTasks() {
parent::loadTasks();
$task = Inflector::classify($this->command);
if (isset($this->{$task}) && !in_array($task, array('Project', 'DbConfig'))) {
@ -66,9 +65,8 @@ class BakeShell extends Shell {
/**
* Override main() to handle action
*
* @access public
*/
function main() {
public function main() {
if (!is_dir($this->DbConfig->path)) {
if ($this->Project->execute()) {
$this->DbConfig->path = $this->params['working'] . DS . 'config' . DS;
@ -129,9 +127,8 @@ class BakeShell extends Shell {
/**
* Quickly bake the MVC
*
* @access public
*/
function all() {
public function all() {
$this->hr();
$this->out('Bake All');
$this->hr();
@ -199,9 +196,8 @@ class BakeShell extends Shell {
/**
* Displays help contents
*
* @access public
*/
function help() {
public function help() {
$this->out('CakePHP Bake:');
$this->hr();
$this->out('The Bake script generates controllers, views and models for your application.');

View file

@ -51,9 +51,8 @@ class ConsoleShell extends Shell {
/**
* Override intialize of the Shell
*
* @access public
*/
function initialize() {
public function initialize() {
require_once CAKE . 'dispatcher.php';
$this->Dispatcher = new Dispatcher();
$this->models = App::objects('model');
@ -76,9 +75,8 @@ class ConsoleShell extends Shell {
/**
* Prints the help message
*
* @access public
*/
function help() {
public function help() {
$out = 'Console help:';
$out .= '-------------';
$out .= 'The interactive console is a tool for testing parts of your app before you';
@ -139,9 +137,8 @@ class ConsoleShell extends Shell {
/**
* Override main() to handle action
*
* @access public
*/
function main($command = null) {
public function main($command = null) {
while (true) {
if (empty($command)) {
$command = trim($this->in(''));

View file

@ -45,9 +45,8 @@ class I18nShell extends Shell {
/**
* Override startup of the Shell
*
* @access public
*/
function startup() {
public function startup() {
$this->_welcome();
if (isset($this->params['datasource'])) {
$this->dataSource = $this->params['datasource'];
@ -64,9 +63,8 @@ class I18nShell extends Shell {
/**
* Override main() for help message hook
*
* @access public
*/
function main() {
public function main() {
$this->out(__('I18n Shell', true));
$this->hr();
$this->out(__('[E]xtract POT file from sources', true));
@ -98,9 +96,8 @@ class I18nShell extends Shell {
/**
* Initialize I18N database.
*
* @access public
*/
function initdb() {
public function initdb() {
$this->Dispatch->args = array('schema', 'create', 'i18n');
$this->Dispatch->dispatch();
}
@ -108,9 +105,8 @@ class I18nShell extends Shell {
/**
* Show help screen.
*
* @access public
*/
function help() {
public function help() {
$this->hr();
$this->out(__('I18n Shell:', true));
$this->hr();

View file

@ -43,9 +43,8 @@ class SchemaShell extends Shell {
/**
* Override initialize
*
* @access public
*/
function initialize() {
public function initialize() {
$this->_welcome();
$this->out('Cake Schema Shell');
$this->hr();
@ -54,9 +53,8 @@ class SchemaShell extends Shell {
/**
* Override startup
*
* @access public
*/
function startup() {
public function startup() {
$name = $file = $path = $connection = $plugin = null;
if (!empty($this->params['name'])) {
$name = $this->params['name'];
@ -97,9 +95,8 @@ class SchemaShell extends Shell {
/**
* Override main
*
* @access public
*/
function main() {
public function main() {
$this->help();
}
@ -107,9 +104,8 @@ class SchemaShell extends Shell {
* Read and output contents of schema object
* path to read as second arg
*
* @access public
*/
function view() {
public function view() {
$File = new File($this->Schema->path . DS . $this->params['file']);
if ($File->exists()) {
$this->out($File->read());
@ -125,9 +121,8 @@ class SchemaShell extends Shell {
* Read database and Write schema object
* accepts a connection as first arg or path to save as second arg
*
* @access public
*/
function generate() {
public function generate() {
$this->out(__('Generating Schema...', true));
$options = array();
if (isset($this->params['f'])) {
@ -197,9 +192,8 @@ class SchemaShell extends Shell {
* If -write contains a full path name the file will be saved there. If -write only
* contains no DS, that will be used as the file name, in the same dir as the schema file.
*
* @access public
*/
function dump() {
public function dump() {
$write = false;
$Schema = $this->Schema->load();
if (!$Schema) {
@ -427,9 +421,8 @@ class SchemaShell extends Shell {
/**
* Displays help contents
*
* @access public
*/
function help() {
public function help() {
$help = <<<TEXT
The Schema Shell generates a schema object from
the database and updates the database from the schema.

View file

@ -174,9 +174,8 @@ class Shell extends Object {
* acts as constructor for subclasses
* allows configuration of tasks prior to shell execution
*
* @access public
*/
function initialize() {
public function initialize() {
$this->_loadModels();
}
@ -185,9 +184,8 @@ class Shell extends Object {
* allows for checking and configuring prior to command or main execution
* can be overriden in subclasses
*
* @access public
*/
function startup() {
public function startup() {
$this->_welcome();
}
@ -268,9 +266,8 @@ class Shell extends Object {
* Loads tasks defined in public $tasks
*
* @return bool
* @access public
*/
function loadTasks() {
public function loadTasks() {
if ($this->tasks === null || $this->tasks === false || $this->tasks === true || empty($this->tasks)) {
return true;
}
@ -329,9 +326,8 @@ class Shell extends Object {
* @param mixed $options Array or string of options.
* @param string $default Default input value.
* @return Either the default value, or the user-provided input.
* @access public
*/
function in($prompt, $options = null, $default = null) {
public function in($prompt, $options = null, $default = null) {
if (!$this->interactive) {
return $default;
}
@ -363,9 +359,8 @@ class Shell extends Object {
* @param mixed $message A string or a an array of strings to output
* @param integer $newlines Number of newlines to append
* @return integer Returns the number of bytes returned from writing to stdout.
* @access public
*/
function out($message = null, $newlines = 1) {
public function out($message = null, $newlines = 1) {
if (is_array($message)) {
$message = implode($this->nl(), $message);
}
@ -378,9 +373,8 @@ class Shell extends Object {
*
* @param mixed $message A string or a an array of strings to output
* @param integer $newlines Number of newlines to append
* @access public
*/
function err($message = null, $newlines = 1) {
public function err($message = null, $newlines = 1) {
if (is_array($message)) {
$message = implode($this->nl(), $message);
}
@ -402,9 +396,8 @@ class Shell extends Object {
* Outputs a series of minus characters to the standard output, acts as a visual separator.
*
* @param integer $newlines Number of newlines to pre- and append
* @access public
*/
function hr($newlines = 0) {
public function hr($newlines = 0) {
$this->out(null, $newlines);
$this->out('---------------------------------------------------------------');
$this->out(null, $newlines);
@ -416,9 +409,8 @@ class Shell extends Object {
*
* @param string $title Title of the error
* @param string $message An optional error message
* @access public
*/
function error($title, $message = null) {
public function error($title, $message = null) {
$this->err(sprintf(__('Error: %s', true), $title));
if (!empty($message)) {
@ -453,9 +445,8 @@ class Shell extends Object {
* @param string $path Where to put the file.
* @param string $contents Content to put in the file.
* @return boolean Success
* @access public
*/
function createFile($path, $contents) {
public function createFile($path, $contents) {
$path = str_replace(DS . DS, DS, $path);
$this->out();
@ -491,9 +482,8 @@ class Shell extends Object {
/**
* Outputs usage text on the standard output. Implement it in subclasses.
*
* @access public
*/
function help() {
public function help() {
if ($this->command != null) {
$this->err("Unknown {$this->name} command `{$this->command}`.");
$this->err("For usage, try `cake {$this->shell} help`.", 2);
@ -528,9 +518,8 @@ class Shell extends Object {
*
* @param string $file Absolute file path
* @return sting short path
* @access public
*/
function shortPath($file) {
public function shortPath($file) {
$shortPath = str_replace(ROOT, null, $file);
$shortPath = str_replace('..' . DS, '', $shortPath);
return str_replace(DS . DS, DS, $shortPath);

View file

@ -47,9 +47,8 @@ class BakeTask extends Shell {
* and returns the correct path.
*
* @return string Path to output.
* @access public
*/
function getPath() {
public function getPath() {
$path = $this->path;
if (isset($this->plugin)) {
$name = substr($this->name, 0, strlen($this->name) - 4);

View file

@ -47,17 +47,15 @@ class ControllerTask extends BakeTask {
/**
* Override initialize
*
* @access public
*/
function initialize() {
public function initialize() {
}
/**
* Execution method always used for tasks
*
* @access public
*/
function execute() {
public function execute() {
if (empty($this->args)) {
$this->__interactive();
}
@ -382,9 +380,8 @@ class ControllerTask extends BakeTask {
* @param string $useDbConfig Database configuration name
* @param boolean $interactive Whether you are using listAll interactively and want options output.
* @return array Set of controllers
* @access public
*/
function listAll($useDbConfig = null) {
public function listAll($useDbConfig = null) {
if (is_null($useDbConfig)) {
$useDbConfig = $this->connection;
}
@ -408,9 +405,8 @@ class ControllerTask extends BakeTask {
*
* @param string $useDbConfig Connection name to get a controller name for.
* @return string Controller name
* @access public
*/
function getName($useDbConfig = null) {
public function getName($useDbConfig = null) {
$controllers = $this->listAll($useDbConfig);
$enteredController = '';
@ -439,9 +435,8 @@ class ControllerTask extends BakeTask {
/**
* Displays help contents
*
* @access public
*/
function help() {
public function help() {
$this->hr();
$this->out("Usage: cake bake controller <arg1> <arg2>...");
$this->hr();

View file

@ -58,18 +58,16 @@ class DbConfigTask extends Shell {
* initialization callback
*
* @var string
* @access public
*/
function initialize() {
public function initialize() {
$this->path = $this->params['working'] . DS . 'config' . DS;
}
/**
* Execution method always used for tasks
*
* @access public
*/
function execute() {
public function execute() {
if (empty($this->args)) {
$this->__interactive();
$this->_stop();
@ -244,9 +242,8 @@ class DbConfigTask extends Shell {
*
* @param array $configs Configuration settings to use
* @return boolean Success
* @access public
*/
function bake($configs) {
public function bake($configs) {
if (!is_dir($this->path)) {
$this->err($this->path . ' not found');
return false;

View file

@ -186,9 +186,8 @@ class ExtractTask extends Shell {
* Show help options
*
* @return void
* @access public
*/
function help() {
public function help() {
$this->out(__('CakePHP Language String Extraction:', true));
$this->hr();
$this->out(__('The Extract script generates .pot file(s) with translations', true));

View file

@ -53,9 +53,8 @@ class FixtureTask extends BakeTask {
/**
* Override initialize
*
* @access public
*/
function __construct(&$dispatch) {
public function __construct(&$dispatch) {
parent::__construct($dispatch);
$this->path = $this->params['working'] . DS . 'tests' . DS . 'fixtures' . DS;
}
@ -64,9 +63,8 @@ class FixtureTask extends BakeTask {
* Execution method always used for tasks
* Handles dispatching to interactive, named, or all processess.
*
* @access public
*/
function execute() {
public function execute() {
if (empty($this->args)) {
$this->__interactive();
}
@ -126,9 +124,8 @@ class FixtureTask extends BakeTask {
*
* @param string $modelName Name of model you are dealing with.
* @return array Array of import options.
* @access public
*/
function importOptions($modelName) {
public function importOptions($modelName) {
$options = array();
$doSchema = $this->in(__('Would you like to import schema for this fixture?', true), array('y', 'n'), 'n');
if ($doSchema == 'y') {
@ -155,9 +152,8 @@ class FixtureTask extends BakeTask {
* @param string $useTable Name of table to use.
* @param array $importOptions Options for public $import
* @return string Baked fixture content
* @access public
*/
function bake($model, $useTable = false, $importOptions = array()) {
public function bake($model, $useTable = false, $importOptions = array()) {
if (!class_exists('CakeSchema')) {
App::import('Model', 'CakeSchema', false);
}
@ -216,9 +212,8 @@ class FixtureTask extends BakeTask {
* @param string $model name of the model being generated
* @param string $fixture Contents of the fixture file.
* @return string Content saved into fixture file.
* @access public
*/
function generateFixtureFile($model, $otherVars) {
public function generateFixtureFile($model, $otherVars) {
$defaults = array('table' => null, 'schema' => null, 'records' => null, 'import' => null, 'fields' => null);
$vars = array_merge($defaults, $otherVars);
@ -394,9 +389,8 @@ class FixtureTask extends BakeTask {
/**
* Displays help contents
*
* @access public
*/
function help() {
public function help() {
$this->hr();
$this->out("Usage: cake bake fixture <arg1> <params>");
$this->hr();

View file

@ -71,9 +71,8 @@ class ModelTask extends BakeTask {
/**
* Execution method always used for tasks
*
* @access public
*/
function execute() {
public function execute() {
App::import('Model', 'Model', false);
if (empty($this->args)) {
@ -277,9 +276,8 @@ class ModelTask extends BakeTask {
*
* @param array $fields Array of fields that might have a primary key.
* @return string Name of field that is a primary key.
* @access public
*/
function findPrimaryKey($fields) {
public function findPrimaryKey($fields) {
foreach ($fields as $name => $field) {
if (isset($field['key']) && $field['key'] == 'primary') {
break;
@ -311,9 +309,8 @@ class ModelTask extends BakeTask {
*
* @param object $model Model to have validations generated for.
* @return array $validate Array of user selected validations.
* @access public
*/
function doValidation(&$model) {
public function doValidation(&$model) {
if (!is_object($model)) {
return false;
}
@ -446,9 +443,8 @@ class ModelTask extends BakeTask {
*
* @param object $model
* @return array $assocaitons
* @access public
*/
function doAssociations(&$model) {
public function doAssociations(&$model) {
if (!is_object($model)) {
return false;
}
@ -772,9 +768,8 @@ class ModelTask extends BakeTask {
* outputs the a list of possible models or controllers from database
*
* @param string $useDbConfig Database configuration name
* @access public
*/
function listAll($useDbConfig = null) {
public function listAll($useDbConfig = null) {
$this->_tables = $this->getAllTables($useDbConfig);
if ($this->interactive === true) {
@ -855,9 +850,8 @@ class ModelTask extends BakeTask {
* Forces the user to specify the model he wants to bake, and returns the selected model name.
*
* @return string the model name
* @access public
*/
function getName($useDbConfig = null) {
public function getName($useDbConfig = null) {
$this->listAll($useDbConfig);
$enteredModel = '';
@ -886,9 +880,8 @@ class ModelTask extends BakeTask {
/**
* Displays help contents
*
* @access public
*/
function help() {
public function help() {
$this->hr();
$this->out("Usage: cake bake model <arg1>");
$this->hr();

View file

@ -222,9 +222,8 @@ class PluginTask extends Shell {
* Help
*
* @return void
* @access public
*/
function help() {
public function help() {
$this->hr();
$this->out("Usage: cake bake plugin <arg1> <arg2>...");
$this->hr();

View file

@ -38,9 +38,8 @@ class ProjectTask extends Shell {
* finds the app directory in it. Then it calls bake() with that information.
*
* @param string $project Project path
* @access public
*/
function execute($project = null) {
public function execute($project = null) {
if ($project === null) {
if (isset($this->args[0])) {
$project = $this->args[0];
@ -187,9 +186,8 @@ class ProjectTask extends Shell {
*
* @param string $dir Path to project
* @return boolean Success
* @access public
*/
function createHome($dir) {
public function createHome($dir) {
$app = basename($dir);
$path = $dir . 'views' . DS . 'pages' . DS;
$source = CAKE . 'console' . DS . 'templates' . DS .'default' . DS . 'views' . DS . 'home.ctp';
@ -202,9 +200,8 @@ class ProjectTask extends Shell {
*
* @param string $path Project path
* @return boolean Success
* @access public
*/
function securitySalt($path) {
public function securitySalt($path) {
$File =& new File($path . 'config' . DS . 'core.php');
$contents = $File->read();
if (preg_match('/([\\t\\x20]*Configure::write\\(\\\'Security.salt\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
@ -226,9 +223,8 @@ class ProjectTask extends Shell {
*
* @param string $path Project path
* @return boolean Success
* @access public
*/
function securityCipherSeed($path) {
*/
public function securityCipherSeed($path) {
$File =& new File($path . 'config' . DS . 'core.php');
$contents = $File->read();
if (preg_match('/([\\t\\x20]*Configure::write\\(\\\'Security.cipherSeed\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
@ -250,9 +246,8 @@ class ProjectTask extends Shell {
*
* @param string $path Project path
* @return boolean Success
* @access public
*/
function corePath($path) {
public function corePath($path) {
if (dirname($path) !== CAKE_CORE_INCLUDE_PATH) {
$File =& new File($path . 'webroot' . DS . 'index.php');
$contents = $File->read();
@ -285,9 +280,8 @@ class ProjectTask extends Shell {
*
* @param string $name Name to use as admin routing
* @return boolean Success
* @access public
*/
function cakeAdmin($name) {
public function cakeAdmin($name) {
$path = (empty($this->configPath)) ? CONFIGS : $this->configPath;
$File =& new File($path . 'core.php');
$contents = $File->read();
@ -308,9 +302,8 @@ class ProjectTask extends Shell {
* Checks for Configure::read('Routing.prefixes') and forces user to input it if not enabled
*
* @return string Admin route to use
* @access public
*/
function getPrefix() {
public function getPrefix() {
$admin = '';
$prefixes = Configure::read('Routing.prefixes');
if (!empty($prefixes)) {
@ -353,9 +346,8 @@ class ProjectTask extends Shell {
* Help
*
* @return void
* @access public
*/
function help() {
public function help() {
$this->hr();
$this->out("Usage: cake bake project <arg1>");
$this->hr();

View file

@ -64,9 +64,8 @@ class TestTask extends BakeTask {
/**
* Execution method always used for tasks
*
* @access public
*/
function execute() {
public function execute() {
if (empty($this->args)) {
$this->__interactive();
}
@ -114,9 +113,8 @@ class TestTask extends BakeTask {
*
* @param string $type Type of object to bake test case for ie. Model, Controller
* @param string $className the 'cake name' for the class ie. Posts for the PostsController
* @access public
*/
function bake($type, $className) {
public function bake($type, $className) {
if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) {
$this->out(__('Bake is detecting possible fixtures..', true));
$testSubject =& $this->buildTestSubject($type, $className);
@ -155,9 +153,8 @@ class TestTask extends BakeTask {
* Interact with the user and get their chosen type. Can exit the script.
*
* @return string Users chosen type.
* @access public
*/
function getObjectType() {
public function getObjectType() {
$this->hr();
$this->out(__("Select an object type:", true));
$this->hr();
@ -180,9 +177,8 @@ class TestTask extends BakeTask {
*
* @param string $objectType Type of object to list classes for i.e. Model, Controller.
* @return string Class name the user chose.
* @access public
*/
function getClassName($objectType) {
public function getClassName($objectType) {
$options = App::objects(strtolower($objectType));
$this->out(sprintf(__('Choose a %s class', true), $objectType));
$keys = array();
@ -204,9 +200,8 @@ class TestTask extends BakeTask {
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $className the Classname of the class the test is being generated for.
* @return boolean
* @access public
*/
function typeCanDetectFixtures($type) {
public function typeCanDetectFixtures($type) {
$type = strtolower($type);
return ($type == 'controller' || $type == 'model');
}
@ -217,9 +212,8 @@ class TestTask extends BakeTask {
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $className the Classname of the class the test is being generated for.
* @return boolean
* @access public
*/
function isLoadableClass($type, $class) {
public function isLoadableClass($type, $class) {
return App::import($type, $class);
}
@ -230,9 +224,8 @@ class TestTask extends BakeTask {
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $class the Classname of the class the test is being generated for.
* @return object And instance of the class that is going to be tested.
* @access public
*/
function &buildTestSubject($type, $class) {
public function &buildTestSubject($type, $class) {
ClassRegistry::flush();
App::import($type, $class);
$class = $this->getRealClassName($type, $class);
@ -250,9 +243,8 @@ class TestTask extends BakeTask {
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $class the Classname of the class the test is being generated for.
* @return string Real classname
* @access public
*/
function getRealClassName($type, $class) {
public function getRealClassName($type, $class) {
if (strtolower($type) == 'model') {
return $class;
}
@ -265,9 +257,8 @@ class TestTask extends BakeTask {
*
* @param string $className Name of class to look at.
* @return array Array of method names.
* @access public
*/
function getTestableMethods($className) {
public function getTestableMethods($className) {
$classMethods = get_class_methods($className);
$parentMethods = get_class_methods(get_parent_class($className));
$thisMethods = array_diff($classMethods, $parentMethods);
@ -286,9 +277,8 @@ class TestTask extends BakeTask {
*
* @param object $subject The object you want to generate fixtures for.
* @return array Array of fixtures to be included in the test.
* @access public
*/
function generateFixtureList(&$subject) {
public function generateFixtureList(&$subject) {
$this->_fixtures = array();
if (is_a($subject, 'Model')) {
$this->_processModel($subject);
@ -365,9 +355,8 @@ class TestTask extends BakeTask {
* Interact with the user to get additional fixtures they want to use.
*
* @return array Array of fixtures the user wants to add.
* @access public
*/
function getUserFixtures() {
public function getUserFixtures() {
$proceed = $this->in(__('Bake could not detect fixtures, would you like to add some?', true), array('y','n'), 'n');
$fixtures = array();
if (strtolower($proceed) == 'y') {
@ -385,9 +374,8 @@ class TestTask extends BakeTask {
*
* @param string $type The type of object tests are being generated for eg. controller.
* @return boolean
* @access public
*/
function hasMockClass($type) {
public function hasMockClass($type) {
$type = strtolower($type);
return $type == 'controller';
}
@ -398,9 +386,8 @@ class TestTask extends BakeTask {
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $className the Classname of the class the test is being generated for.
* @return string Constructor snippet for the thing you are building.
* @access public
*/
function generateConstructor($type, $fullClassName) {
public function generateConstructor($type, $fullClassName) {
$type = strtolower($type);
if ($type == 'model') {
return "ClassRegistry::init('$fullClassName');\n";
@ -419,9 +406,8 @@ class TestTask extends BakeTask {
* @param string $type The Type of object you are generating tests for eg. controller
* @param string $className the Classname of the class the test is being generated for.
* @return string filename the test should be created on.
* @access public
*/
function testCaseFileName($type, $className) {
public function testCaseFileName($type, $className) {
$path = $this->getPath();;
$path .= 'cases' . DS . Inflector::tableize($type) . DS;
if (strtolower($type) == 'controller') {
@ -434,9 +420,8 @@ class TestTask extends BakeTask {
* Show help file.
*
* @return void
* @access public
*/
function help() {
public function help() {
$this->hr();
$this->out("Usage: cake bake test <type> <class>");
$this->hr();

View file

@ -88,17 +88,15 @@ class ViewTask extends BakeTask {
/**
* Override initialize
*
* @access public
*/
function initialize() {
public function initialize() {
}
/**
* Execution method always used for tasks
*
* @access public
*/
function execute() {
public function execute() {
if (empty($this->args)) {
$this->__interactive();
}
@ -359,9 +357,8 @@ class ViewTask extends BakeTask {
* @param string $action Action to bake
* @param string $content Content to write
* @return boolean Success
* @access public
*/
function bake($action, $content = '') {
public function bake($action, $content = '') {
if ($content === true) {
$content = $this->getContent($action);
}
@ -376,9 +373,8 @@ class ViewTask extends BakeTask {
* @param string $action name to generate content to
* @param array $vars passed for use in templates
* @return string content from template
* @access public
*/
function getContent($action, $vars = null) {
public function getContent($action, $vars = null) {
if (!$vars) {
$vars = $this->__loadController();
}
@ -398,9 +394,8 @@ class ViewTask extends BakeTask {
*
* @param string $action name
* @return string template name
* @access public
*/
function getTemplate($action) {
public function getTemplate($action) {
if ($action != $this->template && in_array($action, $this->noTemplateActions)) {
return false;
}
@ -425,9 +420,8 @@ class ViewTask extends BakeTask {
/**
* Displays help contents
*
* @access public
*/
function help() {
public function help() {
$this->hr();
$this->out("Usage: cake bake view <arg1> <arg2>...");
$this->hr();

View file

@ -73,9 +73,8 @@ class TestSuiteShell extends Shell {
* Initialization method installs Simpletest and loads all plugins
*
* @return void
* @access public
*/
function initialize() {
public function initialize() {
$corePath = App::core('cake');
if (isset($corePath[0])) {
define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath[0], DS) . DS);
@ -100,9 +99,8 @@ class TestSuiteShell extends Shell {
* Parse the arguments given into the Shell object properties.
*
* @return void
* @access public
*/
function parseArgs() {
public function parseArgs() {
if (empty($this->args)) {
return;
}
@ -146,9 +144,8 @@ class TestSuiteShell extends Shell {
* Main entry point to this shell
*
* @return void
* @access public
*/
function main() {
public function main() {
$this->out(__('CakePHP Test Shell', true));
$this->hr();
@ -174,9 +171,8 @@ class TestSuiteShell extends Shell {
* Help screen
*
* @return void
* @access public
*/
function help() {
public function help() {
$this->out('Usage: ');
$this->out("\tcake testsuite category test_type file");
$this->out("\t\t- category - \"app\", \"core\" or name of a plugin");