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

@ -127,9 +127,8 @@ class ShellDispatcher {
*
* @param array $args the argv
* @return void
* @access public
*/
function ShellDispatcher($args = array()) {
public function ShellDispatcher($args = array()) {
set_time_limit(0);
$this->__initConstants();
@ -281,9 +280,8 @@ class ShellDispatcher {
* Clear the console
*
* @return void
* @access public
*/
function clear() {
public function clear() {
if (empty($this->params['noclear'])) {
if ( DS === '/') {
passthru('clear');
@ -297,9 +295,8 @@ class ShellDispatcher {
* Dispatches a CLI request
*
* @return boolean
* @access public
*/
function dispatch() {
public function dispatch() {
$arg = $this->shiftArgs();
if (!$arg) {
@ -429,9 +426,8 @@ class ShellDispatcher {
* @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 getInput($prompt, $options = null, $default = null) {
public function getInput($prompt, $options = null, $default = null) {
if (!is_array($options)) {
$printOptions = '';
} else {
@ -462,9 +458,8 @@ class ShellDispatcher {
* @param string $string String to output.
* @param boolean $newline If true, the outputs gets an added newline.
* @return integer Returns the number of bytes output to stdout.
* @access public
*/
function stdout($string, $newline = true) {
public function stdout($string, $newline = true) {
if ($newline) {
return fwrite($this->stdout, $string . "\n");
} else {
@ -476,9 +471,8 @@ class ShellDispatcher {
* Outputs to the stderr filehandle.
*
* @param string $string Error text to output.
* @access public
*/
function stderr($string) {
public function stderr($string) {
fwrite($this->stderr, $string);
}
@ -486,9 +480,8 @@ class ShellDispatcher {
* Parses command line options
*
* @param array $params Parameters to parse
* @access public
*/
function parseParams($params) {
public function parseParams($params) {
$this->__parseParams($params);
$defaults = array('app' => 'app', 'root' => dirname(dirname(dirname(__FILE__))), 'working' => null, 'webroot' => 'webroot');
$params = array_merge($defaults, array_intersect_key($this->params, $defaults));
@ -562,18 +555,16 @@ class ShellDispatcher {
* Removes first argument and shifts other arguments up
*
* @return mixed Null if there are no arguments otherwise the shifted argument
* @access public
*/
function shiftArgs() {
public function shiftArgs() {
return array_shift($this->args);
}
/**
* Shows console help
*
* @access public
*/
function help() {
public function help() {
$this->clear();
$this->stdout("\nWelcome to CakePHP v" . Configure::version() . " Console");
$this->stdout("---------------------------------------------------------------");

View file

@ -58,9 +58,8 @@ class ErrorHandler extends Object {
* Displays an error page (e.g. 404 Not found).
*
* @param array $params Parameters (code, name, and message)
* @access public
*/
function error($params) {
public function error($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr($code . $name . $message."\n");
$this->_stop();
@ -70,9 +69,8 @@ class ErrorHandler extends Object {
* Convenience method to display a 404 page.
*
* @param array $params Parameters (url, message)
* @access public
*/
function error404($params) {
public function error404($params) {
extract($params, EXTR_OVERWRITE);
$this->error(array(
'code' => '404',
@ -86,9 +84,8 @@ class ErrorHandler extends Object {
* Renders the Missing Controller web page.
*
* @param array $params Parameters (className)
* @access public
*/
function missingController($params) {
public function missingController($params) {
extract($params, EXTR_OVERWRITE);
$controllerName = str_replace('Controller', '', $className);
$this->stderr(sprintf(__("Missing Controller '%s'", true), $controllerName));
@ -99,9 +96,8 @@ class ErrorHandler extends Object {
* Renders the Missing Action web page.
*
* @param array $params Parameters (action, className)
* @access public
*/
function missingAction($params) {
public function missingAction($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Method '%s' in '%s'", true), $action, $className));
$this->_stop();
@ -111,9 +107,8 @@ class ErrorHandler extends Object {
* Renders the Private Action web page.
*
* @param array $params Parameters (action, className)
* @access public
*/
function privateAction($params) {
public function privateAction($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Trying to access private method '%s' in '%s'", true), $action, $className));
$this->_stop();
@ -123,9 +118,8 @@ class ErrorHandler extends Object {
* Renders the Missing Table web page.
*
* @param array $params Parameters (table, className)
* @access public
*/
function missingTable($params) {
public function missingTable($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing database table '%s' for model '%s'", true), $table, $className));
$this->_stop();
@ -135,9 +129,8 @@ class ErrorHandler extends Object {
* Renders the Missing Database web page.
*
* @param array $params Parameters
* @access public
*/
function missingDatabase($params = array()) {
public function missingDatabase($params = array()) {
$this->stderr(__("Missing Database", true));
$this->_stop();
}
@ -146,9 +139,8 @@ class ErrorHandler extends Object {
* Renders the Missing View web page.
*
* @param array $params Parameters (file, action, className)
* @access public
*/
function missingView($params) {
public function missingView($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing View '%s' for '%s' in '%s'", true), $file, $action, $className));
$this->_stop();
@ -158,9 +150,8 @@ class ErrorHandler extends Object {
* Renders the Missing Layout web page.
*
* @param array $params Parameters (file)
* @access public
*/
function missingLayout($params) {
public function missingLayout($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Layout '%s'", true), $file));
$this->_stop();
@ -170,9 +161,8 @@ class ErrorHandler extends Object {
* Renders the Database Connection web page.
*
* @param array $params Parameters
* @access public
*/
function missingConnection($params) {
public function missingConnection($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(__("Missing Database Connection. Try 'cake bake'", true));
$this->_stop();
@ -182,9 +172,8 @@ class ErrorHandler extends Object {
* Renders the Missing Helper file web page.
*
* @param array $params Parameters (file, helper)
* @access public
*/
function missingHelperFile($params) {
public function missingHelperFile($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Helper file '%s' for '%s'", true), $file, Inflector::camelize($helper)));
$this->_stop();
@ -194,9 +183,8 @@ class ErrorHandler extends Object {
* Renders the Missing Helper class web page.
*
* @param array $params Parameters (file, helper)
* @access public
*/
function missingHelperClass($params) {
public function missingHelperClass($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Helper class '%s' in '%s'", true), Inflector::camelize($helper), $file));
$this->_stop();
@ -206,9 +194,8 @@ class ErrorHandler extends Object {
* Renders the Missing Component file web page.
*
* @param array $params Parameters (file, component)
* @access public
*/
function missingComponentFile($params) {
public function missingComponentFile($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Component file '%s' for '%s'", true), $file, Inflector::camelize($component)));
$this->_stop();
@ -218,9 +205,8 @@ class ErrorHandler extends Object {
* Renders the Missing Component class web page.
*
* @param array $params Parameters (file, component)
* @access public
*/
function missingComponentClass($params) {
public function missingComponentClass($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing Component class '%s' in '%s'", true), Inflector::camelize($component), $file));
$this->_stop();
@ -230,9 +216,8 @@ class ErrorHandler extends Object {
* Renders the Missing Model class web page.
*
* @param array $params Parameters (className)
* @access public
*/
function missingModel($params) {
public function missingModel($params) {
extract($params, EXTR_OVERWRITE);
$this->stderr(sprintf(__("Missing model '%s'", true), $className));
$this->_stop();
@ -243,9 +228,8 @@ class ErrorHandler extends Object {
*
* @param string $string String to output.
* @param boolean $newline If true, the outputs gets an added newline.
* @access public
*/
function stdout($string, $newline = true) {
public function stdout($string, $newline = true) {
if ($newline) {
fwrite($this->stdout, $string . "\n");
} else {
@ -257,9 +241,8 @@ class ErrorHandler extends Object {
* Outputs to the stderr filehandle.
*
* @param string $string Error text to output.
* @access public
*/
function stderr($string) {
public function stderr($string) {
fwrite($this->stderr, "Error: ". $string . "\n");
}
}

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");

View file

@ -92,9 +92,8 @@ class Dispatcher extends Object {
* @param string $url URL information to work on
* @param array $additionalParams Settings array ("bare", "return") which is melded with the GET and POST params
* @return boolean Success
* @access public
*/
function dispatch($url = null, $additionalParams = array()) {
public function dispatch($url = null, $additionalParams = array()) {
if ($this->base === false) {
$this->base = $this->baseUrl();
}
@ -236,9 +235,8 @@ class Dispatcher extends Object {
*
* @param string $fromUrl URL to mine for parameter information.
* @return array Parameters found in POST and GET.
* @access public
*/
function parseParams($fromUrl) {
public function parseParams($fromUrl) {
$params = array();
if (isset($_POST)) {
@ -315,9 +313,8 @@ class Dispatcher extends Object {
* Returns a base URL and sets the proper webroot
*
* @return string Base URL
* @access public
*/
function baseUrl() {
public function baseUrl() {
$dir = $webroot = null;
$config = Configure::read('App');
extract($config);
@ -461,9 +458,8 @@ class Dispatcher extends Object {
* constructs a new one, using the PHP_SELF constant and other variables.
*
* @return string URI
* @access public
*/
function uri() {
public function uri() {
foreach (array('HTTP_X_REWRITE_URL', 'REQUEST_URI', 'argv') as $var) {
if ($uri = env($var)) {
if ($var == 'argv') {
@ -508,9 +504,8 @@ class Dispatcher extends Object {
* @param string $uri Request URI
* @param string $base Base path
* @return string URL
* @access public
*/
function getUrl($uri = null, $base = null) {
public function getUrl($uri = null, $base = null) {
if (empty($_GET['url'])) {
if ($uri == null) {
$uri = $this->uri();
@ -557,9 +552,8 @@ class Dispatcher extends Object {
* Outputs cached dispatch view cache
*
* @param string $url Requested URL
* @access public
*/
function cached($url) {
public function cached($url) {
if (Configure::read('Cache.check') === true) {
$path = $this->here;
if ($this->here == '/') {
@ -594,9 +588,8 @@ class Dispatcher extends Object {
*
* @param $url string $url Requested URL
* @return boolean True on success if the asset file was found and sent
* @access public
*/
function asset($url) {
public function asset($url) {
if (strpos($url, '..') !== false || strpos($url, '.') === false) {
return false;
}

View file

@ -361,9 +361,8 @@ class Cache {
* default config will be used.
* @return mixed new value, or false if the data doesn't exist, is not integer,
* or if there was an error fetching it.
* @access public
*/
function increment($key, $offset = 1, $config = null) {
public function increment($key, $offset = 1, $config = null) {
$self =& Cache::getInstance();
if (!$config) {
@ -395,9 +394,8 @@ class Cache {
* default config will be used.
* @return mixed new value, or false if the data doesn't exist, is not integer,
* or if there was an error fetching it
* @access public
*/
function decrement($key, $offset = 1, $config = null) {
public function decrement($key, $offset = 1, $config = null) {
$self =& Cache::getInstance();
if (!$config) {
@ -558,9 +556,8 @@ class CacheEngine {
*
* @param array $params Associative array of parameters for the engine
* @return boolean True if the engine has been succesfully initialized, false if not
* @access public
*/
function init($settings = array()) {
public function init($settings = array()) {
$this->settings = array_merge(
array('prefix' => 'cake_', 'duration'=> 3600, 'probability'=> 100),
$this->settings,
@ -577,9 +574,8 @@ class CacheEngine {
*
* Permanently remove all expired and deleted data
*
* @access public
*/
function gc() {
public function gc() {
}
/**
@ -589,9 +585,8 @@ class CacheEngine {
* @param mixed $value Data to be cached
* @param mixed $duration How long to cache the data, in seconds
* @return boolean True if the data was succesfully cached, false on failure
* @access public
*/
function write($key, &$value, $duration) {
public function write($key, &$value, $duration) {
trigger_error(sprintf(__('Method write() not implemented in %s', true), get_class($this)), E_USER_ERROR);
}
@ -600,9 +595,8 @@ class CacheEngine {
*
* @param string $key Identifier for the data
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
* @access public
*/
function read($key) {
public function read($key) {
trigger_error(sprintf(__('Method read() not implemented in %s', true), get_class($this)), E_USER_ERROR);
}
@ -612,9 +606,8 @@ class CacheEngine {
* @param string $key Identifier for the data
* @param integer $offset How much to add
* @return New incremented value, false otherwise
* @access public
*/
function increment($key, $offset = 1) {
public function increment($key, $offset = 1) {
trigger_error(sprintf(__('Method increment() not implemented in %s', true), get_class($this)), E_USER_ERROR);
}
/**
@ -623,9 +616,8 @@ class CacheEngine {
* @param string $key Identifier for the data
* @param integer $value How much to substract
* @return New incremented value, false otherwise
* @access public
*/
function decrement($key, $offset = 1) {
public function decrement($key, $offset = 1) {
trigger_error(sprintf(__('Method decrement() not implemented in %s', true), get_class($this)), E_USER_ERROR);
}
/**
@ -633,9 +625,8 @@ class CacheEngine {
*
* @param string $key Identifier for the data
* @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
* @access public
*/
function delete($key) {
public function delete($key) {
}
/**
@ -643,18 +634,16 @@ class CacheEngine {
*
* @param boolean $check if true will check expiration, otherwise delete all
* @return boolean True if the cache was succesfully cleared, false otherwise
* @access public
*/
function clear($check) {
public function clear($check) {
}
/**
* Cache Engine settings
*
* @return array settings
* @access public
*/
function settings() {
public function settings() {
return $this->settings;
}
@ -663,9 +652,8 @@ class CacheEngine {
*
* @param string $key the key passed over
* @return mixed string $key or false
* @access public
*/
function key($key) {
public function key($key) {
if (empty($key)) {
return false;
}

View file

@ -36,9 +36,8 @@ class ApcEngine extends CacheEngine {
* @param array $setting array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
* @see CacheEngine::__defaults
* @access public
*/
function init($settings = array()) {
public function init($settings = array()) {
parent::init(array_merge(array('engine' => 'Apc', 'prefix' => Inflector::slug(APP_DIR) . '_'), $settings));
return function_exists('apc_cache_info');
}
@ -50,9 +49,8 @@ class ApcEngine extends CacheEngine {
* @param mixed $value Data to be cached
* @param integer $duration How long to cache the data, in seconds
* @return boolean True if the data was succesfully cached, false on failure
* @access public
*/
function write($key, &$value, $duration) {
public function write($key, &$value, $duration) {
$expires = time() + $duration;
apc_store($key.'_expires', $expires, $duration);
return apc_store($key, $value, $duration);
@ -63,9 +61,8 @@ class ApcEngine extends CacheEngine {
*
* @param string $key Identifier for the data
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
* @access public
*/
function read($key) {
public function read($key) {
$time = time();
$cachetime = intval(apc_fetch($key.'_expires'));
if ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime) {
@ -81,9 +78,8 @@ class ApcEngine extends CacheEngine {
* @param integer $offset How much to increment
* @param integer $duration How long to cache the data, in seconds
* @return New incremented value, false otherwise
* @access public
*/
function increment($key, $offset = 1) {
public function increment($key, $offset = 1) {
return apc_inc($key, $offset);
}
@ -94,9 +90,8 @@ class ApcEngine extends CacheEngine {
* @param integer $offset How much to substract
* @param integer $duration How long to cache the data, in seconds
* @return New decremented value, false otherwise
* @access public
*/
function decrement($key, $offset = 1) {
public function decrement($key, $offset = 1) {
return apc_dec($key, $offset);
}
@ -105,9 +100,8 @@ class ApcEngine extends CacheEngine {
*
* @param string $key Identifier for the data
* @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
* @access public
*/
function delete($key) {
public function delete($key) {
return apc_delete($key);
}
@ -115,9 +109,8 @@ class ApcEngine extends CacheEngine {
* Delete all keys from the cache
*
* @return boolean True if the cache was succesfully cleared, false otherwise
* @access public
*/
function clear() {
public function clear() {
return apc_clear_cache('user');
}
}

View file

@ -69,9 +69,8 @@ class FileEngine extends CacheEngine {
*
* @param array $setting array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
* @access public
*/
function init($settings = array()) {
public function init($settings = array()) {
parent::init(array_merge(
array(
'engine' => 'File', 'path' => CACHE, 'prefix'=> 'cake_', 'lock'=> false,
@ -98,9 +97,8 @@ class FileEngine extends CacheEngine {
* Garbage collection. Permanently remove all expired and deleted data
*
* @return boolean True if garbage collection was succesful, false on failure
* @access public
*/
function gc() {
public function gc() {
return $this->clear(true);
}
@ -111,9 +109,8 @@ class FileEngine extends CacheEngine {
* @param mixed $data Data to be cached
* @param mixed $duration How long to cache the data, in seconds
* @return boolean True if the data was succesfully cached, false on failure
* @access public
*/
function write($key, &$data, $duration) {
public function write($key, &$data, $duration) {
if ($data === '' || !$this->_init) {
return false;
}
@ -151,9 +148,8 @@ class FileEngine extends CacheEngine {
*
* @param string $key Identifier for the data
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
* @access public
*/
function read($key) {
public function read($key) {
if ($this->_setKey($key) === false || !$this->_init || !$this->_File->exists()) {
return false;
}
@ -184,9 +180,8 @@ class FileEngine extends CacheEngine {
*
* @param string $key Identifier for the data
* @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed
* @access public
*/
function delete($key) {
public function delete($key) {
if ($this->_setKey($key) === false || !$this->_init) {
return false;
}
@ -198,9 +193,8 @@ class FileEngine extends CacheEngine {
*
* @param boolean $check Optional - only delete expired cache items
* @return boolean True if the cache was succesfully cleared, false otherwise
* @access public
*/
function clear($check) {
public function clear($check) {
if (!$this->_init) {
return false;
}

View file

@ -55,9 +55,8 @@ class MemcacheEngine extends CacheEngine {
*
* @param array $setting array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
* @access public
*/
function init($settings = array()) {
public function init($settings = array()) {
if (!class_exists('Memcache')) {
return false;
}
@ -101,9 +100,8 @@ class MemcacheEngine extends CacheEngine {
* @param mixed $value Data to be cached
* @param integer $duration How long to cache the data, in seconds
* @return boolean True if the data was succesfully cached, false on failure
* @access public
*/
function write($key, &$value, $duration) {
public function write($key, &$value, $duration) {
$expires = time() + $duration;
$this->__Memcache->set($key . '_expires', $expires, $this->settings['compress'], $expires);
return $this->__Memcache->set($key, $value, $this->settings['compress'], $expires);
@ -114,9 +112,8 @@ class MemcacheEngine extends CacheEngine {
*
* @param string $key Identifier for the data
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
* @access public
*/
function read($key) {
public function read($key) {
$time = time();
$cachetime = intval($this->__Memcache->get($key . '_expires'));
if ($cachetime < $time || ($time + $this->settings['duration']) < $cachetime) {
@ -132,9 +129,8 @@ class MemcacheEngine extends CacheEngine {
* @param integer $offset How much to increment
* @param integer $duration How long to cache the data, in seconds
* @return New incremented value, false otherwise
* @access public
*/
function increment($key, $offset = 1) {
public function increment($key, $offset = 1) {
if ($this->settings['compress']) {
trigger_error(sprintf(__('Method increment() not implemented for compressed cache in %s', true), get_class($this)), E_USER_ERROR);
}
@ -148,9 +144,8 @@ class MemcacheEngine extends CacheEngine {
* @param integer $offset How much to substract
* @param integer $duration How long to cache the data, in seconds
* @return New decremented value, false otherwise
* @access public
*/
function decrement($key, $offset = 1) {
public function decrement($key, $offset = 1) {
if ($this->settings['compress']) {
trigger_error(sprintf(__('Method decrement() not implemented for compressed cache in %s', true), get_class($this)), E_USER_ERROR);
}
@ -162,9 +157,8 @@ class MemcacheEngine extends CacheEngine {
*
* @param string $key Identifier for the data
* @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
* @access public
*/
function delete($key) {
public function delete($key) {
return $this->__Memcache->delete($key);
}
@ -172,9 +166,8 @@ class MemcacheEngine extends CacheEngine {
* Delete all keys from the cache
*
* @return boolean True if the cache was succesfully cleared, false otherwise
* @access public
*/
function clear() {
public function clear() {
return $this->__Memcache->flush();
}
@ -184,9 +177,8 @@ class MemcacheEngine extends CacheEngine {
* @param string $host host ip address or name
* @param integer $port Server port
* @return boolean True if memcache server was connected
* @access public
*/
function connect($host, $port = 11211) {
public function connect($host, $port = 11211) {
if ($this->__Memcache->getServerStatus($host, $port) === 0) {
if ($this->__Memcache->connect($host, $port)) {
return true;

View file

@ -46,9 +46,8 @@ class XcacheEngine extends CacheEngine {
*
* @param array $setting array of setting for the engine
* @return boolean True if the engine has been successfully initialized, false if not
* @access public
*/
function init($settings) {
public function init($settings) {
parent::init(array_merge(array(
'engine' => 'Xcache', 'prefix' => Inflector::slug(APP_DIR) . '_', 'PHP_AUTH_USER' => 'user', 'PHP_AUTH_PW' => 'password'
), $settings)
@ -63,9 +62,8 @@ class XcacheEngine extends CacheEngine {
* @param mixed $value Data to be cached
* @param integer $duration How long to cache the data, in seconds
* @return boolean True if the data was succesfully cached, false on failure
* @access public
*/
function write($key, &$value, $duration) {
public function write($key, &$value, $duration) {
$expires = time() + $duration;
xcache_set($key . '_expires', $expires, $duration);
return xcache_set($key, $value, $duration);
@ -76,9 +74,8 @@ class XcacheEngine extends CacheEngine {
*
* @param string $key Identifier for the data
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
* @access public
*/
function read($key) {
public function read($key) {
if (xcache_isset($key)) {
$time = time();
$cachetime = intval(xcache_get($key . '_expires'));
@ -98,9 +95,8 @@ class XcacheEngine extends CacheEngine {
* @param integer $offset How much to increment
* @param integer $duration How long to cache the data, in seconds
* @return New incremented value, false otherwise
* @access public
*/
function increment($key, $offset = 1) {
public function increment($key, $offset = 1) {
return xcache_inc($key, $offset);
}
@ -112,9 +108,8 @@ class XcacheEngine extends CacheEngine {
* @param integer $offset How much to substract
* @param integer $duration How long to cache the data, in seconds
* @return New decremented value, false otherwise
* @access public
*/
function decrement($key, $offset = 1) {
public function decrement($key, $offset = 1) {
return xcache_dec($key, $offset);
}
/**
@ -122,9 +117,8 @@ class XcacheEngine extends CacheEngine {
*
* @param string $key Identifier for the data
* @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
* @access public
*/
function delete($key) {
public function delete($key) {
return xcache_unset($key);
}
@ -132,9 +126,8 @@ class XcacheEngine extends CacheEngine {
* Delete all keys from the cache
*
* @return boolean True if the cache was succesfully cleared, false otherwise
* @access public
*/
function clear() {
public function clear() {
$this->__auth();
$max = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $max; $i++) {

View file

@ -135,9 +135,8 @@ class CakeSession extends Object {
*
* @param string $base The base path for the Session
* @param boolean $start Should session be started right now
* @access public
*/
function __construct($base = null, $start = true) {
public function __construct($base = null, $start = true) {
App::import('Core', array('Set', 'Security'));
$this->time = time();
@ -198,9 +197,8 @@ class CakeSession extends Object {
* Starts the Session.
*
* @return boolean True if session was started
* @access public
*/
function start() {
public function start() {
if ($this->started()) {
return true;
}
@ -230,9 +228,8 @@ class CakeSession extends Object {
*
* @param string $name Variable name to check for
* @return boolean True if variable is there
* @access public
*/
function check($name) {
public function check($name) {
if (empty($name)) {
return false;
}
@ -245,9 +242,8 @@ class CakeSession extends Object {
*
* @param id $name string
* @return string Session id
* @access public
*/
function id($id = null) {
public function id($id = null) {
if ($id) {
$this->id = $id;
session_id($this->id);
@ -264,9 +260,8 @@ class CakeSession extends Object {
*
* @param string $name Session variable to remove
* @return boolean Success
* @access public
*/
function delete($name) {
public function delete($name) {
if ($this->check($name)) {
if (in_array($name, $this->watchKeys)) {
trigger_error(sprintf(__('Deleting session key {%s}', true), $name), E_USER_NOTICE);
@ -317,9 +312,8 @@ class CakeSession extends Object {
* Returns last occurred error as a string, if any.
*
* @return mixed Error description as a string, or false.
* @access public
*/
function error() {
public function error() {
if ($this->lastError) {
return $this->__error($this->lastError);
} else {
@ -331,9 +325,8 @@ class CakeSession extends Object {
* Returns true if session is valid.
*
* @return boolean Success
* @access public
*/
function valid() {
public function valid() {
if ($this->read('Config')) {
if ((Configure::read('Session.checkAgent') === false || $this->_userAgent == $this->read('Config.userAgent')) && $this->time <= $this->read('Config.time')) {
if ($this->error === false) {
@ -352,9 +345,8 @@ class CakeSession extends Object {
*
* @param mixed $name The name of the session variable (or a path as sent to Set.extract)
* @return mixed The value of the session variable
* @access public
*/
function read($name = null) {
public function read($name = null) {
if (is_null($name)) {
return $this->__returnSessionVars();
}
@ -389,9 +381,8 @@ class CakeSession extends Object {
*
* @param mixed $var The variable path to watch
* @return void
* @access public
*/
function watch($var) {
public function watch($var) {
if (empty($var)) {
return false;
}
@ -405,9 +396,8 @@ class CakeSession extends Object {
*
* @param mixed $var The variable path to watch
* @return void
* @access public
*/
function ignore($var) {
public function ignore($var) {
if (!in_array($var, $this->watchKeys)) {
return;
}
@ -426,9 +416,8 @@ class CakeSession extends Object {
* @param mixed $name Name of variable
* @param string $value Value to write
* @return boolean True if the write was successful, false if the write failed
* @access public
*/
function write($name, $value) {
public function write($name, $value) {
if (empty($name)) {
return false;
}
@ -443,9 +432,8 @@ class CakeSession extends Object {
* Helper method to destroy invalid sessions.
*
* @return void
* @access public
*/
function destroy() {
public function destroy() {
$_SESSION = array();
$this->__construct($this->path);
$this->start();
@ -671,9 +659,8 @@ class CakeSession extends Object {
/**
* Restarts this session.
*
* @access public
*/
function renew() {
public function renew() {
$this->__regenerateId();
}

View file

@ -102,9 +102,8 @@ class CakeSocket extends Object {
* Connect the socket to the given host and port.
*
* @return boolean Success
* @access public
*/
function connect() {
public function connect() {
if ($this->connection != null) {
$this->disconnect();
}
@ -136,9 +135,8 @@ class CakeSocket extends Object {
* Get the host name of the current connection.
*
* @return string Host name
* @access public
*/
function host() {
public function host() {
if (Validation::ip($this->config['host'])) {
return gethostbyaddr($this->config['host']);
} else {
@ -150,9 +148,8 @@ class CakeSocket extends Object {
* Get the IP address of the current connection.
*
* @return string IP address
* @access public
*/
function address() {
public function address() {
if (Validation::ip($this->config['host'])) {
return $this->config['host'];
} else {
@ -164,9 +161,8 @@ class CakeSocket extends Object {
* Get all IP addresses associated with the current connection.
*
* @return array IP addresses
* @access public
*/
function addresses() {
public function addresses() {
if (Validation::ip($this->config['host'])) {
return array($this->config['host']);
} else {
@ -178,9 +174,8 @@ class CakeSocket extends Object {
* Get the last error as a string.
*
* @return string Last error
* @access public
*/
function lastError() {
public function lastError() {
if (!empty($this->lastError)) {
return $this->lastError['num'] . ': ' . $this->lastError['str'];
} else {
@ -193,9 +188,8 @@ class CakeSocket extends Object {
*
* @param integer $errNum Error code
* @param string $errStr Error string
* @access public
*/
function setLastError($errNum, $errStr) {
public function setLastError($errNum, $errStr) {
$this->lastError = array('num' => $errNum, 'str' => $errStr);
}
@ -204,9 +198,8 @@ class CakeSocket extends Object {
*
* @param string $data The data to write to the socket
* @return boolean Success
* @access public
*/
function write($data) {
public function write($data) {
if (!$this->connected) {
if (!$this->connect()) {
return false;
@ -222,9 +215,8 @@ class CakeSocket extends Object {
*
* @param integer $length Optional buffer length to read; defaults to 1024
* @return mixed Socket data
* @access public
*/
function read($length = 1024) {
public function read($length = 1024) {
if (!$this->connected) {
if (!$this->connect()) {
return false;
@ -248,18 +240,16 @@ class CakeSocket extends Object {
* Abort socket operation.
*
* @return boolean Success
* @access public
*/
function abort() {
public function abort() {
}
/**
* Disconnect the socket from the current connection.
*
* @return boolean Success
* @access public
*/
function disconnect() {
public function disconnect() {
if (!is_resource($this->connection)) {
$this->connected = false;
return true;
@ -285,9 +275,8 @@ class CakeSocket extends Object {
* Resets the state of this Socket instance to it's initial state (before Object::__construct got executed)
*
* @return boolean True on success
* @access public
*/
function reset($state = null) {
public function reset($state = null) {
if (empty($state)) {
static $initalState = array();
if (empty($initalState)) {

View file

@ -60,9 +60,8 @@ class ClassRegistry {
* Return a singleton instance of the ClassRegistry.
*
* @return ClassRegistry instance
* @access public
*/
function &getInstance() {
public function &getInstance() {
static $instance = array();
if (!$instance) {
$instance[0] =& new ClassRegistry();

View file

@ -40,9 +40,8 @@ class Configure extends Object {
* Returns a singleton instance of the Configure class.
*
* @return Configure instance
* @access public
*/
function &getInstance($boot = true) {
public function &getInstance($boot = true) {
static $instance = array();
if (!$instance) {
if (!class_exists('Set')) {
@ -76,9 +75,8 @@ class Configure extends Object {
* @param array $config Name of var to write
* @param mixed $value Value to set for var
* @return boolean True if write was successful
* @access public
*/
function write($config, $value = null) {
public function write($config, $value = null) {
$_this =& Configure::getInstance();
if (!is_array($config)) {
@ -148,9 +146,8 @@ class Configure extends Object {
* @link http://book.cakephp.org/view/927/read
* @param string $var Variable to obtain. Use '.' to access array elements.
* @return string value of Configure::$var
* @access public
*/
function read($var = 'debug') {
public function read($var = 'debug') {
$_this =& Configure::getInstance();
if ($var === 'debug') {
@ -198,9 +195,8 @@ class Configure extends Object {
* @link http://book.cakephp.org/view/928/delete
* @param string $var the var to be deleted
* @return void
* @access public
*/
function delete($var = null) {
public function delete($var = null) {
$_this =& Configure::getInstance();
if (strpos($var, '.') === false) {
@ -226,9 +222,8 @@ class Configure extends Object {
* @param string $fileName name of file to load, extension must be .php and only the name
* should be used, not the extenstion
* @return mixed false if file not found, void if load successful
* @access public
*/
function load($fileName) {
public function load($fileName) {
$found = $plugin = $pluginPath = false;
list($plugin, $fileName) = pluginSplit($fileName);
if ($plugin) {
@ -275,9 +270,8 @@ class Configure extends Object {
*
* @link http://book.cakephp.org/view/930/version
* @return string Current version of CakePHP
* @access public
*/
function version() {
public function version() {
$_this =& Configure::getInstance();
if (!isset($_this->Cake['version'])) {
@ -300,9 +294,8 @@ class Configure extends Object {
* @param string $name file name.
* @param array $data array of values to store.
* @return void
* @access public
*/
function store($type, $name, $data = array()) {
public function store($type, $name, $data = array()) {
$write = true;
$content = '';
@ -627,9 +620,8 @@ class App extends Object {
*
* @param string $type type of path
* @return string array
* @access public
*/
function path($type) {
public function path($type) {
$_this =& App::getInstance();
if (!isset($_this->{$type})) {
return array();
@ -644,9 +636,8 @@ class App extends Object {
* @param array $paths paths defines in config/bootstrap.php
* @param boolean $reset true will set paths, false merges paths [default] false
* @return void
* @access public
*/
function build($paths = array(), $reset = false) {
public function build($paths = array(), $reset = false) {
$_this =& App::getInstance();
$defaults = array(
'models' => array(MODELS),
@ -723,9 +714,8 @@ class App extends Object {
* @param string $type valid values are: 'model', 'behavior', 'controller', 'component',
* 'view', 'helper', 'datasource', 'libs', and 'cake'
* @return array numeric keyed array of core lib paths
* @access public
*/
function core($type = null) {
public function core($type = null) {
static $paths = false;
if ($paths === false) {
$paths = Cache::read('core_paths', '_cake_core_');
@ -765,9 +755,8 @@ class App extends Object {
* type will be used.
* @param boolean $cache Set to false to rescan objects of the chosen type. Defaults to true.
* @return mixed Either false on incorrect / miss. Or an array of found objects.
* @access public
*/
function objects($type, $path = null, $cache = true) {
public function objects($type, $path = null, $cache = true) {
$objects = array();
$extension = false;
$name = $type;
@ -838,9 +827,8 @@ class App extends Object {
* @param boolean $return, return the loaded file, the file must have a return
* statement in it to work: return $variable;
* @return boolean true if Class is already in memory or if file is found and loaded, false if not
* @access public
*/
function import($type = null, $name = null, $parent = true, $search = array(), $file = null, $return = false) {
public function import($type = null, $name = null, $parent = true, $search = array(), $file = null, $return = false) {
$plugin = $directory = null;
if (is_array($type)) {
@ -958,9 +946,8 @@ class App extends Object {
* Returns a single instance of App.
*
* @return object
* @access public
*/
function &getInstance() {
public function &getInstance() {
static $instance = array();
if (!$instance) {
$instance[0] =& new App();

View file

@ -64,9 +64,8 @@ class Component extends Object {
*
* @param object $controller Controller with components to load
* @return void
* @access public
*/
function init(&$controller) {
public function init(&$controller) {
if (!is_array($controller->components)) {
return;
}
@ -131,9 +130,8 @@ class Component extends Object {
*
* @param object $controller Controller with components to beforeRedirect
* @return void
* @access public
*/
function beforeRedirect(&$controller, $url, $status = null, $exit = true) {
public function beforeRedirect(&$controller, $url, $status = null, $exit = true) {
$response = array();
foreach ($this->_primary as $name) {
@ -177,9 +175,8 @@ class Component extends Object {
* @param Controller $controller Controller instance
* @param string $callback Callback to trigger.
* @return void
* @access public
*/
function triggerCallback($callback, &$controller) {
public function triggerCallback($callback, &$controller) {
foreach ($this->_primary as $name) {
$component =& $this->_loaded[$name];
if (method_exists($component, $callback) && $component->enabled === true) {

View file

@ -63,9 +63,8 @@ class AclComponent extends Object {
*
* @param object $controller Controller using this component
* @return boolean Proceed with component usage (true), or fail (false)
* @access public
*/
function startup(&$controller) {
public function startup(&$controller) {
return true;
}
@ -85,9 +84,8 @@ class AclComponent extends Object {
* @param string $aco ACO The controlled object identifier.
* @param string $action Action (defaults to *)
* @return boolean Success
* @access public
*/
function check($aro, $aco, $action = "*") {
public function check($aro, $aco, $action = "*") {
return $this->_Instance->check($aro, $aco, $action);
}
@ -99,9 +97,8 @@ class AclComponent extends Object {
* @param string $aco ACO The controlled object identifier.
* @param string $action Action (defaults to *)
* @return boolean Success
* @access public
*/
function allow($aro, $aco, $action = "*") {
public function allow($aro, $aco, $action = "*") {
return $this->_Instance->allow($aro, $aco, $action);
}
@ -113,9 +110,8 @@ class AclComponent extends Object {
* @param string $aco ACO The controlled object identifier.
* @param string $action Action (defaults to *)
* @return boolean Success
* @access public
*/
function deny($aro, $aco, $action = "*") {
public function deny($aro, $aco, $action = "*") {
return $this->_Instance->deny($aro, $aco, $action);
}
@ -127,9 +123,8 @@ class AclComponent extends Object {
* @param string $aco ACO The controlled object identifier.
* @param string $action Action (defaults to *)
* @return boolean Success
* @access public
*/
function inherit($aro, $aco, $action = "*") {
public function inherit($aro, $aco, $action = "*") {
return $this->_Instance->inherit($aro, $aco, $action);
}
@ -140,9 +135,8 @@ class AclComponent extends Object {
* @param string $aco ACO The controlled object identifier.
* @param string $action Action (defaults to *)
* @return boolean Success
* @access public
*/
function grant($aro, $aco, $action = "*") {
public function grant($aro, $aco, $action = "*") {
return $this->_Instance->grant($aro, $aco, $action);
}
@ -153,9 +147,8 @@ class AclComponent extends Object {
* @param string $aco ACO The controlled object identifier.
* @param string $action Action (defaults to *)
* @return boolean Success
* @access public
*/
function revoke($aro, $aco, $action = "*") {
public function revoke($aro, $aco, $action = "*") {
return $this->_Instance->revoke($aro, $aco, $action);
}
}
@ -187,18 +180,16 @@ class AclBase extends Object {
* @param string $aro ARO The requesting object identifier.
* @param string $aco ACO The controlled object identifier.
* @param string $action Action (defaults to *)
* @access public
*/
function check($aro, $aco, $action = "*") {
public function check($aro, $aco, $action = "*") {
}
/**
* Empty method to be overridden in subclasses
*
* @param object $component Component
* @access public
*/
function initialize(&$component) {
public function initialize(&$component) {
}
}
@ -242,9 +233,8 @@ class DbAcl extends AclBase {
*
* @param AclComponent $component
* @return void
* @access public
*/
function initialize(&$component) {
public function initialize(&$component) {
$component->Aro =& $this->Aro;
$component->Aco =& $this->Aco;
}
@ -256,9 +246,8 @@ class DbAcl extends AclBase {
* @param string $aco ACO The controlled object identifier.
* @param string $action Action (defaults to *)
* @return boolean Success (true if ARO has access to action in ACO, false otherwise)
* @access public
*/
function check($aro, $aco, $action = "*") {
public function check($aro, $aco, $action = "*") {
if ($aro == null || $aco == null) {
return false;
}
@ -347,9 +336,8 @@ class DbAcl extends AclBase {
* @param string $actions Action (defaults to *)
* @param integer $value Value to indicate access type (1 to give access, -1 to deny, 0 to inherit)
* @return boolean Success
* @access public
*/
function allow($aro, $aco, $actions = "*", $value = 1) {
public function allow($aro, $aco, $actions = "*", $value = 1) {
$perms = $this->getAclLink($aro, $aco);
$permKeys = $this->_getAcoKeys($this->Aro->Permission->schema());
$save = array();
@ -398,9 +386,8 @@ class DbAcl extends AclBase {
* @param string $aco ACO The controlled object identifier.
* @param string $actions Action (defaults to *)
* @return boolean Success
* @access public
*/
function deny($aro, $aco, $action = "*") {
public function deny($aro, $aco, $action = "*") {
return $this->allow($aro, $aco, $action, -1);
}
@ -411,9 +398,8 @@ class DbAcl extends AclBase {
* @param string $aco ACO The controlled object identifier.
* @param string $actions Action (defaults to *)
* @return boolean Success
* @access public
*/
function inherit($aro, $aco, $action = "*") {
public function inherit($aro, $aco, $action = "*") {
return $this->allow($aro, $aco, $action, 0);
}
@ -425,9 +411,8 @@ class DbAcl extends AclBase {
* @param string $actions Action (defaults to *)
* @return boolean Success
* @see allow()
* @access public
*/
function grant($aro, $aco, $action = "*") {
public function grant($aro, $aco, $action = "*") {
return $this->allow($aro, $aco, $action);
}
@ -439,9 +424,8 @@ class DbAcl extends AclBase {
* @param string $actions Action (defaults to *)
* @return boolean Success
* @see deny()
* @access public
*/
function revoke($aro, $aco, $action = "*") {
public function revoke($aro, $aco, $action = "*") {
return $this->deny($aro, $aco, $action);
}
@ -451,9 +435,8 @@ class DbAcl extends AclBase {
* @param string $aro ARO The requesting object identifier.
* @param string $aco ACO The controlled object identifier.
* @return array Indexed array with: 'aro', 'aco' and 'link'
* @access public
*/
function getAclLink($aro, $aco) {
public function getAclLink($aro, $aco) {
$obj = array();
$obj['Aro'] = $this->Aro->node($aro);
$obj['Aco'] = $this->Aco->node($aco);
@ -524,9 +507,8 @@ class IniAcl extends AclBase {
* @param string $aco ACO
* @param string $aco_action Action
* @return boolean Success
* @access public
*/
function check($aro, $aco, $aco_action = null) {
public function check($aro, $aco, $aco_action = null) {
if ($this->config == null) {
$this->config = $this->readConfigFile(CONFIGS . 'acl.ini.php');
}
@ -579,9 +561,8 @@ class IniAcl extends AclBase {
*
* @param string $fileName File
* @return array INI section structure
* @access public
*/
function readConfigFile($fileName) {
public function readConfigFile($fileName) {
$fileLineArray = file($fileName);
foreach ($fileLineArray as $fileLine) {
@ -622,9 +603,8 @@ class IniAcl extends AclBase {
*
* @param array $array Array to trim
* @return array Trimmed array
* @access public
*/
function arrayTrim($array) {
public function arrayTrim($array) {
foreach ($array as $key => $value) {
$array[$key] = trim($value);
}

View file

@ -251,9 +251,8 @@ class AuthComponent extends Object {
*
* @param object $controller A reference to the instantiating controller object
* @return void
* @access public
*/
function initialize(&$controller, $settings = array()) {
public function initialize(&$controller, $settings = array()) {
$this->params = $controller->params;
$crud = array('create', 'read', 'update', 'delete');
$this->actionMap = array_merge($this->actionMap, array_combine($crud, $crud));
@ -288,9 +287,8 @@ class AuthComponent extends Object {
*
* @param object $controller A reference to the instantiating controller object
* @return boolean
* @access public
*/
function startup(&$controller) {
public function startup(&$controller) {
$isErrorOrTests = (
strtolower($controller->name) == 'cakeerror' ||
(strtolower($controller->name) == 'tests' && Configure::read() > 0)
@ -487,9 +485,8 @@ class AuthComponent extends Object {
* @param mixed $object object, model object, or model name
* @param mixed $user The user to check the authorization of
* @return boolean True if $user is authorized, otherwise false
* @access public
*/
function isAuthorized($type = null, $object = null, $user = null) {
public function isAuthorized($type = null, $object = null, $user = null) {
if (empty($user) && !$this->user()) {
return false;
} elseif (empty($user)) {
@ -589,9 +586,8 @@ class AuthComponent extends Object {
* @param string $action Controller action name
* @param string ... etc.
* @return void
* @access public
*/
function allow() {
public function allow() {
$args = func_get_args();
if (empty($args) || $args == array('*')) {
$this->allowedActions = $this->_methods;
@ -611,9 +607,8 @@ class AuthComponent extends Object {
* @param string ... etc.
* @return void
* @see AuthComponent::allow()
* @access public
*/
function deny() {
public function deny() {
$args = func_get_args();
if (isset($args[0]) && is_array($args[0])) {
$args = $args[0];
@ -632,9 +627,8 @@ class AuthComponent extends Object {
*
* @param array $map Actions to map
* @return void
* @access public
*/
function mapActions($map = array()) {
public function mapActions($map = array()) {
$crud = array('create', 'read', 'update', 'delete');
foreach ($map as $action => $type) {
if (in_array($action, $crud) && is_array($type)) {
@ -657,9 +651,8 @@ class AuthComponent extends Object {
*
* @param mixed $data User object
* @return boolean True on login success, false on failure
* @access public
*/
function login($data = null) {
public function login($data = null) {
$this->__setDefaults();
$this->_loggedIn = false;
@ -680,9 +673,8 @@ class AuthComponent extends Object {
* @param mixed $url Optional URL to redirect the user to after logout
* @return string AuthComponent::$loginAction
* @see AuthComponent::$loginAction
* @access public
*/
function logout() {
public function logout() {
$this->__setDefaults();
$this->Session->delete($this->sessionKey);
$this->Session->delete('Auth.redirect');
@ -695,9 +687,8 @@ class AuthComponent extends Object {
*
* @param string $key field to retrive. Leave null to get entire User record
* @return mixed User record. or null if no user is logged in.
* @access public
*/
function user($key = null) {
public function user($key = null) {
$this->__setDefaults();
if (!$this->Session->check($this->sessionKey)) {
return null;
@ -720,9 +711,8 @@ class AuthComponent extends Object {
*
* @param mixed $url Optional URL to write as the login redirect URL.
* @return string Redirect URL
* @access public
*/
function redirect($url = null) {
public function redirect($url = null) {
if (!is_null($url)) {
$redir = $url;
$this->Session->write('Auth.redirect', $redir);
@ -750,9 +740,8 @@ class AuthComponent extends Object {
* @param string $action Optional. The action to validate against.
* @see AuthComponent::identify()
* @return boolean True if the user validates, false otherwise.
* @access public
*/
function validate($object, $user = null, $action = null) {
public function validate($object, $user = null, $action = null) {
if (empty($user)) {
$user = $this->user();
}
@ -769,9 +758,8 @@ class AuthComponent extends Object {
* user against. The current request action is used if
* none is specified.
* @return boolean ACO node path
* @access public
*/
function action($action = ':plugin/:controller/:action') {
public function action($action = ':plugin/:controller/:action') {
$plugin = empty($this->params['plugin']) ? null : Inflector::camelize($this->params['plugin']) . '/';
return str_replace(
array(':controller', ':action', ':plugin/'),
@ -786,9 +774,8 @@ class AuthComponent extends Object {
*
* @param string $name Model name (defaults to AuthComponent::$userModel)
* @return object A reference to a model object
* @access public
*/
function &getModel($name = null) {
public function &getModel($name = null) {
$model = null;
if (!$name) {
$name = $this->userModel;
@ -815,9 +802,8 @@ class AuthComponent extends Object {
* Uses the current user session if none specified.
* @param array $conditions Optional. Additional conditions to a find.
* @return array User record data, or null, if the user could not be identified.
* @access public
*/
function identify($user = null, $conditions = null) {
public function identify($user = null, $conditions = null) {
if ($conditions === false) {
$conditions = null;
} elseif (is_array($conditions)) {
@ -891,9 +877,8 @@ class AuthComponent extends Object {
*
* @param array $data Set of data to look for passwords
* @return array Data with passwords hashed
* @access public
*/
function hashPasswords($data) {
public function hashPasswords($data) {
if (is_object($this->authenticate) && method_exists($this->authenticate, 'hashPasswords')) {
return $this->authenticate->hashPasswords($data);
}
@ -912,9 +897,8 @@ class AuthComponent extends Object {
*
* @param string $password Password to hash
* @return string Hashed password
* @access public
*/
function password($password) {
public function password($password) {
return Security::hash($password, null, true);
}
@ -922,9 +906,8 @@ class AuthComponent extends Object {
* Component shutdown. If user is logged in, wipe out redirect.
*
* @param object $controller Instantiating controller
* @access public
*/
function shutdown(&$controller) {
public function shutdown(&$controller) {
if ($this->_loggedIn) {
$this->Session->delete('Auth.redirect');
}

View file

@ -160,9 +160,8 @@ class CookieComponent extends Object {
* Main execution method.
*
* @param object $controller A reference to the instantiating controller object
* @access public
*/
function initialize(&$controller, $settings) {
public function initialize(&$controller, $settings) {
$this->key = Configure::read('Security.salt');
$this->_set($settings);
}
@ -170,9 +169,8 @@ class CookieComponent extends Object {
/**
* Start CookieComponent for use in the controller
*
* @access public
*/
function startup() {
public function startup() {
$this->__expire($this->time);
if (isset($_COOKIE[$this->name])) {
@ -196,9 +194,8 @@ class CookieComponent extends Object {
* @param mixed $value Value
* @param boolean $encrypt Set to true to encrypt value, false otherwise
* @param string $expires Can be either Unix timestamp, or date string
* @access public
*/
function write($key, $value = null, $encrypt = true, $expires = null) {
public function write($key, $value = null, $encrypt = true, $expires = null) {
if (is_null($encrypt)) {
$encrypt = true;
}
@ -234,9 +231,8 @@ class CookieComponent extends Object {
*
* @param mixed $key Key of the value to be obtained. If none specified, obtain map key => values
* @return string or null, value for specified key
* @access public
*/
function read($key = null) {
public function read($key = null) {
if (empty($this->__values) && isset($_COOKIE[$this->name])) {
$this->__values = $this->__decrypt($_COOKIE[$this->name]);
}
@ -270,9 +266,8 @@ class CookieComponent extends Object {
*
* @param string $key Key of the value to be deleted
* @return void
* @access public
*/
function delete($key) {
public function delete($key) {
if (empty($this->__values)) {
$this->read();
}
@ -293,9 +288,8 @@ class CookieComponent extends Object {
* Failure to do so will result in header already sent errors.
*
* @return void
* @access public
*/
function destroy() {
public function destroy() {
if (isset($_COOKIE[$this->name])) {
$this->__values = $this->__decrypt($_COOKIE[$this->name]);
}

View file

@ -302,9 +302,8 @@ class EmailComponent extends Object{
* Initialize component
*
* @param object $controller Instantiating controller
* @access public
*/
function initialize(&$controller, $settings = array()) {
public function initialize(&$controller, $settings = array()) {
$this->Controller =& $controller;
if (Configure::read('App.encoding') !== null) {
$this->charset = Configure::read('App.encoding');
@ -316,9 +315,8 @@ class EmailComponent extends Object{
* Startup component
*
* @param object $controller Instantiating controller
* @access public
*/
function startup(&$controller) {}
public function startup(&$controller) {}
/**
* Send an email using the specified content, template and layout
@ -327,9 +325,8 @@ class EmailComponent extends Object{
* @param string $template Template to use when sending email
* @param string $layout Layout to use to enclose email body
* @return boolean Success
* @access public
*/
function send($content = null, $template = null, $layout = null) {
public function send($content = null, $template = null, $layout = null) {
$this->_createHeader();
if ($template) {
@ -389,9 +386,8 @@ class EmailComponent extends Object{
/**
* Reset all EmailComponent internal variables to be able to send out a new email.
*
* @access public
*/
function reset() {
public function reset() {
$this->template = null;
$this->to = array();
$this->from = null;

View file

@ -195,9 +195,8 @@ class RequestHandlerComponent extends Object {
* @param array $settings Array of settings to _set().
* @return void
* @see Router::parseExtensions()
* @access public
*/
function initialize(&$controller, $settings = array()) {
public function initialize(&$controller, $settings = array()) {
if (isset($controller->params['url']['ext'])) {
$this->ext = $controller->params['url']['ext'];
}
@ -220,9 +219,8 @@ class RequestHandlerComponent extends Object {
*
* @param object $controller A reference to the controller
* @return void
* @access public
*/
function startup(&$controller) {
public function startup(&$controller) {
if (!$this->enabled) {
return;
}
@ -259,9 +257,8 @@ class RequestHandlerComponent extends Object {
*
* @param object $controller A reference to the controller
* @param mixed $url A string or array containing the redirect location
* @access public
*/
function beforeRedirect(&$controller, $url) {
public function beforeRedirect(&$controller, $url) {
if (!$this->isAjax()) {
return;
}
@ -279,9 +276,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the current HTTP request is Ajax, false otherwise
*
* @return boolean True if call is Ajax
* @access public
*/
function isAjax() {
public function isAjax() {
return env('HTTP_X_REQUESTED_WITH') === "XMLHttpRequest";
}
@ -289,9 +285,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the current HTTP request is coming from a Flash-based client
*
* @return boolean True if call is from Flash
* @access public
*/
function isFlash() {
public function isFlash() {
return (preg_match('/^(Shockwave|Adobe) Flash/', env('HTTP_USER_AGENT')) == 1);
}
@ -299,9 +294,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the current request is over HTTPS, false otherwise.
*
* @return bool True if call is over HTTPS
* @access public
*/
function isSSL() {
public function isSSL() {
return env('HTTPS');
}
@ -309,9 +303,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the current call accepts an XML response, false otherwise
*
* @return boolean True if client accepts an XML response
* @access public
*/
function isXml() {
public function isXml() {
return $this->prefers('xml');
}
@ -319,9 +312,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the current call accepts an RSS response, false otherwise
*
* @return boolean True if client accepts an RSS response
* @access public
*/
function isRss() {
public function isRss() {
return $this->prefers('rss');
}
@ -329,9 +321,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the current call accepts an Atom response, false otherwise
*
* @return boolean True if client accepts an RSS response
* @access public
*/
function isAtom() {
public function isAtom() {
return $this->prefers('atom');
}
@ -360,9 +351,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the client accepts WAP content
*
* @return bool
* @access public
*/
function isWap() {
public function isWap() {
return $this->prefers('wap');
}
@ -370,9 +360,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the current call a POST request
*
* @return boolean True if call is a POST
* @access public
*/
function isPost() {
public function isPost() {
return (strtolower(env('REQUEST_METHOD')) == 'post');
}
@ -380,9 +369,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the current call a PUT request
*
* @return boolean True if call is a PUT
* @access public
*/
function isPut() {
public function isPut() {
return (strtolower(env('REQUEST_METHOD')) == 'put');
}
@ -390,9 +378,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the current call a GET request
*
* @return boolean True if call is a GET
* @access public
*/
function isGet() {
public function isGet() {
return (strtolower(env('REQUEST_METHOD')) == 'get');
}
@ -400,9 +387,8 @@ class RequestHandlerComponent extends Object {
* Returns true if the current call a DELETE request
*
* @return boolean True if call is a DELETE
* @access public
*/
function isDelete() {
public function isDelete() {
return (strtolower(env('REQUEST_METHOD')) == 'delete');
}
@ -411,9 +397,8 @@ class RequestHandlerComponent extends Object {
* The Prototype library sets a special "Prototype version" HTTP header.
*
* @return string Prototype version of component making Ajax call
* @access public
*/
function getAjaxVersion() {
public function getAjaxVersion() {
if (env('HTTP_X_PROTOTYPE_VERSION') != null) {
return env('HTTP_X_PROTOTYPE_VERSION');
}
@ -430,9 +415,8 @@ class RequestHandlerComponent extends Object {
* @param mixed $type The Content-type or array of Content-types assigned to the name,
* i.e. "text/html", or "application/xml"
* @return void
* @access public
*/
function setContent($name, $type = null) {
public function setContent($name, $type = null) {
if (is_array($name)) {
$this->__requestContent = array_merge($this->__requestContent, $name);
return;
@ -444,9 +428,8 @@ class RequestHandlerComponent extends Object {
* Gets the server name from which this request was referred
*
* @return string Server address
* @access public
*/
function getReferer() {
public function getReferer() {
if (env('HTTP_HOST') != null) {
$sessHost = env('HTTP_HOST');
}
@ -461,9 +444,8 @@ class RequestHandlerComponent extends Object {
* Gets remote client IP
*
* @return string Client IP address
* @access public
*/
function getClientIP($safe = true) {
public function getClientIP($safe = true) {
if (!$safe && env('HTTP_X_FORWARDED_FOR') != null) {
$ipaddr = preg_replace('/(?:,.*)/', '', env('HTTP_X_FORWARDED_FOR'));
} else {
@ -538,9 +520,8 @@ class RequestHandlerComponent extends Object {
*
* @param mixed $type Can be null (or no parameter), a string type name, or an array of types
* @return mixed
* @access public
*/
function requestedWith($type = null) {
public function requestedWith($type = null) {
if (!$this->isPost() && !$this->isPut()) {
return null;
}
@ -746,9 +727,8 @@ class RequestHandlerComponent extends Object {
*
* @return mixed A string content type alias, or raw content type if no alias map exists,
* otherwise null
* @access public
*/
function responseType() {
public function responseType() {
if ($this->__responseTypeSet == null) {
return null;
}
@ -760,9 +740,8 @@ class RequestHandlerComponent extends Object {
*
* @param mixed $type Content type
* @return mixed Alias
* @access public
*/
function mapType($ctype) {
public function mapType($ctype) {
if (is_array($ctype)) {
$out = array();
foreach ($ctype as $t) {

View file

@ -174,9 +174,8 @@ class SecurityComponent extends Object {
* @param object $controller Controller instance for the request
* @param array $settings Settings to set to the component
* @return void
* @access public
*/
function initialize(&$controller, $settings = array()) {
public function initialize(&$controller, $settings = array()) {
$this->_set($settings);
}
@ -185,9 +184,8 @@ class SecurityComponent extends Object {
*
* @param object $controller Instantiating controller
* @return void
* @access public
*/
function startup(&$controller) {
public function startup(&$controller) {
$this->_action = strtolower($controller->action);
$this->_methodsRequired($controller);
$this->_secureRequired($controller);
@ -214,9 +212,8 @@ class SecurityComponent extends Object {
* Sets the actions that require a POST request, or empty for all actions
*
* @return void
* @access public
*/
function requirePost() {
public function requirePost() {
$args = func_get_args();
$this->_requireMethod('Post', $args);
}
@ -225,9 +222,8 @@ class SecurityComponent extends Object {
* Sets the actions that require a GET request, or empty for all actions
*
* @return void
* @access public
*/
function requireGet() {
public function requireGet() {
$args = func_get_args();
$this->_requireMethod('Get', $args);
}
@ -236,9 +232,8 @@ class SecurityComponent extends Object {
* Sets the actions that require a PUT request, or empty for all actions
*
* @return void
* @access public
*/
function requirePut() {
public function requirePut() {
$args = func_get_args();
$this->_requireMethod('Put', $args);
}
@ -247,9 +242,8 @@ class SecurityComponent extends Object {
* Sets the actions that require a DELETE request, or empty for all actions
*
* @return void
* @access public
*/
function requireDelete() {
public function requireDelete() {
$args = func_get_args();
$this->_requireMethod('Delete', $args);
}
@ -258,9 +252,8 @@ class SecurityComponent extends Object {
* Sets the actions that require a request that is SSL-secured, or empty for all actions
*
* @return void
* @access public
*/
function requireSecure() {
public function requireSecure() {
$args = func_get_args();
$this->_requireMethod('Secure', $args);
}
@ -269,9 +262,8 @@ class SecurityComponent extends Object {
* Sets the actions that require an authenticated request, or empty for all actions
*
* @return void
* @access public
*/
function requireAuth() {
public function requireAuth() {
$args = func_get_args();
$this->_requireMethod('Auth', $args);
}
@ -280,9 +272,8 @@ class SecurityComponent extends Object {
* Sets the actions that require an HTTP-authenticated request, or empty for all actions
*
* @return void
* @access public
*/
function requireLogin() {
public function requireLogin() {
$args = func_get_args();
$base = $this->loginOptions;
@ -305,9 +296,8 @@ class SecurityComponent extends Object {
*
* @param string $type Either 'basic', 'digest', or null. If null/empty, will try both.
* @return mixed If successful, returns an array with login name and password, otherwise null.
* @access public
*/
function loginCredentials($type = null) {
public function loginCredentials($type = null) {
switch (strtolower($type)) {
case 'basic':
$login = array('username' => env('PHP_AUTH_USER'), 'password' => env('PHP_AUTH_PW'));
@ -344,9 +334,8 @@ class SecurityComponent extends Object {
*
* @param array $options Set of options for header
* @return string HTTP-authentication request header
* @access public
*/
function loginRequest($options = array()) {
public function loginRequest($options = array()) {
$options = array_merge($this->loginOptions, $options);
$this->_setLoginDefaults($options);
$auth = 'WWW-Authenticate: ' . ucfirst($options['type']);
@ -366,9 +355,8 @@ class SecurityComponent extends Object {
*
* @param string $digest Digest authentication response
* @return array Digest authentication parameters
* @access public
*/
function parseDigestAuthData($digest) {
public function parseDigestAuthData($digest) {
if (substr($digest, 0, 7) == 'Digest ') {
$digest = substr($digest, 7);
}

View file

@ -66,9 +66,8 @@ class SessionComponent extends CakeSession {
*
* @param object $controller Instantiating controller
* @return void
* @access public
*/
function startup(&$controller) {
public function startup(&$controller) {
if ($this->started() === false && $this->__active === true) {
$this->__start();
}
@ -79,9 +78,8 @@ class SessionComponent extends CakeSession {
*
* @param string $base The base path for the Session
* @return void
* @access public
*/
function activate($base = null) {
public function activate($base = null) {
if ($this->__active === true) {
return;
}
@ -98,9 +96,8 @@ class SessionComponent extends CakeSession {
* This should be in a Controller.key format for better organizing
* @param string $value The value you want to store in a session.
* @return boolean Success
* @access public
*/
function write($name, $value = null) {
public function write($name, $value = null) {
if ($this->__active === true) {
$this->__start();
if (is_array($name)) {
@ -127,9 +124,8 @@ class SessionComponent extends CakeSession {
*
* @param string $name the name of the session key you want to read
* @return mixed value from the session vars
* @access public
*/
function read($name = null) {
public function read($name = null) {
if ($this->__active === true) {
$this->__start();
return parent::read($name);
@ -144,9 +140,8 @@ class SessionComponent extends CakeSession {
*
* @param string $name the name of the session key you want to delete
* @return boolean true is session variable is set and can be deleted, false is variable was not set.
* @access public
*/
function delete($name) {
public function delete($name) {
if ($this->__active === true) {
$this->__start();
return parent::delete($name);
@ -161,9 +156,8 @@ class SessionComponent extends CakeSession {
*
* @param string $name the name of the session key you want to check
* @return boolean true is session variable is set, false if not
* @access public
*/
function check($name) {
public function check($name) {
if ($this->__active === true) {
$this->__start();
return parent::check($name);
@ -177,9 +171,8 @@ class SessionComponent extends CakeSession {
* In your controller: $this->Session->error();
*
* @return string Last session error
* @access public
*/
function error() {
public function error() {
if ($this->__active === true) {
$this->__start();
return parent::error();
@ -198,9 +191,8 @@ class SessionComponent extends CakeSession {
* @param string $element Element to wrap flash message in.
* @param array $params Parameters to be sent to layout as view variables
* @param string $key Message key, default is 'flash'
* @access public
*/
function setFlash($message, $element = 'default', $params = array(), $key = 'flash') {
public function setFlash($message, $element = 'default', $params = array(), $key = 'flash') {
if ($this->__active === true) {
$this->__start();
$this->write('Message.' . $key, compact('message', 'element', 'params'));
@ -213,9 +205,8 @@ class SessionComponent extends CakeSession {
* In your controller: $this->Session->renew();
*
* @return void
* @access public
*/
function renew() {
public function renew() {
if ($this->__active === true) {
$this->__start();
parent::renew();
@ -228,9 +219,8 @@ class SessionComponent extends CakeSession {
* In your controller: $this->Session->valid();
*
* @return boolean true is session is valid, false is session is invalid
* @access public
*/
function valid() {
public function valid() {
if ($this->__active === true) {
$this->__start();
return parent::valid();
@ -244,9 +234,8 @@ class SessionComponent extends CakeSession {
* In your controller: $this->Session->destroy();
*
* @return void
* @access public
*/
function destroy() {
public function destroy() {
if ($this->__active === true) {
$this->__start();
parent::destroy();
@ -261,9 +250,8 @@ class SessionComponent extends CakeSession {
*
* @param $id string
* @return string
* @access public
*/
function id($id = null) {
public function id($id = null) {
return parent::id($id);
}

View file

@ -519,9 +519,8 @@ class Controller extends Object {
* - triggers Component `startup` methods.
*
* @return void
* @access public
*/
function startupProcess() {
public function startupProcess() {
$this->Component->initialize($this);
$this->beforeFilter();
$this->Component->triggerCallback('startup', $this);
@ -535,9 +534,8 @@ class Controller extends Object {
* - calls the Controller's `afterFilter` method.
*
* @return void
* @access public
*/
function shutdownProcess() {
public function shutdownProcess() {
$this->Component->triggerCallback('shutdown', $this);
$this->afterFilter();
}
@ -608,9 +606,8 @@ class Controller extends Object {
* @param string $modelClass Name of model class to load
* @param mixed $id Initial ID the instanced model class should have
* @return mixed true when single model found and instance created error returned if models not found.
* @access public
*/
function loadModel($modelClass = null, $id = null) {
public function loadModel($modelClass = null, $id = null) {
if ($modelClass === null) {
$modelClass = $this->modelClass;
}
@ -738,9 +735,8 @@ class Controller extends Object {
*
* @param string $status The header message that is being set.
* @return void
* @access public
*/
function header($status) {
public function header($status) {
header($status);
}
@ -783,9 +779,8 @@ class Controller extends Object {
* @param mixed Any other parameters passed to this method will be passed as
* parameters to the new action.
* @return mixed Returns the return value of the called action
* @access public
*/
function setAction($action) {
public function setAction($action) {
$this->action = $action;
$args = func_get_args();
unset($args[0]);
@ -811,9 +806,8 @@ class Controller extends Object {
* Returns number of errors in a submitted FORM.
*
* @return integer Number of errors
* @access public
*/
function validate() {
public function validate() {
$args = func_get_args();
$errors = call_user_func_array(array(&$this, 'validateErrors'), $args);
@ -830,9 +824,8 @@ class Controller extends Object {
*
* @param mixed A list of models as a variable argument
* @return array Validation errors, or false if none
* @access public
*/
function validateErrors() {
public function validateErrors() {
$objects = func_get_args();
if (empty($objects)) {

View file

@ -58,9 +58,8 @@ class PagesController extends AppController {
* Displays a view
*
* @param mixed What page to display
* @access public
*/
function display() {
public function display() {
$path = func_get_args();
$count = count($path);

View file

@ -242,9 +242,8 @@ class Debugger extends Object {
* @param integer $line Line that triggered the error
* @param array $context Context
* @return boolean true if error was handled
* @access public
*/
function handleError($code, $description, $file = null, $line = null, $context = null) {
public function handleError($code, $description, $file = null, $line = null, $context = null) {
if (error_reporting() == 0 || $code === 2048 || $code === 8192) {
return;
}

View file

@ -129,9 +129,8 @@ class ErrorHandler extends Object {
* Displays an error page (e.g. 404 Not found).
*
* @param array $params Parameters for controller
* @access public
*/
function error($params) {
public function error($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->set(array(
'code' => $code,
@ -146,9 +145,8 @@ class ErrorHandler extends Object {
* Convenience method to display a 404 page.
*
* @param array $params Parameters for controller
* @access public
*/
function error404($params) {
public function error404($params) {
extract($params, EXTR_OVERWRITE);
if (!isset($url)) {
@ -169,9 +167,8 @@ class ErrorHandler extends Object {
* Convenience method to display a 500 page.
*
* @param array $params Parameters for controller
* @access public
*/
function error500($params) {
public function error500($params) {
extract($params, EXTR_OVERWRITE);
if (!isset($url)) {
@ -191,9 +188,8 @@ class ErrorHandler extends Object {
* Renders the Missing Controller web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingController($params) {
public function missingController($params) {
extract($params, EXTR_OVERWRITE);
$controllerName = str_replace('Controller', '', $className);
@ -209,9 +205,8 @@ class ErrorHandler extends Object {
* Renders the Missing Action web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingAction($params) {
public function missingAction($params) {
extract($params, EXTR_OVERWRITE);
$controllerName = str_replace('Controller', '', $className);
@ -228,9 +223,8 @@ class ErrorHandler extends Object {
* Renders the Private Action web page.
*
* @param array $params Parameters for controller
* @access public
*/
function privateAction($params) {
public function privateAction($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->set(array(
@ -245,9 +239,8 @@ class ErrorHandler extends Object {
* Renders the Missing Table web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingTable($params) {
public function missingTable($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->header("HTTP/1.0 500 Internal Server Error");
@ -264,9 +257,8 @@ class ErrorHandler extends Object {
* Renders the Missing Database web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingDatabase($params = array()) {
public function missingDatabase($params = array()) {
$this->controller->header("HTTP/1.0 500 Internal Server Error");
$this->controller->set(array(
'code' => '500',
@ -279,9 +271,8 @@ class ErrorHandler extends Object {
* Renders the Missing View web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingView($params) {
public function missingView($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->set(array(
@ -297,9 +288,8 @@ class ErrorHandler extends Object {
* Renders the Missing Layout web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingLayout($params) {
public function missingLayout($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->layout = 'default';
@ -314,9 +304,8 @@ class ErrorHandler extends Object {
* Renders the Database Connection web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingConnection($params) {
public function missingConnection($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->header("HTTP/1.0 500 Internal Server Error");
@ -332,9 +321,8 @@ class ErrorHandler extends Object {
* Renders the Missing Helper file web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingHelperFile($params) {
public function missingHelperFile($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->set(array(
@ -349,9 +337,8 @@ class ErrorHandler extends Object {
* Renders the Missing Helper class web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingHelperClass($params) {
public function missingHelperClass($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->set(array(
@ -366,9 +353,8 @@ class ErrorHandler extends Object {
* Renders the Missing Behavior file web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingBehaviorFile($params) {
public function missingBehaviorFile($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->set(array(
@ -383,9 +369,8 @@ class ErrorHandler extends Object {
* Renders the Missing Behavior class web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingBehaviorClass($params) {
public function missingBehaviorClass($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->set(array(
@ -400,9 +385,8 @@ class ErrorHandler extends Object {
* Renders the Missing Component file web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingComponentFile($params) {
public function missingComponentFile($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->set(array(
@ -418,9 +402,8 @@ class ErrorHandler extends Object {
* Renders the Missing Component class web page.
*
* @param array $params Parameters for controller
* @access public
*/
function missingComponentClass($params) {
public function missingComponentClass($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->set(array(
@ -436,9 +419,8 @@ class ErrorHandler extends Object {
* Renders the Missing Model class web page.
*
* @param unknown_type $params Parameters for controller
* @access public
*/
function missingModel($params) {
public function missingModel($params) {
extract($params, EXTR_OVERWRITE);
$this->controller->set(array(

View file

@ -118,9 +118,8 @@ class File extends Object {
* Creates the File.
*
* @return boolean Success
* @access public
*/
function create() {
public function create() {
$dir = $this->Folder->pwd();
if (is_dir($dir) && is_writable($dir) && !$this->exists()) {
$old = umask(0);
@ -138,9 +137,8 @@ class File extends Object {
* @param string $mode A valid 'fopen' mode string (r|w|a ...)
* @param boolean $force If true then the file will be re-opened even if its already opened, otherwise it won't
* @return boolean True on success, false on failure
* @access public
*/
function open($mode = 'r', $force = false) {
public function open($mode = 'r', $force = false) {
if (!$force && is_resource($this->handle)) {
return true;
}
@ -165,9 +163,8 @@ class File extends Object {
* @param string $mode A `fread` compatible mode.
* @param boolean $force If true then the file will be re-opened even if its already opened, otherwise it won't
* @return mixed string on success, false on failure
* @access public
*/
function read($bytes = false, $mode = 'rb', $force = false) {
public function read($bytes = false, $mode = 'rb', $force = false) {
if ($bytes === false && $this->lock === null) {
return file_get_contents($this->path);
}
@ -202,9 +199,8 @@ class File extends Object {
* @param mixed $offset The $offset in bytes to seek. If set to false then the current offset is returned.
* @param integer $seek PHP Constant SEEK_SET | SEEK_CUR | SEEK_END determining what the $offset is relative to
* @return mixed True on success, false on failure (set mode), false on failure or integer offset on success (get mode)
* @access public
*/
function offset($offset = false, $seek = SEEK_SET) {
public function offset($offset = false, $seek = SEEK_SET) {
if ($offset === false) {
if (is_resource($this->handle)) {
return ftell($this->handle);
@ -222,9 +218,8 @@ class File extends Object {
*
* @param string $data Data to prepare for writing.
* @return string The with converted line endings.
* @access public
*/
function prepare($data, $forceWindows = false) {
public function prepare($data, $forceWindows = false) {
$lineBreak = "\n";
if (DIRECTORY_SEPARATOR == '\\' || $forceWindows === true) {
$lineBreak = "\r\n";
@ -239,9 +234,8 @@ class File extends Object {
* @param string $mode Mode of writing. {@link http://php.net/fwrite See fwrite()}.
* @param string $force force the file to open
* @return boolean Success
* @access public
*/
function write($data, $mode = 'w', $force = false) {
public function write($data, $mode = 'w', $force = false) {
$success = false;
if ($this->open($mode, $force) === true) {
if ($this->lock !== null) {
@ -266,9 +260,8 @@ class File extends Object {
* @param string $data Data to write
* @param string $force force the file to open
* @return boolean Success
* @access public
*/
function append($data, $force = false) {
public function append($data, $force = false) {
return $this->write($data, 'a', $force);
}
@ -276,9 +269,8 @@ class File extends Object {
* Closes the current file if it is opened.
*
* @return boolean True if closing was successful or file was already closed, otherwise false
* @access public
*/
function close() {
public function close() {
if (!is_resource($this->handle)) {
return true;
}
@ -289,9 +281,8 @@ class File extends Object {
* Deletes the File.
*
* @return boolean Success
* @access public
*/
function delete() {
public function delete() {
clearstatcache();
if ($this->exists()) {
return unlink($this->path);
@ -303,9 +294,8 @@ class File extends Object {
* Returns the File info.
*
* @return string The File extension
* @access public
*/
function info() {
public function info() {
if ($this->info == null) {
$this->info = pathinfo($this->path);
}
@ -319,9 +309,8 @@ class File extends Object {
* Returns the File extension.
*
* @return string The File extension
* @access public
*/
function ext() {
public function ext() {
if ($this->info == null) {
$this->info();
}
@ -335,9 +324,8 @@ class File extends Object {
* Returns the File name without extension.
*
* @return string The File name without extension.
* @access public
*/
function name() {
public function name() {
if ($this->info == null) {
$this->info();
}
@ -355,9 +343,8 @@ class File extends Object {
* @param string $name The name of the file to make safe if different from $this->name
* @param strin $ext The name of the extension to make safe if different from $this->ext
* @return string $ext the extension of the file
* @access public
*/
function safe($name = null, $ext = null) {
public function safe($name = null, $ext = null) {
if (!$name) {
$name = $this->name;
}
@ -372,9 +359,8 @@ class File extends Object {
*
* @param mixed $maxsize in MB or true to force
* @return string md5 Checksum {@link http://php.net/md5_file See md5_file()}
* @access public
*/
function md5($maxsize = 5) {
public function md5($maxsize = 5) {
if ($maxsize === true) {
return md5_file($this->path);
}
@ -391,9 +377,8 @@ class File extends Object {
* Returns the full path of the File.
*
* @return string Full path to file
* @access public
*/
function pwd() {
public function pwd() {
if (is_null($this->path)) {
$this->path = $this->Folder->slashTerm($this->Folder->pwd()) . $this->name;
}
@ -404,9 +389,8 @@ class File extends Object {
* Returns true if the File exists.
*
* @return boolean true if it exists, false otherwise
* @access public
*/
function exists() {
public function exists() {
return (file_exists($this->path) && is_file($this->path));
}
@ -414,9 +398,8 @@ class File extends Object {
* Returns the "chmod" (permissions) of the File.
*
* @return string Permissions for the file
* @access public
*/
function perms() {
public function perms() {
if ($this->exists()) {
return substr(sprintf('%o', fileperms($this->path)), -4);
}
@ -427,9 +410,8 @@ class File extends Object {
* Returns the Filesize
*
* @return integer size of the file in bytes, or false in case of an error
* @access public
*/
function size() {
public function size() {
if ($this->exists()) {
return filesize($this->path);
}
@ -440,9 +422,8 @@ class File extends Object {
* Returns true if the File is writable.
*
* @return boolean true if its writable, false otherwise
* @access public
*/
function writable() {
public function writable() {
return is_writable($this->path);
}
@ -450,9 +431,8 @@ class File extends Object {
* Returns true if the File is executable.
*
* @return boolean true if its executable, false otherwise
* @access public
*/
function executable() {
public function executable() {
return is_executable($this->path);
}
@ -460,9 +440,8 @@ class File extends Object {
* Returns true if the File is readable.
*
* @return boolean true if file is readable, false otherwise
* @access public
*/
function readable() {
public function readable() {
return is_readable($this->path);
}
@ -470,9 +449,8 @@ class File extends Object {
* Returns the File's owner.
*
* @return integer the Fileowner
* @access public
*/
function owner() {
public function owner() {
if ($this->exists()) {
return fileowner($this->path);
}
@ -483,9 +461,8 @@ class File extends Object {
* Returns the File's group.
*
* @return integer the Filegroup
* @access public
*/
function group() {
public function group() {
if ($this->exists()) {
return filegroup($this->path);
}
@ -496,9 +473,8 @@ class File extends Object {
* Returns last access time.
*
* @return integer timestamp Timestamp of last access time
* @access public
*/
function lastAccess() {
public function lastAccess() {
if ($this->exists()) {
return fileatime($this->path);
}
@ -509,9 +485,8 @@ class File extends Object {
* Returns last modified time.
*
* @return integer timestamp Timestamp of last modification
* @access public
*/
function lastChange() {
public function lastChange() {
if ($this->exists()) {
return filemtime($this->path);
}
@ -522,9 +497,8 @@ class File extends Object {
* Returns the current folder.
*
* @return Folder Current folder
* @access public
*/
function &Folder() {
public function &Folder() {
return $this->Folder;
}
@ -534,9 +508,8 @@ class File extends Object {
* @param string $dest destination for the copy
* @param boolean $overwrite Overwrite $dest if exists
* @return boolean Succes
* @access public
*/
function copy($dest, $overwrite = true) {
public function copy($dest, $overwrite = true) {
if (!$this->exists() || is_file($dest) && !$overwrite) {
return false;
}

View file

@ -123,9 +123,8 @@ class Folder extends Object {
* Return current path.
*
* @return string Current path
* @access public
*/
function pwd() {
public function pwd() {
return $this->path;
}
@ -134,9 +133,8 @@ class Folder extends Object {
*
* @param string $path Path to the directory to change to
* @return string The new path. Returns false on failure
* @access public
*/
function cd($path) {
public function cd($path) {
$path = $this->realpath($path);
if (is_dir($path)) {
return $this->path = $path;
@ -153,9 +151,8 @@ class Folder extends Object {
* @param mixed $exceptions Either an array or boolean true will not grab dot files
* @param boolean $fullPath True returns the full path
* @return mixed Contents of current directory as an array, an empty array on failure
* @access public
*/
function read($sort = true, $exceptions = false, $fullPath = false) {
public function read($sort = true, $exceptions = false, $fullPath = false) {
$dirs = $files = array();
if (!$this->pwd()) {
@ -198,9 +195,8 @@ class Folder extends Object {
* @param string $pattern Preg_match pattern (Defaults to: .*)
* @param boolean $sort Whether results should be sorted.
* @return array Files that match given pattern
* @access public
*/
function find($regexpPattern = '.*', $sort = false) {
public function find($regexpPattern = '.*', $sort = false) {
list($dirs, $files) = $this->read($sort);
return array_values(preg_grep('/^' . $regexpPattern . '$/i', $files)); ;
}
@ -211,9 +207,8 @@ class Folder extends Object {
* @param string $pattern Preg_match pattern (Defaults to: .*)
* @param boolean $sort Whether results should be sorted.
* @return array Files matching $pattern
* @access public
*/
function findRecursive($pattern = '.*', $sort = false) {
public function findRecursive($pattern = '.*', $sort = false) {
if (!$this->pwd()) {
return array();
}
@ -330,9 +325,8 @@ class Folder extends Object {
*
* @param string $path The path to check.
* @return bool
* @access public
*/
function inCakePath($path = '') {
public function inCakePath($path = '') {
$dir = substr(Folder::slashTerm(ROOT), 0, -1);
$newdir = $dir . $path;
@ -345,9 +339,8 @@ class Folder extends Object {
* @param string $path The path to check that the current pwd() resides with in.
* @param boolean $reverse
* @return bool
* @access public
*/
function inPath($path = '', $reverse = false) {
public function inPath($path = '', $reverse = false) {
$dir = Folder::slashTerm($path);
$current = Folder::slashTerm($this->pwd());
@ -367,9 +360,8 @@ class Folder extends Object {
* @param boolean $recursive chmod recursively, set to false to only change the current directory.
* @param array $exceptions array of files, directories to skip
* @return boolean Returns TRUE on success, FALSE on failure
* @access public
*/
function chmod($path, $mode = false, $recursive = true, $exceptions = array()) {
public function chmod($path, $mode = false, $recursive = true, $exceptions = array()) {
if (!$mode) {
$mode = $this->mode;
}
@ -418,9 +410,8 @@ class Folder extends Object {
* @param mixed $exceptions Array of files to exclude, defaults to excluding hidden files.
* @param string $type either file or dir. null returns both files and directories
* @return mixed array of nested directories and files in each directory
* @access public
*/
function tree($path, $exceptions = true, $type = null) {
public function tree($path, $exceptions = true, $type = null) {
$original = $this->path;
$path = rtrim($path, DS);
if (!$this->cd($path)) {
@ -474,9 +465,8 @@ class Folder extends Object {
* @param string $pathname The directory structure to create
* @param integer $mode octal value 0755
* @return boolean Returns TRUE on success, FALSE on failure
* @access public
*/
function create($pathname, $mode = false) {
public function create($pathname, $mode = false) {
if (is_dir($pathname) || empty($pathname)) {
return true;
}
@ -513,9 +503,8 @@ class Folder extends Object {
*
* @param string $directory Path to directory
* @return int size in bytes of current folder
* @access public
*/
function dirsize() {
public function dirsize() {
$size = 0;
$directory = Folder::slashTerm($this->path);
$stack = array($directory);
@ -550,9 +539,8 @@ class Folder extends Object {
*
* @param string $path Path of directory to delete
* @return boolean Success
* @access public
*/
function delete($path = null) {
public function delete($path = null) {
if (!$path) {
$path = $this->pwd();
}
@ -607,9 +595,8 @@ class Folder extends Object {
*
* @param mixed $options Either an array of options (see above) or a string of the destination directory.
* @return bool Success
* @access public
*/
function copy($options = array()) {
public function copy($options = array()) {
if (!$this->pwd()) {
return false;
}
@ -693,9 +680,8 @@ class Folder extends Object {
*
* @param array $options (to, from, chmod, skip)
* @return boolean Success
* @access public
*/
function move($options) {
public function move($options) {
$to = null;
if (is_string($options)) {
$to = $options;
@ -715,9 +701,8 @@ class Folder extends Object {
* get messages from latest method
*
* @return array
* @access public
*/
function messages() {
public function messages() {
return $this->__messages;
}
@ -725,9 +710,8 @@ class Folder extends Object {
* get error from latest method
*
* @return array
* @access public
*/
function errors() {
public function errors() {
return $this->__errors;
}

View file

@ -160,9 +160,8 @@ class HttpSocket extends CakeSocket {
* See HttpSocket::$config for options that can be used.
*
* @param mixed $config Configuration information, either a string url or an array of options.
* @access public
*/
function __construct($config = array()) {
public function __construct($config = array()) {
if (is_string($config)) {
$this->_configUri($config);
} elseif (is_array($config)) {
@ -181,9 +180,8 @@ class HttpSocket extends CakeSocket {
*
* @param mixed $request Either an URI string, or an array defining host/uri
* @return mixed false on error, request body on success
* @access public
*/
function request($request = array()) {
public function request($request = array()) {
$this->reset(false);
if (is_string($request)) {
@ -308,9 +306,8 @@ class HttpSocket extends CakeSocket {
* @param array $query Querystring parameters to append to URI
* @param array $request An indexed array with indexes such as 'method' or uri
* @return mixed Result of request, either false on failure or the response to the request.
* @access public
*/
function get($uri = null, $query = array(), $request = array()) {
public function get($uri = null, $query = array(), $request = array()) {
if (!empty($query)) {
$uri = $this->_parseUri($uri);
if (isset($uri['query'])) {
@ -341,9 +338,8 @@ class HttpSocket extends CakeSocket {
* @param array $data Array of POST data keys and values.
* @param array $request An indexed array with indexes such as 'method' or uri
* @return mixed Result of request, either false on failure or the response to the request.
* @access public
*/
function post($uri = null, $data = array(), $request = array()) {
public function post($uri = null, $data = array(), $request = array()) {
$request = Set::merge(array('method' => 'POST', 'uri' => $uri, 'body' => $data), $request);
return $this->request($request);
}
@ -355,9 +351,8 @@ class HttpSocket extends CakeSocket {
* @param array $data Array of PUT data keys and values.
* @param array $request An indexed array with indexes such as 'method' or uri
* @return mixed Result of request
* @access public
*/
function put($uri = null, $data = array(), $request = array()) {
public function put($uri = null, $data = array(), $request = array()) {
$request = Set::merge(array('method' => 'PUT', 'uri' => $uri, 'body' => $data), $request);
return $this->request($request);
}
@ -369,9 +364,8 @@ class HttpSocket extends CakeSocket {
* @param array $data Query to append to URI
* @param array $request An indexed array with indexes such as 'method' or uri
* @return mixed Result of request
* @access public
*/
function delete($uri = null, $data = array(), $request = array()) {
public function delete($uri = null, $data = array(), $request = array()) {
$request = Set::merge(array('method' => 'DELETE', 'uri' => $uri, 'body' => $data), $request);
return $this->request($request);
}
@ -402,9 +396,8 @@ class HttpSocket extends CakeSocket {
* @param mixed $url Either a string or array of url options to create a url with.
* @param string $uriTemplate A template string to use for url formatting.
* @return mixed Either false on failure or a string containing the composed url.
* @access public
*/
function url($url = null, $uriTemplate = null) {
public function url($url = null, $uriTemplate = null) {
if (is_null($url)) {
$url = '/';
}
@ -1042,9 +1035,8 @@ class HttpSocket extends CakeSocket {
*
* @param boolean $full If set to false only HttpSocket::response and HttpSocket::request are reseted
* @return boolean True on success
* @access public
*/
function reset($full = true) {
public function reset($full = true) {
static $initalState = array();
if (empty($initalState)) {
$initalState = get_class_vars(__CLASS__);

View file

@ -103,9 +103,8 @@ class I18n extends Object {
* Return a static instance of the I18n class
*
* @return object I18n
* @access public
*/
function &getInstance() {
public function &getInstance() {
static $instance = array();
if (!$instance) {
$instance[0] =& new I18n();
@ -124,9 +123,8 @@ class I18n extends Object {
* @param string $category Category The integer value of the category to use.
* @param integer $count Count Count is used with $plural to choose the correct plural form.
* @return string translated string.
* @access public
*/
function translate($singular, $plural = null, $domain = null, $category = 6, $count = null) {
public function translate($singular, $plural = null, $domain = null, $category = 6, $count = null) {
$_this =& I18n::getInstance();
if (strpos($singular, "\r\n") !== false) {

View file

@ -255,9 +255,8 @@ class Inflector {
* Gets a reference to the Inflector object instance
*
* @return object
* @access public
*/
function &getInstance() {
public function &getInstance() {
static $instance = array();
if (!$instance) {

View file

@ -340,9 +340,8 @@ class L10n extends Object {
* the method will get the settings from L10n::__setLanguage();
*
* @param string $language Language (if null will use DEFAULT_LANGUAGE if defined)
* @access public
*/
function get($language = null) {
public function get($language = null) {
if ($language !== null) {
return $this->__setLanguage($language);
} elseif ($this->__autoLanguage() === false) {
@ -434,9 +433,8 @@ class L10n extends Object {
* @param mixed $mixed 2/3 char string (language/locale), array of those strings, or null
* @return mixed string language/locale, array of those values, whole map as an array,
* or false when language/locale doesn't exist
* @access public
*/
function map($mixed = null) {
public function map($mixed = null) {
if (is_array($mixed)) {
$result = array();
foreach ($mixed as $_mixed) {
@ -462,9 +460,8 @@ class L10n extends Object {
* @param mixed $language string requested language, array of requested languages, or null for whole catalog
* @return mixed array catalog record for requested language, array of catalog records, whole catalog,
* or false when language doesn't exist
* @access public
*/
function catalog($language = null) {
public function catalog($language = null) {
if (is_array($language)) {
$result = array();
foreach ($language as $_language) {

View file

@ -78,9 +78,8 @@ class MagicDb extends Object {
*
* @param string $data A MagicDb string to turn into an array
* @return array A parsed MagicDb array or an empty array if the $data param was invalid. Returns the db property if $data is not set.
* @access public
*/
function toArray($data = null) {
public function toArray($data = null) {
if (is_array($data)) {
return $data;
}
@ -132,9 +131,8 @@ class MagicDb extends Object {
*
* @param mixed $magicDb A $magicDb string / array to validate (optional)
* @return boolean True if the $magicDb / instance db validates, false if not
* @access public
*/
function validates($magicDb = null) {
public function validates($magicDb = null) {
if (is_null($magicDb)) {
$magicDb = $this->db;
} elseif (!is_array($magicDb)) {
@ -150,9 +148,8 @@ class MagicDb extends Object {
* @param string $file Absolute path to the file to analyze
* @param array $options TBT
* @return mixed
* @access public
*/
function analyze($file, $options = array()) {
public function analyze($file, $options = array()) {
if (!is_string($file)) {
return false;
}
@ -201,9 +198,8 @@ class MagicFileResource extends Object{
*
* @param unknown $file
* @return void
* @access public
*/
function __construct($file) {
public function __construct($file) {
if (file_exists($file)) {
$this->resource =& new File($file);
} else {
@ -216,9 +212,8 @@ class MagicFileResource extends Object{
*
* @param unknown $magic
* @return void
* @access public
*/
function test($magic) {
public function test($magic) {
$offset = null;
$type = null;
$expected = null;
@ -245,9 +240,8 @@ class MagicFileResource extends Object{
* @param unknown $type
* @param unknown $length
* @return void
* @access public
*/
function read($length = null) {
public function read($length = null) {
if (!is_object($this->resource)) {
return substr($this->resource, $this->offset, $length);
}
@ -260,9 +254,8 @@ class MagicFileResource extends Object{
* @param unknown $type
* @param unknown $expected
* @return void
* @access public
*/
function extract($offset, $type, $expected) {
public function extract($offset, $type, $expected) {
switch ($type) {
case 'string':
$this->offset($offset);
@ -280,9 +273,8 @@ class MagicFileResource extends Object{
* @param unknown $offset
* @param unknown $whence
* @return void
* @access public
*/
function offset($offset = null) {
public function offset($offset = null) {
if (is_null($offset)) {
if (!is_object($this->resource)) {
return $this->offset;

View file

@ -41,9 +41,8 @@ class AclBehavior extends ModelBehavior {
*
* @param mixed $config
* @return void
* @access public
*/
function setup(&$model, $config = array()) {
public function setup(&$model, $config = array()) {
if (is_string($config)) {
$config = array('type' => $config);
}
@ -68,9 +67,8 @@ class AclBehavior extends ModelBehavior {
*
* @param mixed $ref
* @return array
* @access public
*/
function node(&$model, $ref = null) {
public function node(&$model, $ref = null) {
$type = $this->__typeMaps[strtolower($this->settings[$model->name]['type'])];
if (empty($ref)) {
$ref = array('model' => $model->name, 'foreign_key' => $model->id);
@ -83,9 +81,8 @@ class AclBehavior extends ModelBehavior {
*
* @param boolean $created True if this is a new record
* @return void
* @access public
*/
function afterSave(&$model, $created) {
public function afterSave(&$model, $created) {
$type = $this->__typeMaps[strtolower($this->settings[$model->alias]['type'])];
$parent = $model->parentNode();
if (!empty($parent)) {
@ -108,9 +105,8 @@ class AclBehavior extends ModelBehavior {
* Destroys the ARO/ACO node bound to the deleted record
*
* @return void
* @access public
*/
function afterDelete(&$model) {
public function afterDelete(&$model) {
$type = $this->__typeMaps[strtolower($this->settings[$model->name]['type'])];
$node = Set::extract($this->node($model), "0.{$type}.id");
if (!empty($node)) {

View file

@ -61,9 +61,8 @@ class ContainableBehavior extends ModelBehavior {
*
* @param object $Model Model using the behavior
* @param array $settings Settings to override for model.
* @access public
*/
function setup(&$Model, $settings = array()) {
public function setup(&$Model, $settings = array()) {
if (!isset($this->settings[$Model->alias])) {
$this->settings[$Model->alias] = array('recursive' => true, 'notices' => true, 'autoFields' => true);
}
@ -93,9 +92,8 @@ class ContainableBehavior extends ModelBehavior {
* @param object $Model Model using the behavior
* @param array $query Query parameters as set by cake
* @return array
* @access public
*/
function beforeFind(&$Model, $query) {
public function beforeFind(&$Model, $query) {
$reset = (isset($query['reset']) ? $query['reset'] : true);
$noContain = ((isset($this->runtime[$Model->alias]['contain']) && empty($this->runtime[$Model->alias]['contain'])) || (isset($query['contain']) && empty($query['contain'])));
$contain = array();
@ -214,9 +212,8 @@ class ContainableBehavior extends ModelBehavior {
* @param object $Model Model on which we are resetting
* @param array $results Results of the find operation
* @param bool $primary true if this is the primary model that issued the find operation, false otherwise
* @access public
*/
function afterFind(&$Model, $results, $primary) {
public function afterFind(&$Model, $results, $primary) {
if (!empty($Model->__backContainableAssociation)) {
foreach ($Model->__backContainableAssociation as $relation => $bindings) {
$Model->{$relation} = $bindings;
@ -231,9 +228,8 @@ class ContainableBehavior extends ModelBehavior {
*
* @param object $Model Model on which binding restriction is being applied
* @return void
* @access public
*/
function contain(&$Model) {
public function contain(&$Model) {
$args = func_get_args();
$contain = call_user_func_array('am', array_slice($args, 1));
$this->runtime[$Model->alias]['contain'] = $contain;
@ -246,9 +242,8 @@ class ContainableBehavior extends ModelBehavior {
*
* @param object $Model Model on which to reset bindings
* @return void
* @access public
*/
function resetBindings(&$Model) {
public function resetBindings(&$Model) {
if (!empty($Model->__backOriginalAssociation)) {
$Model->__backAssociation = $Model->__backOriginalAssociation;
unset($Model->__backOriginalAssociation);
@ -271,9 +266,8 @@ class ContainableBehavior extends ModelBehavior {
* @param array $containments Current set of containments
* @param bool $throwErrors Wether unexisting bindings show throw errors
* @return array Containments
* @access public
*/
function containments(&$Model, $contain, $containments = array(), $throwErrors = null) {
public function containments(&$Model, $contain, $containments = array(), $throwErrors = null) {
$options = array('className', 'joinTable', 'with', 'foreignKey', 'associationForeignKey', 'conditions', 'fields', 'order', 'limit', 'offset', 'unique', 'finderQuery', 'deleteQuery', 'insertQuery');
$keep = array();
$depth = array();
@ -375,9 +369,8 @@ class ContainableBehavior extends ModelBehavior {
* @param array $map Map of relations for given model
* @param mixed $fields If array, fields to initially load, if false use $Model as primary model
* @return array Fields
* @access public
*/
function fieldDependencies(&$Model, $map, $fields = array()) {
public function fieldDependencies(&$Model, $map, $fields = array()) {
if ($fields === false) {
foreach ($map as $parent => $children) {
foreach ($children as $type => $bindings) {
@ -421,9 +414,8 @@ class ContainableBehavior extends ModelBehavior {
*
* @param array $containments Containments
* @return array Built containments
* @access public
*/
function containmentsMap($containments) {
public function containmentsMap($containments) {
$map = array();
foreach ($containments['models'] as $name => $model) {
$instance =& $model['instance'];

View file

@ -46,9 +46,8 @@ class TranslateBehavior extends ModelBehavior {
*
* @param array $config
* @return mixed
* @access public
*/
function setup(&$model, $config = array()) {
public function setup(&$model, $config = array()) {
$db =& ConnectionManager::getDataSource($model->useDbConfig);
if (!$db->connected) {
trigger_error(
@ -68,9 +67,8 @@ class TranslateBehavior extends ModelBehavior {
* Callback
*
* @return void
* @access public
*/
function cleanup(&$model) {
public function cleanup(&$model) {
$this->unbindTranslation($model);
unset($this->settings[$model->alias]);
unset($this->runtime[$model->alias]);
@ -81,9 +79,8 @@ class TranslateBehavior extends ModelBehavior {
*
* @param array $query
* @return array Modified query
* @access public
*/
function beforeFind(&$model, $query) {
public function beforeFind(&$model, $query) {
$locale = $this->_getLocale($model);
if (empty($locale)) {
return $query;
@ -207,9 +204,8 @@ class TranslateBehavior extends ModelBehavior {
* @param array $results
* @param boolean $primary
* @return array Modified results
* @access public
*/
function afterFind(&$model, $results, $primary) {
public function afterFind(&$model, $results, $primary) {
$this->runtime[$model->alias]['fields'] = array();
$locale = $this->_getLocale($model);
@ -250,9 +246,8 @@ class TranslateBehavior extends ModelBehavior {
* beforeValidate Callback
*
* @return boolean
* @access public
*/
function beforeValidate(&$model) {
public function beforeValidate(&$model) {
$locale = $this->_getLocale($model);
if (empty($locale)) {
return true;
@ -284,9 +279,8 @@ class TranslateBehavior extends ModelBehavior {
*
* @param boolean $created
* @return void
* @access public
*/
function afterSave(&$model, $created) {
public function afterSave(&$model, $created) {
if (!isset($this->runtime[$model->alias]['beforeSave'])) {
return true;
}
@ -327,9 +321,8 @@ class TranslateBehavior extends ModelBehavior {
* afterDelete Callback
*
* @return void
* @access public
*/
function afterDelete(&$model) {
public function afterDelete(&$model) {
$RuntimeModel =& $this->translateModel($model);
$conditions = array('model' => $model->alias, 'foreign_key' => $model->id);
$RuntimeModel->deleteAll($conditions);
@ -358,9 +351,8 @@ class TranslateBehavior extends ModelBehavior {
* Get instance of model for translations
*
* @return object
* @access public
*/
function &translateModel(&$model) {
public function &translateModel(&$model) {
if (!isset($this->runtime[$model->alias]['model'])) {
if (!isset($model->translateModel) || empty($model->translateModel)) {
$className = 'I18nModel';

View file

@ -55,9 +55,8 @@ class TreeBehavior extends ModelBehavior {
* @param object $Model instance of model
* @param array $config array of configuration settings.
* @return void
* @access public
*/
function setup(&$Model, $config = array()) {
public function setup(&$Model, $config = array()) {
if (!is_array($config)) {
$config = array('type' => $config);
}
@ -81,9 +80,8 @@ class TreeBehavior extends ModelBehavior {
* @param AppModel $Model Model instance.
* @param boolean $created indicates whether the node just saved was created or updated
* @return boolean true on success, false on failure
* @access public
*/
function afterSave(&$Model, $created) {
public function afterSave(&$Model, $created) {
extract($this->settings[$Model->alias]);
if ($created) {
if ((isset($Model->data[$Model->alias][$parent])) && $Model->data[$Model->alias][$parent]) {
@ -102,9 +100,8 @@ class TreeBehavior extends ModelBehavior {
*
* @param AppModel $Model Model instance
* @return boolean true to continue, false to abort the delete
* @access public
*/
function beforeDelete(&$Model) {
public function beforeDelete(&$Model) {
extract($this->settings[$Model->alias]);
list($name, $data) = array($Model->alias, $Model->read());
$data = $data[$name];
@ -135,9 +132,8 @@ class TreeBehavior extends ModelBehavior {
* @since 1.2
* @param AppModel $Model Model instance
* @return boolean true to continue, false to abort the save
* @access public
*/
function beforeSave(&$Model) {
public function beforeSave(&$Model) {
extract($this->settings[$Model->alias]);
$this->_addToWhitelist($Model, array($left, $right));
@ -205,9 +201,8 @@ class TreeBehavior extends ModelBehavior {
* @param mixed $id The ID of the record to read or false to read all top level nodes
* @param boolean $direct whether to count direct, or all, children
* @return integer number of child nodes
* @access public
*/
function childcount(&$Model, $id = null, $direct = false) {
public function childcount(&$Model, $id = null, $direct = false) {
if (is_array($id)) {
extract (array_merge(array('id' => null), $id));
}
@ -251,9 +246,8 @@ class TreeBehavior extends ModelBehavior {
* @param integer $page Page number, for accessing paged data
* @param integer $recursive The number of levels deep to fetch associated records
* @return array Array of child nodes
* @access public
*/
function children(&$Model, $id = null, $direct = false, $fields = null, $order = null, $limit = null, $page = 1, $recursive = null) {
public function children(&$Model, $id = null, $direct = false, $fields = null, $order = null, $limit = null, $page = 1, $recursive = null) {
if (is_array($id)) {
extract (array_merge(array('id' => null), $id));
}
@ -308,9 +302,8 @@ class TreeBehavior extends ModelBehavior {
* @param string $spacer The character or characters which will be repeated
* @param integer $recursive The number of levels deep to fetch associated records
* @return array An associative array of records, where the id is the key, and the display field is the value
* @access public
*/
function generatetreelist(&$Model, $conditions = null, $keyPath = null, $valuePath = null, $spacer = '_', $recursive = null) {
public function generatetreelist(&$Model, $conditions = null, $keyPath = null, $valuePath = null, $spacer = '_', $recursive = null) {
$overrideRecursive = $recursive;
extract($this->settings[$Model->alias]);
if (!is_null($overrideRecursive)) {
@ -363,9 +356,8 @@ class TreeBehavior extends ModelBehavior {
* @param mixed $id The ID of the record to read
* @param integer $recursive The number of levels deep to fetch associated records
* @return array Array of data for the parent node
* @access public
*/
function getparentnode(&$Model, $id = null, $fields = null, $recursive = null) {
public function getparentnode(&$Model, $id = null, $fields = null, $recursive = null) {
if (is_array($id)) {
extract (array_merge(array('id' => null), $id));
}
@ -396,9 +388,8 @@ class TreeBehavior extends ModelBehavior {
* @param mixed $fields Either a single string of a field name, or an array of field names
* @param integer $recursive The number of levels deep to fetch associated records
* @return array Array of nodes from top most parent to current node
* @access public
*/
function getpath(&$Model, $id = null, $fields = null, $recursive = null) {
public function getpath(&$Model, $id = null, $fields = null, $recursive = null) {
if (is_array($id)) {
extract (array_merge(array('id' => null), $id));
}
@ -433,9 +424,8 @@ class TreeBehavior extends ModelBehavior {
* @param mixed $id The ID of the record to move
* @param mixed $number how many places to move the node or true to move to last position
* @return boolean true on success, false on failure
* @access public
*/
function movedown(&$Model, $id = null, $number = 1) {
public function movedown(&$Model, $id = null, $number = 1) {
if (is_array($id)) {
extract (array_merge(array('id' => null), $id));
}
@ -491,9 +481,8 @@ class TreeBehavior extends ModelBehavior {
* @param mixed $id The ID of the record to move
* @param mixed $number how many places to move the node, or true to move to first position
* @return boolean true on success, false on failure
* @access public
*/
function moveup(&$Model, $id = null, $number = 1) {
public function moveup(&$Model, $id = null, $number = 1) {
if (is_array($id)) {
extract (array_merge(array('id' => null), $id));
}
@ -555,9 +544,8 @@ class TreeBehavior extends ModelBehavior {
* @param mixed $missingParentAction 'return' to do nothing and return, 'delete' to
* delete, or the id of the parent to set as the parent_id
* @return boolean true on success, false on failure
* @access public
*/
function recover(&$Model, $mode = 'parent', $missingParentAction = null) {
public function recover(&$Model, $mode = 'parent', $missingParentAction = null) {
if (is_array($mode)) {
extract (array_merge(array('mode' => 'parent'), $mode));
}
@ -672,9 +660,8 @@ class TreeBehavior extends ModelBehavior {
* @param mixed $id The ID of the record to remove
* @param boolean $delete whether to delete the node after reparenting children (if any)
* @return boolean true on success, false on failure
* @access public
*/
function removefromtree(&$Model, $id = null, $delete = false) {
public function removefromtree(&$Model, $id = null, $delete = false) {
if (is_array($id)) {
extract (array_merge(array('id' => null), $id));
}
@ -740,9 +727,8 @@ class TreeBehavior extends ModelBehavior {
* @param AppModel $Model Model instance
* @return mixed true if the tree is valid or empty, otherwise an array of (error type [index, node],
* [incorrect left/right index,node id], message)
* @access public
*/
function verify(&$Model) {
public function verify(&$Model) {
extract($this->settings[$Model->alias]);
if (!$Model->find('count', array('conditions' => $scope))) {
return true;

View file

@ -139,9 +139,8 @@ class CakeSchema extends Object {
*
* @param array $events schema object properties
* @return boolean Should process continue
* @access public
*/
function before($event = array()) {
public function before($event = array()) {
return true;
}
@ -149,9 +148,8 @@ class CakeSchema extends Object {
* After callback to be implemented in subclasses
*
* @param array $events schema object properties
* @access public
*/
function after($event = array()) {
public function after($event = array()) {
}
/**
@ -159,9 +157,8 @@ class CakeSchema extends Object {
*
* @param array $options schema object properties
* @return array Set of name and tables
* @access public
*/
function &load($options = array()) {
public function &load($options = array()) {
if (is_string($options)) {
$options = array('path' => $options);
}
@ -198,9 +195,8 @@ class CakeSchema extends Object {
*
* @param array $options schema object properties
* @return array Array indexed by name and tables
* @access public
*/
function read($options = array()) {
public function read($options = array()) {
extract(array_merge(
array(
'connection' => $this->connection,
@ -319,9 +315,8 @@ class CakeSchema extends Object {
* @param mixed $object schema object or options array
* @param array $options schema object properties to override object
* @return mixed false or string written to file
* @access public
*/
function write($object, $options = array()) {
public function write($object, $options = array()) {
if (is_object($object)) {
$object = get_object_vars($object);
$this->_build($object);
@ -427,9 +422,8 @@ class CakeSchema extends Object {
* @param mixed $old Schema object or array
* @param mixed $new Schema object or array
* @return array Tables (that are added, dropped, or changed)
* @access public
*/
function compare($old, $new = null) {
public function compare($old, $new = null) {
if (empty($new)) {
$new =& $this;
}
@ -513,9 +507,8 @@ class CakeSchema extends Object {
*
* @param array $values options keys(type, null, default, key, length, extra)
* @return array Formatted values
* @access public
*/
function __values($values) {
public function __values($values) {
$vals = array();
if (is_array($values)) {
foreach ($values as $key => $val) {
@ -535,9 +528,8 @@ class CakeSchema extends Object {
*
* @param array $Obj model object
* @return array Formatted columns
* @access public
*/
function __columns(&$Obj) {
public function __columns(&$Obj) {
$db =& ConnectionManager::getDataSource($Obj->useDbConfig);
$fields = $Obj->schema(true);
$columns = $props = array();

View file

@ -221,9 +221,8 @@ class DataSource extends Object {
*
* @param mixed $data
* @return array Array of sources available in this datasource.
* @access public
*/
function listSources($data = null) {
public function listSources($data = null) {
if ($this->cacheSources === false) {
return null;
}
@ -250,9 +249,8 @@ class DataSource extends Object {
*
* @param boolean $reset Whether or not the source list should be reset.
* @return array Array of sources available in this datasource
* @access public
*/
function sources($reset = false) {
public function sources($reset = false) {
if ($reset === true) {
$this->_sources = null;
}
@ -264,9 +262,8 @@ class DataSource extends Object {
*
* @param Model $model
* @return array Array of Metadata for the $model
* @access public
*/
function describe(&$model) {
public function describe(&$model) {
if ($this->cacheSources === false) {
return null;
}
@ -288,9 +285,8 @@ class DataSource extends Object {
* Begin a transaction
*
* @return boolean Returns true if a transaction is not in progress
* @access public
*/
function begin(&$model) {
public function begin(&$model) {
return !$this->_transactionStarted;
}
@ -298,9 +294,8 @@ class DataSource extends Object {
* Commit a transaction
*
* @return boolean Returns true if a transaction is in progress
* @access public
*/
function commit(&$model) {
public function commit(&$model) {
return $this->_transactionStarted;
}
@ -308,9 +303,8 @@ class DataSource extends Object {
* Rollback a transaction
*
* @return boolean Returns true if a transaction is in progress
* @access public
*/
function rollback(&$model) {
public function rollback(&$model) {
return $this->_transactionStarted;
}
@ -319,9 +313,8 @@ class DataSource extends Object {
*
* @param string $real Real column type (i.e. "varchar(255)")
* @return string Abstract column type (i.e. "string")
* @access public
*/
function column($real) {
public function column($real) {
return false;
}
@ -334,9 +327,8 @@ class DataSource extends Object {
* @param array $fields An Array of fields to be saved.
* @param array $values An Array of values to save.
* @return boolean success
* @access public
*/
function create(&$model, $fields = null, $values = null) {
public function create(&$model, $fields = null, $values = null) {
return false;
}
@ -348,9 +340,8 @@ class DataSource extends Object {
* @param Model $model The model being read.
* @param array $queryData An array of query data used to find the data you want
* @return mixed
* @access public
*/
function read(&$model, $queryData = array()) {
public function read(&$model, $queryData = array()) {
return false;
}
@ -363,9 +354,8 @@ class DataSource extends Object {
* @param array $fields Array of fields to be updated
* @param array $values Array of values to be update $fields to.
* @return boolean Success
* @access public
*/
function update(&$model, $fields = null, $values = null) {
public function update(&$model, $fields = null, $values = null) {
return false;
}
@ -376,9 +366,8 @@ class DataSource extends Object {
*
* @param Model $model The model class having record(s) deleted
* @param mixed $id Primary key of the model
* @access public
*/
function delete(&$model, $id = null) {
public function delete(&$model, $id = null) {
if ($id == null) {
$id = $model->id;
}
@ -389,9 +378,8 @@ class DataSource extends Object {
*
* @param unknown_type $source
* @return mixed Last ID key generated in previous INSERT
* @access public
*/
function lastInsertId($source = null) {
public function lastInsertId($source = null) {
return false;
}
@ -400,9 +388,8 @@ class DataSource extends Object {
*
* @param unknown_type $source
* @return integer Number of rows returned by last operation
* @access public
*/
function lastNumRows($source = null) {
public function lastNumRows($source = null) {
return false;
}
@ -411,9 +398,8 @@ class DataSource extends Object {
*
* @param unknown_type $source
* @return integer Number of rows affected by last query.
* @access public
*/
function lastAffected($source = null) {
public function lastAffected($source = null) {
return false;
}
@ -423,9 +409,8 @@ class DataSource extends Object {
* before establishing a connection.
*
* @return boolean Whether or not the Datasources conditions for use are met.
* @access public
*/
function enabled() {
public function enabled() {
return true;
}
/**
@ -433,9 +418,8 @@ class DataSource extends Object {
*
* @param string $interface The name of the interface (method)
* @return boolean True on success
* @access public
*/
function isInterfaceSupported($interface) {
public function isInterfaceSupported($interface) {
static $methods = false;
if ($methods === false) {
$methods = array_map('strtolower', get_class_methods($this));
@ -449,9 +433,8 @@ class DataSource extends Object {
*
* @param array $config The configuration array
* @return void
* @access public
*/
function setConfig($config = array()) {
public function setConfig($config = array()) {
$this->config = array_merge($this->_baseConfig, $this->config, $config);
}
@ -572,9 +555,8 @@ class DataSource extends Object {
* @param Model $model Model instance
* @param string $key Key name to make
* @return string Key name for model.
* @access public
*/
function resolveKey(&$model, $key) {
public function resolveKey(&$model, $key) {
return $model->alias . $key;
}
@ -582,9 +564,8 @@ class DataSource extends Object {
* Closes the current datasource.
*
* @return void
* @access public
*/
function __destruct() {
public function __destruct() {
if ($this->_transactionStarted) {
$null = null;
$this->rollback($null);

View file

@ -165,9 +165,8 @@ class DboOracle extends DboSource {
* Connects to the database using options in the given configuration array.
*
* @return boolean True if the database could be connected, else false
* @access public
*/
function connect() {
public function connect() {
$config = $this->config;
$this->connected = false;
$config['charset'] = !empty($config['charset']) ? $config['charset'] : null;
@ -246,9 +245,8 @@ class DboOracle extends DboSource {
* Disconnects from database.
*
* @return boolean True if the database could be disconnected, else false
* @access public
*/
function disconnect() {
public function disconnect() {
if ($this->connection) {
$this->connected = !ocilogoff($this->connection);
return !$this->connected;
@ -311,9 +309,8 @@ class DboOracle extends DboSource {
* @param integer $limit Maximum number of rows to return
* @param integer $offset Row to begin returning
* @return modified SQL Query
* @access public
*/
function limit($limit = -1, $offset = 0) {
public function limit($limit = -1, $offset = 0) {
$this->_limit = (int) $limit;
$this->_offset = (int) $offset;
}
@ -323,9 +320,8 @@ class DboOracle extends DboSource {
* this returns false.
*
* @return integer Number of rows in resultset
* @access public
*/
function lastNumRows() {
public function lastNumRows() {
return $this->_numRows;
}
@ -381,9 +377,8 @@ class DboOracle extends DboSource {
* Enter description here...
*
* @return unknown
* @access public
*/
function fetchRow() {
public function fetchRow() {
if ($this->_currentRow >= $this->_numRows) {
ocifreestatement($this->_statementId);
$this->_map = null;
@ -421,9 +416,8 @@ class DboOracle extends DboSource {
*
* @param string $sequence
* @return bool
* @access public
*/
function sequenceExists($sequence) {
public function sequenceExists($sequence) {
$sql = "SELECT SEQUENCE_NAME FROM USER_SEQUENCES WHERE SEQUENCE_NAME = '$sequence'";
if (!$this->execute($sql)) {
return false;
@ -436,9 +430,8 @@ class DboOracle extends DboSource {
*
* @param string $sequence
* @return bool
* @access public
*/
function createSequence($sequence) {
public function createSequence($sequence) {
$sql = "CREATE SEQUENCE $sequence";
return $this->execute($sql);
}
@ -448,9 +441,8 @@ class DboOracle extends DboSource {
*
* @param unknown_type $table
* @return unknown
* @access public
*/
function createTrigger($table) {
public function createTrigger($table) {
$sql = "CREATE OR REPLACE TRIGGER pk_$table" . "_trigger BEFORE INSERT ON $table FOR EACH ROW BEGIN SELECT pk_$table.NEXTVAL INTO :NEW.ID FROM DUAL; END;";
return $this->execute($sql);
}
@ -460,9 +452,8 @@ class DboOracle extends DboSource {
* raised and the application exits.
*
* @return array tablenames in the database
* @access public
*/
function listSources() {
public function listSources() {
$cache = parent::listSources();
if ($cache != null) {
return $cache;
@ -486,9 +477,8 @@ class DboOracle extends DboSource {
*
* @param object instance of a model to inspect
* @return array Fields in table. Keys are name and type
* @access public
*/
function describe(&$model) {
public function describe(&$model) {
$table = $this->fullTableName($model, false);
if (!empty($model->sequence)) {
@ -744,9 +734,8 @@ class DboOracle extends DboSource {
*
* @param unknown_type $var
* @return unknown
* @access public
*/
function name($name) {
public function name($name) {
if (strpos($name, '.') !== false && strpos($name, '"') === false) {
list($model, $field) = explode('.', $name);
if ($field[0] == "_") {
@ -802,9 +791,8 @@ class DboOracle extends DboSource {
*
* @param string $real Real database-layer column type (i.e. "varchar(255)")
* @return string Abstract column type (i.e. "string")
* @access public
*/
function column($real) {
public function column($real) {
if (is_array($real)) {
$col = $real['name'];
@ -853,9 +841,8 @@ class DboOracle extends DboSource {
*
* @param string $data String to be prepared for use in an SQL statement
* @return string Quoted and escaped
* @access public
*/
function value($data, $column = null, $safe = false) {
public function value($data, $column = null, $safe = false) {
$parent = parent::value($data, $column, $safe);
if ($parent != null) {
@ -894,9 +881,8 @@ class DboOracle extends DboSource {
*
* @param string
* @return integer
* @access public
*/
function lastInsertId($source) {
public function lastInsertId($source) {
$sequence = $this->_sequenceMap[$source];
$sql = "SELECT $sequence.currval FROM dual";
@ -914,9 +900,8 @@ class DboOracle extends DboSource {
* Returns a formatted error message from previous database operation.
*
* @return string Error message with error number
* @access public
*/
function lastError() {
public function lastError() {
return $this->_error;
}
@ -924,9 +909,8 @@ class DboOracle extends DboSource {
* Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
*
* @return int Number of affected rows
* @access public
*/
function lastAffected() {
public function lastAffected() {
return $this->_statementId ? ocirowcount($this->_statementId): false;
}

View file

@ -389,9 +389,8 @@ class DboPostgres extends DboSource {
* @param integer $reset If -1, sequences are dropped, if 0 (default), sequences are reset,
* and if 1, sequences are not modified
* @return boolean SQL TRUNCATE TABLE statement, false if not applicable.
* @access public
*/
function truncate($table, $reset = 0) {
public function truncate($table, $reset = 0) {
if (parent::truncate($table)) {
$table = $this->fullTableName($table, false);
if (isset($this->_sequenceMap[$table]) && $reset !== 1) {

View file

@ -313,9 +313,8 @@ class DboSqlite extends DboSource {
*
* @param mixed $table A string or model class representing the table to be truncated
* @return boolean SQL TRUNCATE TABLE statement, false if not applicable.
* @access public
*/
function truncate($table) {
public function truncate($table) {
return $this->execute('DELETE From ' . $this->fullTableName($table));
}

View file

@ -118,9 +118,8 @@ class DboSource extends DataSource {
*
* @param array $config Array of configuration information for the Datasource.
* @param boolean $autoConnect Whether or not the datasource should automatically connect.
* @access public
*/
function __construct($config = null, $autoConnect = true) {
public function __construct($config = null, $autoConnect = true) {
if (!isset($config['prefix'])) {
$config['prefix'] = '';
}
@ -141,9 +140,8 @@ class DboSource extends DataSource {
*
* @param array $config An array defining the new configuration settings
* @return boolean True on success, false on failure
* @access public
*/
function reconnect($config = null) {
public function reconnect($config = null) {
$this->disconnect();
$this->setConfig($config);
$this->_sources = null;
@ -158,9 +156,8 @@ class DboSource extends DataSource {
* @param string $column The column into which this data will be inserted
* @param boolean $read Value to be used in READ or WRITE context
* @return mixed Prepared value or array of values.
* @access public
*/
function value($data, $column = null, $read = true) {
public function value($data, $column = null, $read = true) {
if (is_array($data) && !empty($data)) {
return array_map(
array(&$this, 'value'),
@ -184,9 +181,8 @@ class DboSource extends DataSource {
*
* @param string $identifier
* @return object An object representing a database identifier to be used in a query
* @access public
*/
function identifier($identifier) {
public function identifier($identifier) {
$obj = new stdClass();
$obj->type = 'identifier';
$obj->value = $identifier;
@ -198,9 +194,8 @@ class DboSource extends DataSource {
*
* @param string $expression
* @return object An object representing a database expression to be used in a query
* @access public
*/
function expression($expression) {
public function expression($expression) {
$obj = new stdClass();
$obj->type = 'expression';
$obj->value = $expression;
@ -212,9 +207,8 @@ class DboSource extends DataSource {
*
* @param string $sql SQL statement
* @return boolean
* @access public
*/
function rawQuery($sql) {
public function rawQuery($sql) {
$this->took = $this->error = $this->numRows = false;
return $this->execute($sql);
}
@ -233,9 +227,8 @@ class DboSource extends DataSource {
* @param string $sql
* @param array $options
* @return mixed Resource or object representing the result set, or false on failure
* @access public
*/
function execute($sql, $options = array()) {
public function execute($sql, $options = array()) {
$defaults = array('stats' => true, 'log' => $this->fullDebug);
$options = array_merge($defaults, $options);
@ -263,9 +256,8 @@ class DboSource extends DataSource {
* DataSource Query abstraction
*
* @return resource Result resource identifier.
* @access public
*/
function query() {
public function query() {
$args = func_get_args();
$fields = null;
$order = null;
@ -360,9 +352,8 @@ class DboSource extends DataSource {
* Returns a row from current resultset as an array
*
* @return array The fetched row as an array
* @access public
*/
function fetchRow($sql = null) {
public function fetchRow($sql = null) {
if (!empty($sql) && is_string($sql) && strlen($sql) > 5) {
if (!$this->execute($sql)) {
return null;
@ -388,9 +379,8 @@ class DboSource extends DataSource {
* @param string $sql SQL statement
* @param boolean $cache Enables returning/storing cached query results
* @return array Array of resultset rows, or false if no rows matched
* @access public
*/
function fetchAll($sql, $cache = true, $modelName = null) {
public function fetchAll($sql, $cache = true, $modelName = null) {
if ($cache && isset($this->_queryCache[$sql])) {
if (preg_match('/^\s*select/i', $sql)) {
return $this->_queryCache[$sql];
@ -458,9 +448,8 @@ class DboSource extends DataSource {
* @param string $name Name of the field
* @param string $sql SQL query
* @return mixed Value of field read.
* @access public
*/
function field($name, $sql) {
public function field($name, $sql) {
$data = $this->fetchRow($sql);
if (!isset($data[$name]) || empty($data[$name])) {
return false;
@ -507,9 +496,8 @@ class DboSource extends DataSource {
*
* @param string $data
* @return string SQL field
* @access public
*/
function name($data) {
public function name($data) {
if (is_object($data) && isset($data->type)) {
return $data->value;
}
@ -563,9 +551,8 @@ class DboSource extends DataSource {
* Checks if the source is connected to the database.
*
* @return boolean True if the database is connected, else false
* @access public
*/
function isConnected() {
public function isConnected() {
return $this->connected;
}
@ -573,9 +560,8 @@ class DboSource extends DataSource {
* Checks if the result is valid
*
* @return boolean True if the result is valid else false
* @access public
*/
function hasResult() {
public function hasResult() {
return is_resource($this->_result);
}
@ -584,9 +570,8 @@ class DboSource extends DataSource {
*
* @param boolean $sorted Get the queries sorted by time taken, defaults to false.
* @return array Array of queries run as an array
* @access public
*/
function getLog($sorted = false, $clear = true) {
public function getLog($sorted = false, $clear = true) {
if ($sorted) {
$log = sortByKey($this->_queriesLog, 'took', 'desc', SORT_NUMERIC);
} else {
@ -628,9 +613,8 @@ class DboSource extends DataSource {
*
* @param string $sql SQL statement
* @todo: Add hook to log errors instead of returning false
* @access public
*/
function logQuery($sql) {
public function logQuery($sql) {
$this->_queriesCnt++;
$this->_queriesTime += $this->took;
$this->_queriesLog[] = array(
@ -653,9 +637,8 @@ class DboSource extends DataSource {
* and execution time in microseconds. If the query fails, an error is output instead.
*
* @param string $sql Query to show information on.
* @access public
*/
function showQuery($sql) {
public function showQuery($sql) {
$error = $this->error;
if (strlen($sql) > 200 && !$this->fullDebug && Configure::read() > 1) {
$sql = substr($sql, 0, 200) . '[...]';
@ -677,9 +660,8 @@ class DboSource extends DataSource {
* @param mixed $model Either a Model object or a string table name.
* @param boolean $quote Whether you want the table name quoted.
* @return string Full quoted table name
* @access public
*/
function fullTableName($model, $quote = true) {
public function fullTableName($model, $quote = true) {
if (is_object($model)) {
$table = $model->tablePrefix . $model->table;
} elseif (isset($this->config['prefix'])) {
@ -704,9 +686,8 @@ class DboSource extends DataSource {
* @param array $values An array of values with keys matching the fields. If null, $model->data will
* be used to generate values.
* @return boolean Success
* @access public
*/
function create(&$model, $fields = null, $values = null) {
public function create(&$model, $fields = null, $values = null) {
$id = null;
if ($fields == null) {
@ -1047,9 +1028,8 @@ class DboSource extends DataSource {
* @param string $query Association query
* @param array $ids Array of IDs of associated records
* @return array Association results
* @access public
*/
function fetchAssociated($model, $query, $ids) {
public function fetchAssociated($model, $query, $ids) {
$query = str_replace('{$__cakeID__$}', implode(', ', $ids), $query);
if (count($ids) > 1) {
$query = str_replace('= (', 'IN (', $query);
@ -1190,9 +1170,8 @@ class DboSource extends DataSource {
* @param boolean $external
* @param array $resultSet
* @return mixed
* @access public
*/
function generateAssociationQuery(&$model, &$linkModel, $type, $association = null, $assocData = array(), &$queryData, $external = false, &$resultSet) {
public function generateAssociationQuery(&$model, &$linkModel, $type, $association = null, $assocData = array(), &$queryData, $external = false, &$resultSet) {
$queryData = $this->__scrubQueryData($queryData);
$assocData = $this->__scrubQueryData($assocData);
@ -1356,9 +1335,8 @@ class DboSource extends DataSource {
* @param object $model Model object
* @param array $association Association array
* @return array Conditions array defining the constraint between $model and $association
* @access public
*/
function getConstraint($type, $model, $linkModel, $alias, $assoc, $alias2 = null) {
public function getConstraint($type, $model, $linkModel, $alias, $assoc, $alias2 = null) {
$assoc = array_merge(array('external' => false, 'self' => false), $assoc);
if (array_key_exists('foreignKey', $assoc) && empty($assoc['foreignKey'])) {
@ -1453,9 +1431,8 @@ class DboSource extends DataSource {
*
* @param array $data
* @return string
* @access public
*/
function renderJoinStatement($data) {
public function renderJoinStatement($data) {
extract($data);
return trim("{$type} JOIN {$table} {$alias} ON ({$conditions})");
}
@ -1466,9 +1443,8 @@ class DboSource extends DataSource {
* @param string $type type of query being run. e.g select, create, update, delete, schema, alter.
* @param array $data Array of data to insert into the query.
* @return string Rendered SQL expression to be run.
* @access public
*/
function renderStatement($type, $data) {
public function renderStatement($type, $data) {
extract($data);
$aliases = null;
@ -1546,9 +1522,8 @@ class DboSource extends DataSource {
* @param array $values
* @param mixed $conditions
* @return boolean Success
* @access public
*/
function update(&$model, $fields = array(), $values = null, $conditions = null) {
public function update(&$model, $fields = array(), $values = null, $conditions = null) {
if ($values == null) {
$combined = $fields;
} else {
@ -1625,9 +1600,8 @@ class DboSource extends DataSource {
* @param Model $model
* @param mixed $conditions
* @return boolean Success
* @access public
*/
function delete(&$model, $conditions = null) {
public function delete(&$model, $conditions = null) {
$alias = $joins = null;
$table = $this->fullTableName($model);
$conditions = $this->_matchRecords($model, $conditions);
@ -1726,9 +1700,8 @@ class DboSource extends DataSource {
* @param string $func Lowercase name of SQL function, i.e. 'count' or 'max'
* @param array $params Function parameters (any values must be quoted manually)
* @return string An SQL calculation function
* @access public
*/
function calculate(&$model, $func, $params = array()) {
public function calculate(&$model, $func, $params = array()) {
$params = (array)$params;
switch (strtolower($func)) {
@ -1766,9 +1739,8 @@ class DboSource extends DataSource {
*
* @param mixed $table A string or model class representing the table to be truncated
* @return boolean SQL TRUNCATE TABLE statement, false if not applicable.
* @access public
*/
function truncate($table) {
public function truncate($table) {
return $this->execute('TRUNCATE TABLE ' . $this->fullTableName($table));
}
@ -1779,9 +1751,8 @@ class DboSource extends DataSource {
* @return boolean True on success, false on fail
* (i.e. if the database/model does not support transactions,
* or a transaction has not started).
* @access public
*/
function begin(&$model) {
public function begin(&$model) {
if (parent::begin($model) && $this->execute($this->_commands['begin'])) {
$this->_transactionStarted = true;
return true;
@ -1796,9 +1767,8 @@ class DboSource extends DataSource {
* @return boolean True on success, false on fail
* (i.e. if the database/model does not support transactions,
* or a transaction has not started).
* @access public
*/
function commit(&$model) {
public function commit(&$model) {
if (parent::commit($model) && $this->execute($this->_commands['commit'])) {
$this->_transactionStarted = false;
return true;
@ -1813,9 +1783,8 @@ class DboSource extends DataSource {
* @return boolean True on success, false on fail
* (i.e. if the database/model does not support transactions,
* or a transaction has not started).
* @access public
*/
function rollback(&$model) {
public function rollback(&$model) {
if (parent::rollback($model) && $this->execute($this->_commands['rollback'])) {
$this->_transactionStarted = false;
return true;
@ -1836,9 +1805,8 @@ class DboSource extends DataSource {
* @return mixed Either null, false, $conditions or an array of default conditions to use.
* @see DboSource::update()
* @see DboSource::conditions()
* @access public
*/
function defaultConditions(&$model, $conditions, $useAlias = true) {
public function defaultConditions(&$model, $conditions, $useAlias = true) {
if (!empty($conditions)) {
return $conditions;
}
@ -1863,9 +1831,8 @@ class DboSource extends DataSource {
* @param unknown_type $key
* @param unknown_type $assoc
* @return string
* @access public
*/
function resolveKey($model, $key, $assoc = null) {
public function resolveKey($model, $key, $assoc = null) {
if (empty($assoc)) {
$assoc = $model->alias;
}
@ -1880,9 +1847,8 @@ class DboSource extends DataSource {
*
* @param array $data
* @return array
* @access public
*/
function __scrubQueryData($data) {
public function __scrubQueryData($data) {
foreach (array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group') as $key) {
if (empty($data[$key])) {
$data[$key] = array();
@ -1917,9 +1883,8 @@ class DboSource extends DataSource {
* @param mixed $fields
* @param boolean $quote If false, returns fields array unquoted
* @return array
* @access public
*/
function fields(&$model, $alias = null, $fields = array(), $quote = true) {
public function fields(&$model, $alias = null, $fields = array(), $quote = true) {
if (empty($alias)) {
$alias = $model->alias;
}
@ -2047,9 +2012,8 @@ class DboSource extends DataSource {
* @param boolean $where If true, "WHERE " will be prepended to the return value
* @param Model $model A reference to the Model instance making the query
* @return string SQL fragment
* @access public
*/
function conditions($conditions, $quoteValues = true, $where = true, $model = null) {
public function conditions($conditions, $quoteValues = true, $where = true, $model = null) {
if (is_object($model)) {
$cacheKey = array(
$model->useDbConfig,
@ -2110,9 +2074,8 @@ class DboSource extends DataSource {
* @param boolean $quoteValues If true, values should be quoted
* @param Model $model A reference to the Model instance making the query
* @return string SQL fragment
* @access public
*/
function conditionKeysToString($conditions, $quoteValues = true, $model = null) {
public function conditionKeysToString($conditions, $quoteValues = true, $model = null) {
$c = 0;
$out = array();
$data = $columnType = null;
@ -2346,9 +2309,8 @@ class DboSource extends DataSource {
* @param integer $limit Limit of results returned
* @param integer $offset Offset from which to start results
* @return string SQL limit/offset statement
* @access public
*/
function limit($limit, $offset = null) {
public function limit($limit, $offset = null) {
if ($limit) {
$rt = '';
if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0) {
@ -2372,9 +2334,8 @@ class DboSource extends DataSource {
* @param string $direction Direction (ASC or DESC)
* @param object $model model reference (used to look for virtual field)
* @return string ORDER BY clause
* @access public
*/
function order($keys, $direction = 'ASC', $model = null) {
public function order($keys, $direction = 'ASC', $model = null) {
if (!is_array($keys)) {
$keys = array($keys);
}
@ -2436,9 +2397,8 @@ class DboSource extends DataSource {
*
* @param string $group Group By Condition
* @return mixed string condition or null
* @access public
*/
function group($group, $model = null) {
public function group($group, $model = null) {
if ($group) {
if (!is_array($group)) {
$group = array($group);
@ -2458,9 +2418,8 @@ class DboSource extends DataSource {
* Disconnects database, kills the connection and says the connection is closed.
*
* @return void
* @access public
*/
function close() {
public function close() {
$this->disconnect();
}
@ -2470,9 +2429,8 @@ class DboSource extends DataSource {
* @param Model $model Model to search
* @param string $sql SQL WHERE clause (condition only, not the "WHERE" part)
* @return boolean True if the table has a matching record, else false
* @access public
*/
function hasAny(&$Model, $sql) {
public function hasAny(&$Model, $sql) {
$sql = $this->conditions($sql);
$table = $this->fullTableName($Model);
$alias = $this->alias . $this->name($Model->alias);
@ -2492,9 +2450,8 @@ class DboSource extends DataSource {
*
* @param string $real Real database-layer column type (i.e. "varchar(255)")
* @return mixed An integer or string representing the length of the column
* @access public
*/
function length($real) {
public function length($real) {
if (!preg_match_all('/([\w\s]+)(?:\((\d+)(?:,(\d+))?\))?(\sunsigned)?(\szerofill)?/', $real, $result)) {
trigger_error(__("FIXME: Can't parse field: " . $real, true), E_USER_WARNING);
$col = str_replace(array(')', 'unsigned'), '', $real);
@ -2553,9 +2510,8 @@ class DboSource extends DataSource {
*
* @param mixed $data Value to be translated
* @return mixed Converted boolean value
* @access public
*/
function boolean($data) {
public function boolean($data) {
if ($data === true || $data === false) {
if ($data === true) {
return 1;
@ -2590,9 +2546,8 @@ class DboSource extends DataSource {
*
* @param string $model Name of model to inspect
* @return array Fields in table. Keys are column and unique
* @access public
*/
function index($model) {
public function index($model) {
return false;
}
@ -2603,9 +2558,8 @@ class DboSource extends DataSource {
* @param string $tableName Optional. If specified only the table name given will be generated.
* Otherwise, all tables defined in the schema are generated.
* @return string
* @access public
*/
function createSchema($schema, $tableName = null) {
public function createSchema($schema, $tableName = null) {
if (!is_a($schema, 'CakeSchema')) {
trigger_error(__('Invalid schema object', true), E_USER_WARNING);
return null;
@ -2665,9 +2619,8 @@ class DboSource extends DataSource {
* @param string $table Optional. If specified only the table name given will be generated.
* Otherwise, all tables defined in the schema are generated.
* @return string
* @access public
*/
function dropSchema($schema, $table = null) {
public function dropSchema($schema, $table = null) {
if (!is_a($schema, 'CakeSchema')) {
trigger_error(__('Invalid schema object', true), E_USER_WARNING);
return null;
@ -2688,9 +2641,8 @@ class DboSource extends DataSource {
* @param array $column An array structured like the following: array('name'=>'value', 'type'=>'value'[, options]),
* where options can be 'default', 'length', or 'key'.
* @return string
* @access public
*/
function buildColumn($column) {
public function buildColumn($column) {
$name = $type = null;
extract(array_merge(array('null' => true), $column));
@ -2754,9 +2706,8 @@ class DboSource extends DataSource {
* @param array $columnData The array of column data.
* @param string $position The position type to use. 'beforeDefault' or 'afterDefault' are common
* @return string a built column with the field parameters added.
* @access public
*/
function _buildFieldParameters($columnString, $columnData, $position) {
public function _buildFieldParameters($columnString, $columnData, $position) {
foreach ($this->fieldParameters as $paramName => $value) {
if (isset($columnData[$paramName]) && $value['position'] == $position) {
if (isset($value['options']) && !in_array($columnData[$paramName], $value['options'])) {
@ -2778,9 +2729,8 @@ class DboSource extends DataSource {
* @param array $indexes
* @param string $table
* @return array
* @access public
*/
function buildIndex($indexes, $table = null) {
public function buildIndex($indexes, $table = null) {
$join = array();
foreach ($indexes as $name => $value) {
$out = '';
@ -2809,9 +2759,8 @@ class DboSource extends DataSource {
* @param array $parameters
* @param string $table
* @return array
* @access public
*/
function readTableParameters($name) {
public function readTableParameters($name) {
$parameters = array();
if ($this->isInterfaceSupported('listDetailedSources')) {
$currentTableDetails = $this->listDetailedSources($name);
@ -2830,9 +2779,8 @@ class DboSource extends DataSource {
* @param array $parameters
* @param string $table
* @return array
* @access public
*/
function buildTableParameters($parameters, $table = null) {
public function buildTableParameters($parameters, $table = null) {
$result = array();
foreach ($parameters as $name => $value) {
if (isset($this->tableParameters[$name])) {
@ -2850,9 +2798,8 @@ class DboSource extends DataSource {
*
* @param string $value
* @return void
* @access public
*/
function introspectType($value) {
public function introspectType($value) {
if (!is_array($value)) {
if ($value === true || $value === false) {
return 'boolean';

View file

@ -67,9 +67,8 @@ class AclNode extends AppModel {
*
* @param mixed $ref Array with 'model' and 'foreign_key', model object, or string value
* @return array Node found in database
* @access public
*/
function node($ref = null) {
public function node($ref = null) {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$type = $this->alias;
$result = null;

View file

@ -751,9 +751,8 @@ class Model extends Overloadable {
*
* @param string $tableName Name of the custom table
* @return void
* @access public
*/
function setSource($tableName) {
public function setSource($tableName) {
$this->setDataSource($this->useDbConfig);
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$db->cacheSources = ($this->cacheSources && $db->cacheSources);
@ -837,9 +836,8 @@ class Model extends Overloadable {
* @param string $field The name of the field to be deconstructed
* @param mixed $data An array or object to be deconstructed into a field
* @return mixed The resulting data that should be assigned to a field
* @access public
*/
function deconstruct($field, $data) {
public function deconstruct($field, $data) {
if (!is_array($data)) {
return $data;
}
@ -912,9 +910,8 @@ class Model extends Overloadable {
*
* @param mixed $field Set to true to reload schema, or a string to return a specific field
* @return array Array of table metadata
* @access public
*/
function schema($field = false) {
public function schema($field = false) {
if (!is_array($this->_schema) || $field === true) {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$db->cacheSources = ($this->cacheSources && $db->cacheSources);
@ -938,9 +935,8 @@ class Model extends Overloadable {
* Returns an associative array of field names and column types.
*
* @return array Field types indexed by field name
* @access public
*/
function getColumnTypes() {
public function getColumnTypes() {
$columns = $this->schema();
if (empty($columns)) {
trigger_error(__('(Model::getColumnTypes) Unable to build model field data. If you are using a model without a database table, try implementing schema()', true), E_USER_WARNING);
@ -957,9 +953,8 @@ class Model extends Overloadable {
*
* @param string $column The name of the model column
* @return string Column type
* @access public
*/
function getColumnType($column) {
public function getColumnType($column) {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
$cols = $this->schema();
$model = null;
@ -986,9 +981,8 @@ class Model extends Overloadable {
* @return mixed If $name is a string, returns a boolean indicating whether the field exists.
* If $name is an array of field names, returns the first field that exists,
* or false if none exist.
* @access public
*/
function hasField($name, $checkVirtual = false) {
public function hasField($name, $checkVirtual = false) {
if (is_array($name)) {
foreach ($name as $n) {
if ($this->hasField($n, $checkVirtual)) {
@ -1019,9 +1013,8 @@ class Model extends Overloadable {
*
* @param mixed $name Name of field to look for
* @return boolean indicating whether the field exists as a model virtual field.
* @access public
*/
function isVirtualField($field) {
public function isVirtualField($field) {
if (empty($this->virtualFields) || !is_string($field)) {
return false;
}
@ -1044,9 +1037,8 @@ class Model extends Overloadable {
* @return mixed If $field is string expression bound to virtual field $field
* If $field is null, returns an array of all model virtual fields
* or false if none $field exist.
* @access public
*/
function getVirtualField($field = null) {
public function getVirtualField($field = null) {
if ($field == null) {
return empty($this->virtualFields) ? false : $this->virtualFields;
}
@ -1464,9 +1456,8 @@ class Model extends Overloadable {
* @param boolean $created True if a new record was created, otherwise only associations with
* 'counterScope' defined get updated
* @return void
* @access public
*/
function updateCounterCache($keys = array(), $created = false) {
public function updateCounterCache($keys = array(), $created = false) {
$keys = empty($keys) ? $this->data[$this->alias] : $keys;
$keys['old'] = isset($keys['old']) ? $keys['old'] : array();
@ -1964,9 +1955,8 @@ class Model extends Overloadable {
* to ascertain the existence of the record in persistent storage.
*
* @return boolean True if such a record exists
* @access public
*/
function exists() {
public function exists() {
if ($this->getID() === false) {
return false;
}
@ -1980,9 +1970,8 @@ class Model extends Overloadable {
*
* @param array $conditions SQL conditions array
* @return boolean True if such a record exists
* @access public
*/
function hasAny($conditions = null) {
public function hasAny($conditions = null) {
return ($this->find('count', array('conditions' => $conditions, 'recursive' => -1)) != false);
}
@ -2339,9 +2328,8 @@ class Model extends Overloadable {
* to those originally defined in the model.
*
* @return boolean Success
* @access public
*/
function resetAssociations() {
public function resetAssociations() {
if (!empty($this->__backAssociation)) {
foreach ($this->__associations as $type) {
if (isset($this->__backAssociation[$type])) {
@ -2368,9 +2356,8 @@ class Model extends Overloadable {
* @param array $fields Field/value pairs to search (if no values specified, they are pulled from $this->data)
* @param boolean $or If false, all fields specified must match in order for a false return value
* @return boolean False if any records matching any fields are found
* @access public
*/
function isUnique($fields, $or = true) {
public function isUnique($fields, $or = true) {
if (!is_array($fields)) {
$fields = func_get_args();
if (is_bool($fields[count($fields) - 1])) {
@ -2639,9 +2626,8 @@ class Model extends Overloadable {
* @param string $field The name of the field to invalidate
* @param mixed $value Name of validation rule that was not failed, or validation message to
* be returned. If no validation key is provided, defaults to true.
* @access public
*/
function invalidate($field, $value = true) {
public function invalidate($field, $value = true) {
if (!is_array($this->validationErrors)) {
$this->validationErrors = array();
}
@ -2653,9 +2639,8 @@ class Model extends Overloadable {
*
* @param string $field Returns true if the input string ends in "_id"
* @return boolean True if the field is a foreign key listed in the belongsTo array.
* @access public
*/
function isForeignKey($field) {
public function isForeignKey($field) {
$foreignKeys = array();
if (!empty($this->belongsTo)) {
foreach ($this->belongsTo as $assoc => $data) {
@ -2672,9 +2657,8 @@ class Model extends Overloadable {
* @param string $field Field to escape (e.g: id)
* @param string $alias Alias for the model (e.g: Post)
* @return string The name of the escaped field for this Model (i.e. id becomes `Post`.`id`).
* @access public
*/
function escapeField($field = null, $alias = null) {
public function escapeField($field = null, $alias = null) {
if (empty($alias)) {
$alias = $this->alias;
}
@ -2693,9 +2677,8 @@ class Model extends Overloadable {
*
* @param integer $list Index on which the composed ID is located
* @return mixed The ID of the current record, false if no ID
* @access public
*/
function getID($list = 0) {
public function getID($list = 0) {
if (empty($this->id) || (is_array($this->id) && isset($this->id[0]) && empty($this->id[0]))) {
return false;
}
@ -2725,9 +2708,8 @@ class Model extends Overloadable {
* Returns the ID of the last record this model inserted.
*
* @return mixed Last inserted ID
* @access public
*/
function getLastInsertID() {
public function getLastInsertID() {
return $this->getInsertID();
}
@ -2735,9 +2717,8 @@ class Model extends Overloadable {
* Returns the ID of the last record this model inserted.
*
* @return mixed Last inserted ID
* @access public
*/
function getInsertID() {
public function getInsertID() {
return $this->__insertID;
}
@ -2745,9 +2726,8 @@ class Model extends Overloadable {
* Sets the ID of the last record this model inserted
*
* @param mixed Last inserted ID
* @access public
*/
function setInsertID($id) {
public function setInsertID($id) {
$this->__insertID = $id;
}
@ -2755,9 +2735,8 @@ class Model extends Overloadable {
* Returns the number of rows returned from the last query.
*
* @return int Number of rows
* @access public
*/
function getNumRows() {
public function getNumRows() {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
return $db->lastNumRows();
}
@ -2766,9 +2745,8 @@ class Model extends Overloadable {
* Returns the number of rows affected by the last query.
*
* @return int Number of rows
* @access public
*/
function getAffectedRows() {
public function getAffectedRows() {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
return $db->lastAffected();
}
@ -2778,9 +2756,8 @@ class Model extends Overloadable {
*
* @param string $dataSource The name of the DataSource, as defined in app/config/database.php
* @return boolean True on success
* @access public
*/
function setDataSource($dataSource = null) {
public function setDataSource($dataSource = null) {
$oldConfig = $this->useDbConfig;
if ($dataSource != null) {
@ -2807,9 +2784,8 @@ class Model extends Overloadable {
* Not safe for use with some versions of PHP4, because this class is overloaded.
*
* @return object A DataSource object
* @access public
*/
function &getDataSource() {
public function &getDataSource() {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
return $db;
}
@ -2818,9 +2794,8 @@ class Model extends Overloadable {
* Get associations
*
* @return array
* @access public
*/
function associations() {
public function associations() {
return $this->__associations;
}
@ -2829,9 +2804,8 @@ class Model extends Overloadable {
*
* @param string $type Only result associations of this type
* @return array Associations
* @access public
*/
function getAssociated($type = null) {
public function getAssociated($type = null) {
if ($type == null) {
$associated = array();
foreach ($this->__associations as $assoc) {
@ -2876,9 +2850,8 @@ class Model extends Overloadable {
* @param mixed $with The 'with' key of the model association
* @param array $keys Any join keys which must be merged with the keys queried
* @return array
* @access public
*/
function joinModel($assoc, $keys = array()) {
public function joinModel($assoc, $keys = array()) {
if (is_string($assoc)) {
return array($assoc, array_keys($this->{$assoc}->schema()));
} elseif (is_array($assoc)) {

View file

@ -58,9 +58,8 @@ class ModelBehavior extends Object {
*
* @param object $model Model using this behavior
* @param array $config Configuration settings for $model
* @access public
*/
function setup(&$model, $config = array()) { }
public function setup(&$model, $config = array()) { }
/**
* Clean up any initialization this behavior has done on a model. Called when a behavior is dynamically
@ -82,9 +81,8 @@ class ModelBehavior extends Object {
* @param object $model Model using this behavior
* @param array $queryData Data used to execute this query, i.e. conditions, order, etc.
* @return boolean True if the operation should continue, false if it should abort
* @access public
*/
function beforeFind(&$model, $query) { }
public function beforeFind(&$model, $query) { }
/**
* After find callback. Can be used to modify any results returned by find and findAll.
@ -93,36 +91,32 @@ class ModelBehavior extends Object {
* @param mixed $results The results of the find operation
* @param boolean $primary Whether this model is being queried directly (vs. being queried as an association)
* @return mixed Result of the find operation
* @access public
*/
function afterFind(&$model, $results, $primary) { }
public function afterFind(&$model, $results, $primary) { }
/**
* Before validate callback
*
* @param object $model Model using this behavior
* @return boolean True if validate operation should continue, false to abort
* @access public
*/
function beforeValidate(&$model) { }
public function beforeValidate(&$model) { }
/**
* Before save callback
*
* @param object $model Model using this behavior
* @return boolean True if the operation should continue, false if it should abort
* @access public
*/
function beforeSave(&$model) { }
public function beforeSave(&$model) { }
/**
* After save callback
*
* @param object $model Model using this behavior
* @param boolean $created True if this save created a new record
* @access public
*/
function afterSave(&$model, $created) { }
public function afterSave(&$model, $created) { }
/**
* Before delete callback
@ -130,26 +124,23 @@ class ModelBehavior extends Object {
* @param object $model Model using this behavior
* @param boolean $cascade If true records that depend on this record will also be deleted
* @return boolean True if the operation should continue, false if it should abort
* @access public
*/
function beforeDelete(&$model, $cascade = true) { }
public function beforeDelete(&$model, $cascade = true) { }
/**
* After delete callback
*
* @param object $model Model using this behavior
* @access public
*/
function afterDelete(&$model) { }
public function afterDelete(&$model) { }
/**
* DataSource error callback
*
* @param object $model Model using this behavior
* @param string $error Error generated in DataSource
* @access public
*/
function onError(&$model, $error) { }
public function onError(&$model, $error) { }
/**
* Overrides Object::dispatchMethod to account for PHP4's broken reference support
@ -276,9 +267,8 @@ class BehaviorCollection extends Object {
* @param string $behavior CamelCased name of the behavior to load
* @param array $config Behavior configuration parameters
* @return boolean True on success, false on failure
* @access public
*/
function attach($behavior, $config = array()) {
public function attach($behavior, $config = array()) {
list($plugin, $name) = pluginSplit($behavior);
$class = $name . 'Behavior';
@ -369,9 +359,8 @@ class BehaviorCollection extends Object {
*
* @param string $name CamelCased name of the behavior to unload
* @return void
* @access public
*/
function detach($name) {
public function detach($name) {
if (isset($this->{$name})) {
$this->{$name}->cleanup(ClassRegistry::getObject($this->modelName));
unset($this->{$name});
@ -389,9 +378,8 @@ class BehaviorCollection extends Object {
*
* @param mixed $name CamelCased name of the behavior(s) to enable (string or array)
* @return void
* @access public
*/
function enable($name) {
public function enable($name) {
$this->_disabled = array_diff($this->_disabled, (array)$name);
}
@ -401,9 +389,8 @@ class BehaviorCollection extends Object {
*
* @param mixed $name CamelCased name of the behavior(s) to disable (string or array)
* @return void
* @access public
*/
function disable($name) {
public function disable($name) {
foreach ((array)$name as $behavior) {
if (in_array($behavior, $this->_attached) && !in_array($behavior, $this->_disabled)) {
$this->_disabled[] = $behavior;
@ -418,9 +405,8 @@ class BehaviorCollection extends Object {
* returns an array of currently-enabled behaviors
* @return mixed If $name is specified, returns the boolean status of the corresponding behavior.
* Otherwise, returns an array of all enabled behaviors.
* @access public
*/
function enabled($name = null) {
public function enabled($name = null) {
if (!empty($name)) {
return (in_array($name, $this->_attached) && !in_array($name, $this->_disabled));
}
@ -431,9 +417,8 @@ class BehaviorCollection extends Object {
* Dispatches a behavior method
*
* @return array All methods for all behaviors attached to this object
* @access public
*/
function dispatchMethod(&$model, $method, $params = array(), $strict = false) {
public function dispatchMethod(&$model, $method, $params = array(), $strict = false) {
$methods = array_keys($this->__methods);
foreach ($methods as $key => $value) {
$methods[$key] = strtolower($value);
@ -476,9 +461,8 @@ class BehaviorCollection extends Object {
* @param array $params
* @param array $options
* @return mixed
* @access public
*/
function trigger(&$model, $callback, $params = array(), $options = array()) {
public function trigger(&$model, $callback, $params = array(), $options = array()) {
if (empty($this->_attached)) {
return true;
}
@ -509,9 +493,8 @@ class BehaviorCollection extends Object {
* Gets the method list for attached behaviors, i.e. all public, non-callback methods
*
* @return array All public methods for all behaviors attached to this collection
* @access public
*/
function methods() {
public function methods() {
return $this->__methods;
}
@ -522,9 +505,8 @@ class BehaviorCollection extends Object {
* returns an array of currently-attached behaviors
* @return mixed If $name is specified, returns the boolean status of the corresponding behavior.
* Otherwise, returns an array of all attached behaviors.
* @access public
*/
function attached($name = null) {
public function attached($name = null) {
if (!empty($name)) {
return (in_array($name, $this->_attached));
}

View file

@ -59,9 +59,8 @@ class Object {
* Each class can override this method as necessary.
*
* @return string The name of this class
* @access public
*/
function toString() {
public function toString() {
$class = get_class($this);
return $class;
}
@ -75,9 +74,8 @@ class Object {
* @param array $extra if array includes the key "return" it sets the AutoRender to true.
* @return mixed Boolean true or false on success/failure, or contents
* of rendered action if 'return' is set in $extra.
* @access public
*/
function requestAction($url, $extra = array()) {
public function requestAction($url, $extra = array()) {
if (empty($url)) {
return false;
}
@ -102,9 +100,8 @@ class Object {
* @param string $method Name of the method to call
* @param array $params Parameter list to use when calling $method
* @return mixed Returns the result of the method call
* @access public
*/
function dispatchMethod($method, $params = array()) {
public function dispatchMethod($method, $params = array()) {
switch (count($params)) {
case 0:
return $this->{$method}();
@ -130,9 +127,8 @@ class Object {
*
* @param $status see http://php.net/exit for values
* @return void
* @access public
*/
function _stop($status = 0) {
public function _stop($status = 0) {
exit($status);
}
@ -143,9 +139,8 @@ class Object {
* @param string $msg Log message
* @param integer $type Error type constant. Defined in app/config/core.php.
* @return boolean Success of log write
* @access public
*/
function log($msg, $type = LOG_ERROR) {
public function log($msg, $type = LOG_ERROR) {
if (!class_exists('CakeLog')) {
require LIBS . 'cake_log.php';
}
@ -182,9 +177,8 @@ class Object {
* @param string $method Method to be called in the error class (AppError or ErrorHandler classes)
* @param array $messages Message that is to be displayed by the error class
* @return error message
* @access public
*/
function cakeError($method, $messages = array()) {
public function cakeError($method, $messages = array()) {
if (!class_exists('ErrorHandler')) {
App::import('Core', 'Error');

View file

@ -41,9 +41,8 @@ class Overloadable extends Object {
/**
* Overload implementation.
*
* @access public
*/
function overload() {
public function overload() {
if (function_exists('overload')) {
if (func_num_args() > 0) {
foreach (func_get_args() as $class) {
@ -101,9 +100,8 @@ class Overloadable2 extends Object {
/**
* Overload implementation.
*
* @access public
*/
function overload() {
public function overload() {
if (function_exists('overload')) {
if (func_num_args() > 0) {
foreach (func_get_args() as $class) {

View file

@ -31,9 +31,8 @@ class Overloadable extends Object {
/**
* Overload implementation. No need for implementation in PHP5.
*
* @access public
*/
function overload() { }
public function overload() { }
/**
* Magic method handler.
@ -63,9 +62,8 @@ class Overloadable2 extends Object {
/**
* Overload implementation. No need for implementation in PHP5.
*
* @access public
*/
function overload() { }
public function overload() { }
/**
* Magic method handler.

View file

@ -1286,9 +1286,8 @@ class CakeRoute {
* @param array $defaults Array of defaults for the route.
* @param string $params Array of parameters and additional options for the Route
* @return void
* @access public
*/
function CakeRoute($template, $defaults = array(), $options = array()) {
public function CakeRoute($template, $defaults = array(), $options = array()) {
$this->template = $template;
$this->defaults = (array)$defaults;
$this->options = (array)$options;
@ -1298,9 +1297,8 @@ class CakeRoute {
* Check if a Route has been compiled into a regular expression.
*
* @return boolean
* @access public
*/
function compiled() {
public function compiled() {
return !empty($this->_compiledRoute);
}
@ -1309,9 +1307,8 @@ class CakeRoute {
* and populates $this->names with the named routing elements.
*
* @return array Returns a string regular expression of the compiled route.
* @access public
*/
function compile() {
public function compile() {
if ($this->compiled()) {
return $this->_compiledRoute;
}
@ -1373,9 +1370,8 @@ class CakeRoute {
*
* @param string $url The url to attempt to parse.
* @return mixed Boolean false on failure, otherwise an array or parameters
* @access public
*/
function parse($url) {
public function parse($url) {
if (!$this->compiled()) {
$this->compile();
}
@ -1429,9 +1425,8 @@ class CakeRoute {
* @param array $url The array to apply persistent parameters to.
* @param array $params An array of persistent values to replace persistent ones.
* @return array An array with persistent parameters applied.
* @access public
*/
function persistParams($url, $params) {
public function persistParams($url, $params) {
foreach ($this->options['persist'] as $persistKey) {
if (array_key_exists($persistKey, $params) && !isset($url[$persistKey])) {
$url[$persistKey] = $params[$persistKey];
@ -1447,9 +1442,8 @@ class CakeRoute {
*
* @param array $url An array of parameters to check matching with.
* @return mixed Either a string url for the parameters if they match or false.
* @access public
*/
function match($url) {
public function match($url) {
if (!$this->compiled()) {
$this->compile();
}

View file

@ -164,9 +164,8 @@ class Sanitize {
*
* @param string $str String to sanitize
* @return string sanitized string
* @access public
*/
function stripAll($str) {
public function stripAll($str) {
$str = Sanitize::stripWhitespace($str);
$str = Sanitize::stripImages($str);
$str = Sanitize::stripScripts($str);

View file

@ -116,9 +116,8 @@ class Validation extends Object {
*
* @param mixed $check Value to check
* @return boolean Success
* @access public
*/
function notEmpty($check) {
public function notEmpty($check) {
$_this =& Validation::getInstance();
$_this->__reset();
$_this->check = $check;
@ -144,9 +143,8 @@ class Validation extends Object {
*
* @param mixed $check Value to check
* @return boolean Success
* @access public
*/
function alphaNumeric($check) {
public function alphaNumeric($check) {
$_this =& Validation::getInstance();
$_this->__reset();
$_this->check = $check;
@ -171,9 +169,8 @@ class Validation extends Object {
* @param integer $min Minimum value in range (inclusive)
* @param integer $max Maximum value in range (inclusive)
* @return boolean Success
* @access public
*/
function between($check, $min, $max) {
public function between($check, $min, $max) {
$length = mb_strlen($check);
return ($length >= $min && $length <= $max);
}
@ -187,9 +184,8 @@ class Validation extends Object {
*
* @param mixed $check Value to check
* @return boolean Success
* @access public
*/
function blank($check) {
public function blank($check) {
$_this =& Validation::getInstance();
$_this->__reset();
$_this->check = $check;
@ -292,9 +288,8 @@ class Validation extends Object {
* less or equal <=, is less <, equal to ==, not equal !=
* @param integer $check2 only needed if $check1 is a string
* @return boolean Success
* @access public
*/
function comparison($check1, $operator = null, $check2 = null) {
public function comparison($check1, $operator = null, $check2 = null) {
if (is_array($check1)) {
extract($check1, EXTR_OVERWRITE);
}
@ -352,9 +347,8 @@ class Validation extends Object {
* As and array: array('check' => value, 'regex' => 'valid regular expression')
* @param string $regex If $check is passed as a string, $regex must also be set to valid regular expression
* @return boolean Success
* @access public
*/
function custom($check, $regex = null) {
public function custom($check, $regex = null) {
$_this =& Validation::getInstance();
$_this->__reset();
$_this->check = $check;
@ -384,9 +378,8 @@ class Validation extends Object {
* my 12/2006 separators can be a space, period, dash, forward slash
* @param string $regex If a custom regular expression is used this is the only validation that will occur.
* @return boolean Success
* @access public
*/
function date($check, $format = 'ymd', $regex = null) {
public function date($check, $format = 'ymd', $regex = null) {
$_this =& Validation::getInstance();
$_this->__reset();
$_this->check = $check;
@ -422,10 +415,9 @@ class Validation extends Object {
*
* @param string $check a valid time string
* @return boolean Success
* @access public
*/
function time($check) {
public function time($check) {
$_this =& Validation::getInstance();
$_this->__reset();
$_this->check = $check;
@ -438,9 +430,8 @@ class Validation extends Object {
*
* @param string $check a valid boolean
* @return boolean Success
* @access public
*/
function boolean($check) {
public function boolean($check) {
$booleanList = array(0, 1, '0', '1', true, false);
return in_array($check, $booleanList, true);
}
@ -453,9 +444,8 @@ class Validation extends Object {
* @param integer $places if set $check value must have exactly $places after the decimal point
* @param string $regex If a custom regular expression is used this is the only validation that will occur.
* @return boolean Success
* @access public
*/
function decimal($check, $places = null, $regex = null) {
public function decimal($check, $places = null, $regex = null) {
$_this =& Validation::getInstance();
$_this->__reset();
$_this->regex = $regex;
@ -478,9 +468,8 @@ class Validation extends Object {
* @param boolean $deep Perform a deeper validation (if true), by also checking availability of host
* @param string $regex Regex to use (if none it will use built in regex)
* @return boolean Success
* @access public
*/
function email($check, $deep = false, $regex = null) {
public function email($check, $deep = false, $regex = null) {
$_this =& Validation::getInstance();
$_this->__reset();
$_this->check = $check;
@ -518,9 +507,8 @@ class Validation extends Object {
* @param mixed $check Value to check
* @param mixed $comparedTo Value to compare
* @return boolean Success
* @access public
*/
function equalTo($check, $comparedTo) {
public function equalTo($check, $comparedTo) {
return ($check === $comparedTo);
}
@ -530,9 +518,8 @@ class Validation extends Object {
* @param mixed $check Value to check
* @param array $extensions file extenstions to allow
* @return boolean Success
* @access public
*/
function extension($check, $extensions = array('gif', 'jpeg', 'png', 'jpg')) {
public function extension($check, $extensions = array('gif', 'jpeg', 'png', 'jpg')) {
if (is_array($check)) {
return Validation::extension(array_shift($check), $extensions);
}
@ -556,9 +543,8 @@ class Validation extends Object {
* @param string $check The string to test.
* @param string $type The IP Version to test against
* @return boolean Success
* @access public
*/
function ip($check, $type = 'both') {
public function ip($check, $type = 'both') {
$_this =& Validation::getInstance();
$success = false;
$type = strtolower($type);
@ -611,9 +597,8 @@ class Validation extends Object {
* @param string $check The string to test
* @param integer $min The minimal string length
* @return boolean Success
* @access public
*/
function minLength($check, $min) {
public function minLength($check, $min) {
$length = mb_strlen($check);
return ($length >= $min);
}
@ -624,9 +609,8 @@ class Validation extends Object {
* @param string $check The string to test
* @param integer $max The maximal string length
* @return boolean Success
* @access public
*/
function maxLength($check, $max) {
public function maxLength($check, $max) {
$length = mb_strlen($check);
return ($length <= $max);
}
@ -637,9 +621,8 @@ class Validation extends Object {
* @param string $check Value to check
* @param string $symbolPosition Where symbol is located (left/right)
* @return boolean Success
* @access public
*/
function money($check, $symbolPosition = 'left') {
public function money($check, $symbolPosition = 'left') {
$_this =& Validation::getInstance();
$_this->check = $check;
@ -663,9 +646,8 @@ class Validation extends Object {
* @param mixed $check Value to check
* @param mixed $options Options for the check.
* @return boolean Success
* @access public
*/
function multiple($check, $options = array()) {
public function multiple($check, $options = array()) {
$defaults = array('in' => null, 'max' => null, 'min' => null);
$options = array_merge($defaults, $options);
$check = array_filter((array)$check);
@ -693,9 +675,8 @@ class Validation extends Object {
*
* @param string $check Value to check
* @return boolean Succcess
* @access public
*/
function numeric($check) {
public function numeric($check) {
return is_numeric($check);
}
@ -706,9 +687,8 @@ class Validation extends Object {
* @param string $regex Regular expression to use
* @param string $country Country code (defaults to 'all')
* @return boolean Success
* @access public
*/
function phone($check, $regex = null, $country = 'all') {
public function phone($check, $regex = null, $country = 'all') {
$_this =& Validation::getInstance();
$_this->check = $check;
$_this->regex = $regex;
@ -740,9 +720,8 @@ class Validation extends Object {
* @param string $regex Regular expression to use
* @param string $country Country to use for formatting
* @return boolean Success
* @access public
*/
function postal($check, $regex = null, $country = null) {
public function postal($check, $regex = null, $country = null) {
$_this =& Validation::getInstance();
$_this->check = $check;
$_this->regex = $regex;
@ -789,9 +768,8 @@ class Validation extends Object {
* @param integer $lower Lower limit
* @param integer $upper Upper limit
* @return boolean Success
* @access public
*/
function range($check, $lower = null, $upper = null) {
public function range($check, $lower = null, $upper = null) {
if (!is_numeric($check)) {
return false;
}
@ -808,9 +786,8 @@ class Validation extends Object {
* @param string $regex Regular expression to use
* @param string $country Country
* @return boolean Success
* @access public
*/
function ssn($check, $regex = null, $country = null) {
public function ssn($check, $regex = null, $country = null) {
$_this =& Validation::getInstance();
$_this->check = $check;
$_this->regex = $regex;
@ -843,9 +820,8 @@ class Validation extends Object {
*
* @param string $check Value to check
* @return boolean Success
* @access public
*/
function uuid($check) {
public function uuid($check) {
$_this =& Validation::getInstance();
$_this->check = $check;
$_this->regex = '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i';
@ -868,9 +844,8 @@ class Validation extends Object {
* @param string $check Value to check
* @param boolean $strict Require URL to be prefixed by a valid scheme (one of http(s)/ftp(s)/file/news/gopher)
* @return boolean Success
* @access public
*/
function url($check, $strict = false) {
public function url($check, $strict = false) {
$_this =& Validation::getInstance();
$_this->__populateIp();
$_this->check = $check;
@ -890,9 +865,8 @@ class Validation extends Object {
* @param string $check Value to check
* @param array $list List to check against
* @return boolean Succcess
* @access public
*/
function inList($check, $list) {
public function inList($check, $list) {
return in_array($check, $list);
}
@ -904,9 +878,8 @@ class Validation extends Object {
* @param string $method class method name for validation to run
* @param array $args arguments to send to method
* @return mixed user-defined class class method returns
* @access public
*/
function userDefined($check, $object, $method, $args = null) {
public function userDefined($check, $object, $method, $args = null) {
return call_user_func_array(array(&$object, $method), array($check, $args));
}

View file

@ -159,9 +159,8 @@ class Helper extends Overloadable {
*
* @param $name file name inside app/config to load.
* @return array merged tags from config/$name.php
* @access public
*/
function loadConfig($name = 'tags') {
public function loadConfig($name = 'tags') {
if (file_exists(CONFIGS . $name .'.php')) {
require(CONFIGS . $name .'.php');
if (isset($tags)) {
@ -181,9 +180,8 @@ class Helper extends Overloadable {
* the reverse routing features of CakePHP.
* @param boolean $full If true, the full base URL will be prepended to the result
* @return string Full translated URL with base path.
* @access public
*/
function url($url = null, $full = false) {
public function url($url = null, $full = false) {
return h(Router::url($url, $full));
}
@ -192,9 +190,8 @@ class Helper extends Overloadable {
*
* @param string $file The file to create a webroot path to.
* @return string Web accessible path to file.
* @access public
*/
function webroot($file) {
public function webroot($file) {
$asset = explode('?', $file);
$asset[1] = isset($asset[1]) ? '?' . $asset[1] : null;
$webPath = "{$this->webroot}" . $asset[0];
@ -236,9 +233,8 @@ class Helper extends Overloadable {
*
* @param string $path The file path to timestamp, the path must be inside WWW_ROOT
* @return string Path with a timestamp added, or not.
* @access public
*/
function assetTimestamp($path) {
public function assetTimestamp($path) {
$timestampEnabled = (
(Configure::read('Asset.timestamp') === true && Configure::read() > 0) ||
Configure::read('Asset.timestamp') === 'force'
@ -256,9 +252,8 @@ class Helper extends Overloadable {
*
* @param mixed $output Either an array of strings to clean or a single string to clean.
* @return cleaned content for output
* @access public
*/
function clean($output) {
public function clean($output) {
$this->__reset();
if (empty($output)) {
return null;
@ -311,9 +306,8 @@ class Helper extends Overloadable {
* @param string $insertBefore String to be inserted before options.
* @param string $insertAfter String to be inserted after options.
* @return string Composed attributes.
* @access public
*/
function _parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {
public function _parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {
if (is_array($options)) {
$options = array_merge(array('escape' => true), $options);
@ -371,9 +365,8 @@ class Helper extends Overloadable {
* @param mixed $entity A field name, like "ModelName.fieldName" or "ModelName.ID.fieldName"
* @param boolean $setScope Sets the view scope to the model specified in $tagValue
* @return void
* @access public
*/
function setEntity($entity, $setScope = false) {
public function setEntity($entity, $setScope = false) {
$view =& ClassRegistry::getObject('view');
if ($setScope) {
@ -517,9 +510,8 @@ class Helper extends Overloadable {
* Gets the currently-used model of the rendering context.
*
* @return string
* @access public
*/
function model() {
public function model() {
$view =& ClassRegistry::getObject('view');
if (!empty($view->association)) {
return $view->association;
@ -532,9 +524,8 @@ class Helper extends Overloadable {
* Gets the ID of the currently-used model of the rendering context.
*
* @return mixed
* @access public
*/
function modelID() {
public function modelID() {
$view =& ClassRegistry::getObject('view');
return $view->modelId;
}
@ -543,9 +534,8 @@ class Helper extends Overloadable {
* Gets the currently-used model field of the rendering context.
*
* @return string
* @access public
*/
function field() {
public function field() {
$view =& ClassRegistry::getObject('view');
return $view->field;
}
@ -747,9 +737,8 @@ class Helper extends Overloadable {
* @param string $class The classname being added.
* @param string $key the key to use for class.
* @return array Array of options with $key set.
* @access public
*/
function addClass($options = array(), $class = null, $key = 'class') {
public function addClass($options = array(), $class = null, $key = 'class') {
if (isset($options[$key]) && trim($options[$key]) != '') {
$options[$key] .= ' ' . $class;
} else {
@ -777,9 +766,8 @@ class Helper extends Overloadable {
* Overridden in subclasses.
*
* @return void
* @access public
*/
function beforeRender() {
public function beforeRender() {
}
/**
@ -789,9 +777,8 @@ class Helper extends Overloadable {
* Overridden in subclasses.
*
* @return void
* @access public
*/
function afterRender() {
public function afterRender() {
}
/**
@ -800,9 +787,8 @@ class Helper extends Overloadable {
* Overridden in subclasses.
*
* @return void
* @access public
*/
function beforeLayout() {
public function beforeLayout() {
}
/**
@ -811,9 +797,8 @@ class Helper extends Overloadable {
* Overridden in subclasses.
*
* @return void
* @access public
*/
function afterLayout() {
public function afterLayout() {
}
/**

View file

@ -986,9 +986,8 @@ class AjaxHelper extends AppHelper {
* Executed after a view has rendered, used to include bufferred code
* blocks.
*
* @access public
*/
function afterRender() {
public function afterRender() {
if (env('HTTP_X_UPDATE') != null && !empty($this->__ajaxBuffer)) {
@ob_end_clean();

View file

@ -336,9 +336,8 @@ class FormHelper extends AppHelper {
*
* @param mixed $options as a string will use $options as the value of button,
* @return string a closing FORM tag optional submit button.
* @access public
*/
function end($options = null) {
public function end($options = null) {
if (!empty($this->params['models'])) {
$models = $this->params['models'][0];
}
@ -379,9 +378,8 @@ class FormHelper extends AppHelper {
*
* @param array $fields The list of fields to use when generating the hash
* @return string A hidden input field with a security hash
* @access public
*/
function secure($fields = array()) {
public function secure($fields = array()) {
if (!isset($this->params['_Token']) || empty($this->params['_Token'])) {
return;
}
@ -447,9 +445,8 @@ class FormHelper extends AppHelper {
*
* @param string $field This should be "Modelname.fieldname"
* @return boolean If there are errors this method returns true, else false.
* @access public
*/
function isFieldError($field) {
public function isFieldError($field) {
$this->setEntity($field);
return (bool)$this->tagIsInvalid();
}
@ -468,9 +465,8 @@ class FormHelper extends AppHelper {
* @param mixed $text Error message or array of $options
* @param array $options Rendering options for <div /> wrapper tag
* @return string If there are errors this method returns an error message, otherwise null.
* @access public
*/
function error($field, $text = null, $options = array()) {
public function error($field, $text = null, $options = array()) {
$defaults = array('wrap' => true, 'class' => 'error-message', 'escape' => true);
$options = array_merge($defaults, $options);
$this->setEntity($field);
@ -578,9 +574,8 @@ class FormHelper extends AppHelper {
* @param mixed $fields An array of fields to generate inputs for, or null.
* @param array $blacklist a simple array of fields to not create inputs for.
* @return string Completed form inputs.
* @access public
*/
function inputs($fields = null, $blacklist = null) {
public function inputs($fields = null, $blacklist = null) {
$fieldset = $legend = true;
$model = $this->model();
if (is_array($fields)) {
@ -680,9 +675,8 @@ class FormHelper extends AppHelper {
* @param string $fieldName This should be "Modelname.fieldname"
* @param array $options Each type of input takes different options.
* @return string Completed form widget.
* @access public
*/
function input($fieldName, $options = array()) {
public function input($fieldName, $options = array()) {
$this->setEntity($fieldName);
$options = array_merge(
@ -973,9 +967,8 @@ class FormHelper extends AppHelper {
* @param string $fieldName Name of a field, like this "Modelname.fieldname"
* @param array $options Array of HTML attributes.
* @return string An HTML text input element.
* @access public
*/
function checkbox($fieldName, $options = array()) {
public function checkbox($fieldName, $options = array()) {
$options = $this->_initInputField($fieldName, $options) + array('hiddenField' => true);
$value = current($this->value());
$output = "";
@ -1021,9 +1014,8 @@ class FormHelper extends AppHelper {
* @param array $options Radio button options array.
* @param array $attributes Array of HTML attributes, and special attributes above.
* @return string Completed radio widget set.
* @access public
*/
function radio($fieldName, $options = array(), $attributes = array()) {
public function radio($fieldName, $options = array(), $attributes = array()) {
$attributes = $this->_initInputField($fieldName, $attributes);
$legend = false;
@ -1104,9 +1096,8 @@ class FormHelper extends AppHelper {
* @param string $fieldName Name of a field, in the form "Modelname.fieldname"
* @param array $options Array of HTML attributes.
* @return string A generated HTML text input element
* @access public
*/
function text($fieldName, $options = array()) {
public function text($fieldName, $options = array()) {
$options = $this->_initInputField($fieldName, array_merge(
array('type' => 'text'), $options
));
@ -1123,9 +1114,8 @@ class FormHelper extends AppHelper {
* @param string $fieldName Name of a field, like in the form "Modelname.fieldname"
* @param array $options Array of HTML attributes.
* @return string A generated password input.
* @access public
*/
function password($fieldName, $options = array()) {
public function password($fieldName, $options = array()) {
$options = $this->_initInputField($fieldName, $options);
return sprintf(
$this->Html->tags['password'],
@ -1144,9 +1134,8 @@ class FormHelper extends AppHelper {
* @param string $fieldName Name of a field, in the form "Modelname.fieldname"
* @param array $options Array of HTML attributes, and special options above.
* @return string A generated HTML text input element
* @access public
*/
function textarea($fieldName, $options = array()) {
public function textarea($fieldName, $options = array()) {
$options = $this->_initInputField($fieldName, $options);
$value = null;
@ -1171,9 +1160,8 @@ class FormHelper extends AppHelper {
* @param string $fieldName Name of a field, in the form of "Modelname.fieldname"
* @param array $options Array of HTML attributes.
* @return string A generated hidden input
* @access public
*/
function hidden($fieldName, $options = array()) {
public function hidden($fieldName, $options = array()) {
$secure = true;
if (isset($options['secure'])) {
@ -1202,9 +1190,8 @@ class FormHelper extends AppHelper {
* @param string $fieldName Name of a field, in the form "Modelname.fieldname"
* @param array $options Array of HTML attributes.
* @return string A generated file input.
* @access public
*/
function file($fieldName, $options = array()) {
public function file($fieldName, $options = array()) {
$options = array_merge($options, array('secure' => false));
$options = $this->_initInputField($fieldName, $options);
$view =& ClassRegistry::getObject('view');
@ -1229,9 +1216,8 @@ class FormHelper extends AppHelper {
* @param string $title The button's caption. Not automatically HTML encoded
* @param array $options Array of options and HTML attributes.
* @return string A HTML button tag.
* @access public
*/
function button($title, $options = array()) {
public function button($title, $options = array()) {
$options += array('type' => 'submit', 'escape' => false);
if ($options['escape']) {
$title = h($title);
@ -1270,9 +1256,8 @@ class FormHelper extends AppHelper {
* OR if the first character is not /, image is relative to webroot/img.
* @param array $options Array of options. See above.
* @return string A HTML submit button
* @access public
*/
function submit($caption = null, $options = array()) {
public function submit($caption = null, $options = array()) {
if (!$caption) {
$caption = __('Submit', true);
}
@ -1381,9 +1366,8 @@ class FormHelper extends AppHelper {
* from POST data will be used when available.
* @param array $attributes The HTML attributes of the select element.
* @return string Formatted SELECT element
* @access public
*/
function select($fieldName, $options = array(), $selected = null, $attributes = array()) {
public function select($fieldName, $options = array(), $selected = null, $attributes = array()) {
$select = array();
$showParents = false;
$escapeOptions = true;
@ -1479,9 +1463,8 @@ class FormHelper extends AppHelper {
* @param string $selected Option which is selected.
* @param array $attributes HTML attributes for the select element
* @return string A generated day select box.
* @access public
*/
function day($fieldName, $selected = null, $attributes = array()) {
public function day($fieldName, $selected = null, $attributes = array()) {
$attributes += array('empty' => true);
$selected = $this->__dateTimeSelected('day', $fieldName, $selected, $attributes);
@ -1509,9 +1492,8 @@ class FormHelper extends AppHelper {
* @param string $selected Option which is selected.
* @param array $attributes Attribute array for the select elements.
* @return string Completed year select input
* @access public
*/
function year($fieldName, $minYear = null, $maxYear = null, $selected = null, $attributes = array()) {
public function year($fieldName, $minYear = null, $maxYear = null, $selected = null, $attributes = array()) {
$attributes += array('empty' => true);
if ((empty($selected) || $selected === true) && $value = $this->value($fieldName)) {
if (is_array($value)) {
@ -1561,9 +1543,8 @@ class FormHelper extends AppHelper {
* @param string $selected Option which is selected.
* @param array $attributes Attributes for the select element
* @return string A generated month select dropdown.
* @access public
*/
function month($fieldName, $selected = null, $attributes = array()) {
public function month($fieldName, $selected = null, $attributes = array()) {
$attributes += array('empty' => true);
$selected = $this->__dateTimeSelected('month', $fieldName, $selected, $attributes);
@ -1597,9 +1578,8 @@ class FormHelper extends AppHelper {
* @param string $selected Option which is selected.
* @param array $attributes List of HTML attributes
* @return string Completed hour select input
* @access public
*/
function hour($fieldName, $format24Hours = false, $selected = null, $attributes = array()) {
public function hour($fieldName, $format24Hours = false, $selected = null, $attributes = array()) {
$attributes += array('empty' => true);
$selected = $this->__dateTimeSelected('hour', $fieldName, $selected, $attributes);
@ -1631,9 +1611,8 @@ class FormHelper extends AppHelper {
* @param string $selected Option which is selected.
* @param string $attributes Array of Attributes
* @return string Completed minute select input.
* @access public
*/
function minute($fieldName, $selected = null, $attributes = array()) {
public function minute($fieldName, $selected = null, $attributes = array()) {
$attributes += array('empty' => true);
$selected = $this->__dateTimeSelected('min', $fieldName, $selected, $attributes);
@ -1694,9 +1673,8 @@ class FormHelper extends AppHelper {
* @param string $attributes Array of Attributes
* @param bool $showEmpty Show/Hide an empty option
* @return string Completed meridian select input
* @access public
*/
function meridian($fieldName, $selected = null, $attributes = array()) {
public function meridian($fieldName, $selected = null, $attributes = array()) {
$attributes += array('empty' => true);
if ((empty($selected) || $selected === true) && $value = $this->value($fieldName)) {
if (is_array($value)) {
@ -1742,9 +1720,8 @@ class FormHelper extends AppHelper {
* @param string $selected Option which is selected.
* @param string $attributes array of Attributes
* @return string Generated set of select boxes for the date and time formats chosen.
* @access public
*/
function dateTime($fieldName, $dateFormat = 'DMY', $timeFormat = '12', $selected = null, $attributes = array()) {
public function dateTime($fieldName, $dateFormat = 'DMY', $timeFormat = '12', $selected = null, $attributes = array()) {
$attributes += array('empty' => true);
$year = $month = $day = $hour = $min = $meridian = null;

View file

@ -137,9 +137,8 @@ class HtmlHelper extends AppHelper {
* @param mixed $options Link attributes e.g. array('id'=>'selected')
* @return void
* @see HtmlHelper::link() for details on $options that can be used.
* @access public
*/
function addCrumb($name, $link = null, $options = null) {
public function addCrumb($name, $link = null, $options = null) {
$this->_crumbs[] = array($name, $link, $options);
}
@ -158,9 +157,8 @@ class HtmlHelper extends AppHelper {
*
* @param string $type Doctype to use.
* @return string Doctype string
* @access public
*/
function docType($type = 'xhtml-strict') {
public function docType($type = 'xhtml-strict') {
if (isset($this->__docTypes[$type])) {
return $this->__docTypes[$type];
}
@ -179,9 +177,8 @@ class HtmlHelper extends AppHelper {
* @param array $options Other attributes for the generated tag. If the type attribute is html,
* rss, atom, or icon, the mime-type is returned.
* @return string A completed `<link />` element.
* @access public
*/
function meta($type, $url = null, $options = array()) {
public function meta($type, $url = null, $options = array()) {
$inline = isset($options['inline']) ? $options['inline'] : true;
unset($options['inline']);
@ -244,9 +241,8 @@ class HtmlHelper extends AppHelper {
* @param string $charset The character set to be used in the meta tag. If empty,
* The App.encoding value will be used. Example: "utf-8".
* @return string A meta tag containing the specified character set.
* @access public
*/
function charset($charset = null) {
public function charset($charset = null) {
if (empty($charset)) {
$charset = strtolower(Configure::read('App.encoding'));
}
@ -271,9 +267,8 @@ class HtmlHelper extends AppHelper {
* @param array $options Array of HTML attributes.
* @param string $confirmMessage JavaScript confirmation message.
* @return string An `<a />` element.
* @access public
*/
function link($title, $url = null, $options = array(), $confirmMessage = false) {
public function link($title, $url = null, $options = array(), $confirmMessage = false) {
$escapeTitle = true;
if ($url !== null) {
$url = $this->url($url);
@ -325,9 +320,8 @@ class HtmlHelper extends AppHelper {
* @param string $rel Rel attribute. Defaults to "stylesheet". If equal to 'import' the stylesheet will be imported.
* @param array $options Array of HTML attributes.
* @return string CSS <link /> or <style /> tag, depending on the type of link.
* @access public
*/
function css($path, $rel = null, $options = array()) {
public function css($path, $rel = null, $options = array()) {
$options += array('inline' => true);
if (is_array($path)) {
$out = '';
@ -397,9 +391,8 @@ class HtmlHelper extends AppHelper {
* @param mixed $options Array of options, and html attributes see above. If boolean sets $options['inline'] = value
* @return mixed String of `<script />` tags or null if $inline is false or if $once is true and the file has been
* included before.
* @access public
*/
function script($url, $options = array()) {
public function script($url, $options = array()) {
if (is_bool($options)) {
list($inline, $options) = array($options, array());
$options['inline'] = $inline;
@ -455,9 +448,8 @@ class HtmlHelper extends AppHelper {
* @param string $script The script to wrap
* @param array $options The options to use.
* @return mixed string or null depending on the value of `$options['inline']`
* @access public
*/
function scriptBlock($script, $options = array()) {
public function scriptBlock($script, $options = array()) {
$options += array('safe' => true, 'inline' => true);
if ($options['safe']) {
$script = "\n" . '//<![CDATA[' . "\n" . $script . "\n" . '//]]>' . "\n";
@ -486,9 +478,8 @@ class HtmlHelper extends AppHelper {
*
* @param array $options Options for the code block.
* @return void
* @access public
*/
function scriptStart($options = array()) {
public function scriptStart($options = array()) {
$options += array('safe' => true, 'inline' => true);
$this->_scriptBlockOptions = $options;
ob_start();
@ -501,9 +492,8 @@ class HtmlHelper extends AppHelper {
* used when the scriptBlock was started
*
* @return mixed depending on the settings of scriptStart() either a script tag or null
* @access public
*/
function scriptEnd() {
public function scriptEnd() {
$buffer = ob_get_clean();
$options = $this->_scriptBlockOptions;
$this->_scriptBlockOptions = array();
@ -525,9 +515,8 @@ class HtmlHelper extends AppHelper {
* @param array $data Style data array, keys will be used as property names, values as property values.
* @param boolean $oneline Whether or not the style block should be displayed on one line.
* @return string CSS styling data
* @access public
*/
function style($data, $oneline = true) {
public function style($data, $oneline = true) {
if (!is_array($data)) {
return $data;
}
@ -547,9 +536,8 @@ class HtmlHelper extends AppHelper {
* @param string $separator Text to separate crumbs.
* @param string $startText This will be the first crumb, if false it defaults to first crumb in array
* @return string Composed bread crumbs
* @access public
*/
function getCrumbs($separator = '&raquo;', $startText = false) {
public function getCrumbs($separator = '&raquo;', $startText = false) {
if (!empty($this->_crumbs)) {
$out = array();
if ($startText) {
@ -587,9 +575,8 @@ class HtmlHelper extends AppHelper {
* @param string $path Path to the image file, relative to the app/webroot/img/ directory.
* @param array $options Array of HTML attributes.
* @return string completed img tag
* @access public
*/
function image($path, $options = array()) {
public function image($path, $options = array()) {
if (is_array($path)) {
$path = $this->url($path);
} elseif (strpos($path, '://') === false) {
@ -624,9 +611,8 @@ class HtmlHelper extends AppHelper {
* @param array $trOptions HTML options for TR elements.
* @param array $thOptions HTML options for TH elements.
* @return string Completed table headers
* @access public
*/
function tableHeaders($names, $trOptions = null, $thOptions = null) {
public function tableHeaders($names, $trOptions = null, $thOptions = null) {
$out = array();
foreach ($names as $arg) {
$out[] = sprintf($this->tags['tableheader'], $this->_parseAttributes($thOptions), $arg);
@ -644,9 +630,8 @@ class HtmlHelper extends AppHelper {
* @param bool $continueOddEven If false, will use a non-static $count variable,
* so that the odd/even count is reset to zero just for that call.
* @return string Formatted HTML
* @access public
*/
function tableCells($data, $oddTrOptions = null, $evenTrOptions = null, $useCount = false, $continueOddEven = true) {
public function tableCells($data, $oddTrOptions = null, $evenTrOptions = null, $useCount = false, $continueOddEven = true) {
if (empty($data[0]) || !is_array($data[0])) {
$data = array($data);
}
@ -700,9 +685,8 @@ class HtmlHelper extends AppHelper {
* If null, only a start tag will be printed
* @param array $options Additional HTML attributes of the DIV tag, see above.
* @return string The formatted tag element
* @access public
*/
function tag($name, $text = null, $options = array()) {
public function tag($name, $text = null, $options = array()) {
if (is_array($options) && isset($options['escape']) && $options['escape']) {
$text = h($text);
unset($options['escape']);
@ -730,9 +714,8 @@ class HtmlHelper extends AppHelper {
* If null, only a start tag will be printed
* @param array $options Additional HTML attributes of the DIV tag
* @return string The formatted DIV element
* @access public
*/
function div($class = null, $text = null, $options = array()) {
public function div($class = null, $text = null, $options = array()) {
if (!empty($class)) {
$options['class'] = $class;
}
@ -750,9 +733,8 @@ class HtmlHelper extends AppHelper {
* @param string $text String content that will appear inside the p element.
* @param array $options Additional HTML attributes of the P tag
* @return string The formatted P element
* @access public
*/
function para($class, $text, $options = array()) {
public function para($class, $text, $options = array()) {
if (isset($options['escape'])) {
$text = h($text);
}
@ -775,9 +757,8 @@ class HtmlHelper extends AppHelper {
* @param array $itemOptions Additional HTML attributes of the list item (LI) tag
* @param string $tag Type of list tag to use (ol/ul)
* @return string The nested list
* @access public
*/
function nestedList($list, $options = array(), $itemOptions = array(), $tag = 'ul') {
public function nestedList($list, $options = array(), $itemOptions = array(), $tag = 'ul') {
if (is_string($options)) {
$tag = $options;
$options = array();

View file

@ -135,9 +135,8 @@ class JavascriptHelper extends AppHelper {
/**
* Constructor. Checks for presence of native PHP JSON extension to use for object encoding
*
* @access public
*/
function __construct($options = array()) {
public function __construct($options = array()) {
if (!empty($options)) {
foreach ($options as $key => $val) {
if (is_numeric($key)) {

View file

@ -120,9 +120,8 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
* @param string $options Array of options for method
* @param string $callbacks Array of callback / special options.
* @return string Composed method string
* @access public
*/
function _methodTemplate($method, $template, $options, $extraSafeKeys = array()) {
public function _methodTemplate($method, $template, $options, $extraSafeKeys = array()) {
$options = $this->_mapOptions($method, $options);
$options = $this->_prepareCallbacks($method, $options);
$callbacks = array_keys($this->_callbackArguments[$method]);
@ -138,9 +137,8 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
*
* @param string $selector The selector that is targeted
* @return object instance of $this. Allows chained methods.
* @access public
*/
function get($selector) {
public function get($selector) {
if ($selector == 'window' || $selector == 'document') {
$this->selection = $this->jQueryObject . '(' . $selector .')';
} else {
@ -161,9 +159,8 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
* @param string $callback The Javascript function you wish to trigger or the function literal
* @param array $options Options for the event.
* @return string completed event handler
* @access public
*/
function event($type, $callback, $options = array()) {
public function event($type, $callback, $options = array()) {
$defaults = array('wrap' => true, 'stop' => true);
$options = array_merge($defaults, $options);
@ -187,9 +184,8 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
*
* @param string $functionBody The code to run on domReady
* @return string completed domReady method
* @access public
*/
function domReady($functionBody) {
public function domReady($functionBody) {
return $this->jQueryObject . '(document).ready(function () {' . $functionBody . '});';
}
@ -199,9 +195,8 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
* @param string $method The method you want to apply to the selection
* @param string $callback The function body you wish to apply during the iteration.
* @return string completed iteration
* @access public
*/
function each($callback) {
public function each($callback) {
return $this->selection . '.each(function () {' . $callback . '});';
}

View file

@ -83,9 +83,8 @@ class JsHelper extends AppHelper {
*
* @param array $settings Settings array contains name of engine helper.
* @return void
* @access public
*/
function __construct($settings = array()) {
public function __construct($settings = array()) {
$className = 'Jquery';
if (is_array($settings) && isset($settings[0])) {
$className = $settings[0];
@ -119,9 +118,8 @@ class JsHelper extends AppHelper {
* @param string $method Method to be called
* @param array $params Parameters for the method being called.
* @return mixed Depends on the return of the dispatched method, or it could be an instance of the EngineHelper
* @access public
*/
function call__($method, $params) {
public function call__($method, $params) {
if (isset($this->{$this->__engineName}) && method_exists($this->{$this->__engineName}, $method)) {
$buffer = false;
if (in_array(strtolower($method), $this->{$this->__engineName}->bufferedMethods)) {
@ -163,9 +161,8 @@ class JsHelper extends AppHelper {
* @param array $options Options to use for encoding JSON. See JsBaseEngineHelper::object() for more details.
* @return string encoded JSON
* @deprecated Remove when support for PHP4 and Object::object are removed.
* @access public
*/
function object($data = array(), $options = array()) {
public function object($data = array(), $options = array()) {
return $this->{$this->__engineName}->object($data, $options);
}
@ -200,9 +197,8 @@ class JsHelper extends AppHelper {
* @param array $options options for the code block
* @return mixed Completed javascript tag if there are scripts, if there are no buffered
* scripts null will be returned.
* @access public
*/
function writeBuffer($options = array()) {
public function writeBuffer($options = array()) {
$domReady = isset($this->params['isAjax']) ? !$this->params['isAjax'] : true;
$defaults = array(
'onDomReady' => $domReady, 'inline' => true,
@ -243,9 +239,8 @@ class JsHelper extends AppHelper {
* @param boolean $top If true the script will be added to the top of the
* buffered scripts array. If false the bottom.
* @return void
* @access public
*/
function buffer($script, $top = false) {
public function buffer($script, $top = false) {
if ($top) {
array_unshift($this->__bufferedScripts, $script);
} else {
@ -258,9 +253,8 @@ class JsHelper extends AppHelper {
*
* @param boolean $clear Whether or not to clear the script caches (default true)
* @return array Array of scripts added to the request.
* @access public
*/
function getBuffer($clear = true) {
public function getBuffer($clear = true) {
$this->_createVars();
$scripts = $this->__bufferedScripts;
if ($clear) {
@ -300,9 +294,8 @@ class JsHelper extends AppHelper {
* @param mixed $url Mixed either a string URL or an cake url array.
* @param array $options Options for both the HTML element and Js::request()
* @return string Completed link. If buffering is disabled a script tag will be returned as well.
* @access public
*/
function link($title, $url = null, $options = array()) {
public function link($title, $url = null, $options = array()) {
if (!isset($options['id'])) {
$options['id'] = 'link-' . intval(mt_rand());
}
@ -336,9 +329,8 @@ class JsHelper extends AppHelper {
* @param mixed $one Either an array of variables to set, or the name of the variable to set.
* @param mixed $two If $one is a string, $two is the value for that key.
* @return void
* @access public
*/
function set($one, $two = null) {
public function set($one, $two = null) {
$data = null;
if (is_array($one)) {
if (is_array($two)) {
@ -366,9 +358,8 @@ class JsHelper extends AppHelper {
* @param string $title The display text of the submit button.
* @param array $options Array of options to use.
* @return string Completed submit button.
* @access public
*/
function submit($caption = null, $options = array()) {
public function submit($caption = null, $options = array()) {
if (!isset($options['id'])) {
$options['id'] = 'submit-' . intval(mt_rand());
}
@ -493,9 +484,8 @@ class JsBaseEngineHelper extends AppHelper {
*
* @param string $message Message you want to alter.
* @return string completed alert()
* @access public
*/
function alert($message) {
public function alert($message) {
return 'alert("' . $this->escape($message) . '");';
}
@ -506,9 +496,8 @@ class JsBaseEngineHelper extends AppHelper {
* @param mixed $url
* @param array $options
* @return string completed redirect in javascript
* @access public
*/
function redirect($url = null) {
public function redirect($url = null) {
return 'window.location = "' . Router::url($url) . '";';
}
@ -517,9 +506,8 @@ class JsBaseEngineHelper extends AppHelper {
*
* @param string $message Message you want confirmed.
* @return string completed confirm()
* @access public
*/
function confirm($message) {
public function confirm($message) {
return 'confirm("' . $this->escape($message) . '");';
}
@ -529,9 +517,8 @@ class JsBaseEngineHelper extends AppHelper {
*
* @param string $message Message to use in the confirm dialog.
* @return string completed confirm with return script
* @access public
*/
function confirmReturn($message) {
public function confirmReturn($message) {
$out = 'var _confirm = ' . $this->confirm($message);
$out .= "if (!_confirm) {\n\treturn false;\n}";
return $out;
@ -543,9 +530,8 @@ class JsBaseEngineHelper extends AppHelper {
* @param string $message Message you want to prompt.
* @param string $default Default message
* @return string completed prompt()
* @access public
*/
function prompt($message, $default = '') {
public function prompt($message, $default = '') {
return 'prompt("' . $this->escape($message) . '", "' . $this->escape($default) . '");';
}
@ -561,9 +547,8 @@ class JsBaseEngineHelper extends AppHelper {
* @param array $data Data to be converted.
* @param array $options Set of options, see above.
* @return string A JSON code block
* @access public
*/
function object($data = array(), $options = array()) {
public function object($data = array(), $options = array()) {
$defaultOptions = array(
'prefix' => '', 'postfix' => '',
);
@ -621,9 +606,8 @@ class JsBaseEngineHelper extends AppHelper {
* @param mixed $val A PHP variable to be converted to JSON
* @param boolean $quoteStrings If false, leaves string values unquoted
* @return string a JavaScript-safe/JSON representation of $val
* @access public
*/
function value($val, $quoteString = true) {
public function value($val, $quoteString = true) {
switch (true) {
case (is_array($val) || is_object($val)):
$val = $this->object($val);
@ -661,9 +645,8 @@ class JsBaseEngineHelper extends AppHelper {
*
* @param string $script String that needs to get escaped.
* @return string Escaped string.
* @access public
*/
function escape($string) {
public function escape($string) {
App::import('Core', 'Multibyte');
return $this->_utf8ToHex($string);
}
@ -769,9 +752,8 @@ class JsBaseEngineHelper extends AppHelper {
*
* @param string $selector The selector that is targeted
* @return object instance of $this. Allows chained methods.
* @access public
*/
function get($selector) {
public function get($selector) {
trigger_error(sprintf(__('%s does not have get() implemented', true), get_class($this)), E_USER_WARNING);
return $this;
}
@ -788,9 +770,8 @@ class JsBaseEngineHelper extends AppHelper {
* @param string $callback The Javascript function you wish to trigger or the function literal
* @param array $options Options for the event.
* @return string completed event handler
* @access public
*/
function event($type, $callback, $options = array()) {
public function event($type, $callback, $options = array()) {
trigger_error(sprintf(__('%s does not have event() implemented', true), get_class($this)), E_USER_WARNING);
}
@ -799,9 +780,8 @@ class JsBaseEngineHelper extends AppHelper {
*
* @param string $functionBody The code to run on domReady
* @return string completed domReady method
* @access public
*/
function domReady($functionBody) {
public function domReady($functionBody) {
trigger_error(sprintf(__('%s does not have domReady() implemented', true), get_class($this)), E_USER_WARNING);
}
@ -837,9 +817,8 @@ class JsBaseEngineHelper extends AppHelper {
* @param string $name The name of the effect to trigger.
* @param array $options Array of options for the effect.
* @return string completed string with effect.
* @access public
*/
function effect($name, $options) {
public function effect($name, $options) {
trigger_error(sprintf(__('%s does not have effect() implemented', true), get_class($this)), E_USER_WARNING);
}
@ -867,9 +846,8 @@ class JsBaseEngineHelper extends AppHelper {
* @param mixed $url Array or String URL to target with the request.
* @param array $options Array of options. See above for cross library supported options
* @return string XHR request.
* @access public
*/
function request($url, $options = array()) {
public function request($url, $options = array()) {
trigger_error(sprintf(__('%s does not have request() implemented', true), get_class($this)), E_USER_WARNING);
}
@ -891,9 +869,8 @@ class JsBaseEngineHelper extends AppHelper {
*
* @param array $options Options array see above.
* @return string Completed drag script
* @access public
*/
function drag($options = array()) {
public function drag($options = array()) {
trigger_error(sprintf(__('%s does not have drag() implemented', true), get_class($this)), E_USER_WARNING);
}
@ -913,9 +890,8 @@ class JsBaseEngineHelper extends AppHelper {
* - `leave` - Event fired when a drag is removed from a drop zone without being dropped.
*
* @return string Completed drop script
* @access public
*/
function drop($options = array()) {
public function drop($options = array()) {
trigger_error(sprintf(__('%s does not have drop() implemented', true), get_class($this)), E_USER_WARNING);
}
@ -939,9 +915,8 @@ class JsBaseEngineHelper extends AppHelper {
*
* @param array $options Array of options for the sortable. See above.
* @return string Completed sortable script.
* @access public
*/
function sortable() {
public function sortable() {
trigger_error(sprintf(__('%s does not have sortable() implemented', true), get_class($this)), E_USER_WARNING);
}
@ -964,9 +939,8 @@ class JsBaseEngineHelper extends AppHelper {
* - `complete` - Fired when the user stops sliding the handle
*
* @return string Completed slider script
* @access public
*/
function slider() {
public function slider() {
trigger_error(sprintf(__('%s does not have slider() implemented', true), get_class($this)), E_USER_WARNING);
}
@ -983,9 +957,8 @@ class JsBaseEngineHelper extends AppHelper {
*
* @param array $options options for serialization generation.
* @return string completed form serialization script
* @access public
*/
function serializeForm() {
public function serializeForm() {
trigger_error(
sprintf(__('%s does not have serializeForm() implemented', true), get_class($this)), E_USER_WARNING
);

View file

@ -69,9 +69,8 @@ class NumberHelper extends AppHelper {
* @param float $number A floating point number.
* @param integer $precision The precision of the returned number.
* @return float Enter description here...
* @access public
*/
function precision($number, $precision = 3) {
public function precision($number, $precision = 3) {
return sprintf("%01.{$precision}f", $number);
}
@ -80,9 +79,8 @@ class NumberHelper extends AppHelper {
*
* @param integer $length Size in bytes
* @return string Human readable size
* @access public
*/
function toReadableSize($size) {
public function toReadableSize($size) {
switch (true) {
case $size < 1024:
return sprintf(__n('%d Byte', '%d Bytes', $size, true), $size);
@ -103,9 +101,8 @@ class NumberHelper extends AppHelper {
* @param float $number A floating point number
* @param integer $precision The precision of the returned number
* @return string Percentage string
* @access public
*/
function toPercentage($number, $precision = 2) {
public function toPercentage($number, $precision = 2) {
return $this->precision($number, $precision) . '%';
}
@ -116,9 +113,8 @@ class NumberHelper extends AppHelper {
* @param integer $options if int then places, if string then before, if (,.-) then use it
* or array with places and before keys
* @return string formatted number
* @access public
*/
function format($number, $options = false) {
public function format($number, $options = false) {
$places = 0;
if (is_int($options)) {
$places = $options;
@ -173,9 +169,8 @@ class NumberHelper extends AppHelper {
* set at least 'before' and 'after' options.
* @param array $options
* @return string Number formatted as a currency.
* @access public
*/
function currency($number, $currency = 'USD', $options = array()) {
public function currency($number, $currency = 'USD', $options = array()) {
$default = $this->_currencyDefaults;
if (isset($this->_currencies[$currency])) {
@ -242,9 +237,8 @@ class NumberHelper extends AppHelper {
* @param array $options The array of options for this format.
* @return void
* @see NumberHelper::currency()
* @access public
*/
function addFormat($formatName, $options) {
public function addFormat($formatName, $options) {
$this->_currencies[$formatName] = $options + $this->_currencyDefaults;
}

View file

@ -102,9 +102,8 @@ class PaginatorHelper extends AppHelper {
* Before render callback. Overridden to merge passed args with url options.
*
* @return void
* @access public
*/
function beforeRender() {
public function beforeRender() {
$this->options['url'] = array_merge($this->params['pass'], $this->params['named']);
parent::beforeRender();
@ -115,9 +114,8 @@ class PaginatorHelper extends AppHelper {
*
* @param string $model Optional model name. Uses the default if none is specified.
* @return array The array of paging parameters for the paginated resultset.
* @access public
*/
function params($model = null) {
public function params($model = null) {
if (empty($model)) {
$model = $this->defaultModel();
}
@ -133,9 +131,8 @@ class PaginatorHelper extends AppHelper {
* @param mixed $options Default options for pagination links. If a string is supplied - it
* is used as the DOM id element to update. See PaginatorHelper::$options for list of keys.
* @return void
* @access public
*/
function options($options = array()) {
public function options($options = array()) {
if (is_string($options)) {
$options = array('update' => $options);
}
@ -166,9 +163,8 @@ class PaginatorHelper extends AppHelper {
*
* @param string $model Optional model name. Uses the default if none is specified.
* @return string The current page number of the recordset.
* @access public
*/
function current($model = null) {
public function current($model = null) {
$params = $this->params($model);
if (isset($params['page'])) {
@ -184,9 +180,8 @@ class PaginatorHelper extends AppHelper {
* @param mixed $options Options for pagination links. See #options for list of keys.
* @return string The name of the key by which the recordset is being sorted, or
* null if the results are not currently sorted.
* @access public
*/
function sortKey($model = null, $options = array()) {
public function sortKey($model = null, $options = array()) {
if (empty($options)) {
$params = $this->params($model);
$options = array_merge($params['defaults'], $params['options']);
@ -217,9 +212,8 @@ class PaginatorHelper extends AppHelper {
* @param mixed $options Options for pagination links. See #options for list of keys.
* @return string The direction by which the recordset is being sorted, or
* null if the results are not currently sorted.
* @access public
*/
function sortDir($model = null, $options = array()) {
public function sortDir($model = null, $options = array()) {
$dir = null;
if (empty($options)) {
@ -253,9 +247,8 @@ class PaginatorHelper extends AppHelper {
* @param string $disabledTitle Title when the link is disabled.
* @param mixed $disabledOptions Options for the disabled pagination link. See #options for list of keys.
* @return string A "previous" link or $disabledTitle text if the link is disabled.
* @access public
*/
function prev($title = '<< Previous', $options = array(), $disabledTitle = null, $disabledOptions = array()) {
public function prev($title = '<< Previous', $options = array(), $disabledTitle = null, $disabledOptions = array()) {
return $this->__pagingLink('Prev', $title, $options, $disabledTitle, $disabledOptions);
}
@ -273,9 +266,8 @@ class PaginatorHelper extends AppHelper {
* @param string $disabledTitle Title when the link is disabled.
* @param mixed $disabledOptions Options for the disabled pagination link. See above for list of keys.
* @return string A "next" link or or $disabledTitle text if the link is disabled.
* @access public
*/
function next($title = 'Next >>', $options = array(), $disabledTitle = null, $disabledOptions = array()) {
public function next($title = 'Next >>', $options = array(), $disabledTitle = null, $disabledOptions = array()) {
return $this->__pagingLink('Next', $title, $options, $disabledTitle, $disabledOptions);
}
@ -294,9 +286,8 @@ class PaginatorHelper extends AppHelper {
* @param array $options Options for sorting link. See above for list of keys.
* @return string A link sorting default by 'asc'. If the resultset is sorted 'asc' by the specified
* key the returned link will sort by 'desc'.
* @access public
*/
function sort($title, $key = null, $options = array()) {
public function sort($title, $key = null, $options = array()) {
$options = array_merge(array('url' => array(), 'model' => null), $options);
$url = $options['url'];
unset($options['url']);
@ -342,9 +333,8 @@ class PaginatorHelper extends AppHelper {
* @param mixed $url Url for the action. See Router::url()
* @param array $options Options for the link. See #options for list of keys.
* @return string A link with pagination parameters.
* @access public
*/
function link($title, $url = array(), $options = array()) {
public function link($title, $url = array(), $options = array()) {
$options = array_merge(array('model' => null, 'escape' => true), $options);
$model = $options['model'];
unset($options['model']);
@ -371,9 +361,8 @@ class PaginatorHelper extends AppHelper {
* @param boolean $asArray Return the url as an array, or a URI string
* @param string $model Which model to paginate on
* @return mixed By default, returns a full pagination URL string for use in non-standard contexts (i.e. JavaScript)
* @access public
*/
function url($options = array(), $asArray = false, $model = null) {
public function url($options = array(), $asArray = false, $model = null) {
$paging = $this->params($model);
$url = array_merge(array_filter(Set::diff(array_merge(
$paging['defaults'], $paging['options']), $paging['defaults'])), $options
@ -438,9 +427,8 @@ class PaginatorHelper extends AppHelper {
*
* @param string $model Optional model name. Uses the default if none is specified.
* @return boolean True if the result set is not at the first page.
* @access public
*/
function hasPrev($model = null) {
public function hasPrev($model = null) {
return $this->__hasPage($model, 'prev');
}
@ -449,9 +437,8 @@ class PaginatorHelper extends AppHelper {
*
* @param string $model Optional model name. Uses the default if none is specified.
* @return boolean True if the result set is not at the last page.
* @access public
*/
function hasNext($model = null) {
public function hasNext($model = null) {
return $this->__hasPage($model, 'next');
}
@ -461,9 +448,8 @@ class PaginatorHelper extends AppHelper {
* @param string $model Optional model name. Uses the default if none is specified.
* @param int $page The page number - if not set defaults to 1.
* @return boolean True if the given result set has the specified page number.
* @access public
*/
function hasPage($model = null, $page = 1) {
public function hasPage($model = null, $page = 1) {
if (is_numeric($model)) {
$page = $model;
$model = null;
@ -494,9 +480,8 @@ class PaginatorHelper extends AppHelper {
* Gets the default model of the paged sets
*
* @return string Model name or null if the pagination isn't initialized.
* @access public
*/
function defaultModel() {
public function defaultModel() {
if ($this->__defaultModel != null) {
return $this->__defaultModel;
}
@ -521,9 +506,8 @@ class PaginatorHelper extends AppHelper {
*
* @param mixed $options Options for the counter string. See #options for list of keys.
* @return string Counter string.
* @access public
*/
function counter($options = array()) {
public function counter($options = array()) {
if (is_string($options)) {
$options = array('format' => $options);
}
@ -599,9 +583,8 @@ class PaginatorHelper extends AppHelper {
*
* @param mixed $options Options for the numbers, (before, after, model, modulus, separator)
* @return string numbers string.
* @access public
*/
function numbers($options = array()) {
public function numbers($options = array()) {
if ($options === true) {
$options = array(
'before' => ' | ', 'after' => ' | ', 'first' => 'first', 'last' => 'last'
@ -715,9 +698,8 @@ class PaginatorHelper extends AppHelper {
* @param mixed $first if string use as label for the link, if numeric print page numbers
* @param mixed $options
* @return string numbers string.
* @access public
*/
function first($first = '<< first', $options = array()) {
public function first($first = '<< first', $options = array()) {
$options = array_merge(
array(
'tag' => 'span',
@ -769,9 +751,8 @@ class PaginatorHelper extends AppHelper {
* @param mixed $last if string use as label for the link, if numeric print page numbers
* @param mixed $options Array of options
* @return string numbers string.
* @access public
*/
function last($last = 'last >>', $options = array()) {
public function last($last = 'last >>', $options = array()) {
$options = array_merge(
array(
'tag' => 'span',

View file

@ -158,9 +158,8 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
*
* @param string $functionBody The code to run on domReady
* @return string completed domReady method
* @access public
*/
function domReady($functionBody) {
public function domReady($functionBody) {
$this->selection = 'document';
return $this->event('dom:loaded', $functionBody, array('stop' => false));
}
@ -171,9 +170,8 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
* @param string $method The method you want to apply to the selection
* @param string $callback The function body you wish to apply during the iteration.
* @return string completed iteration
* @access public
*/
function each($callback) {
public function each($callback) {
return $this->selection . '.each(function (item, index) {' . $callback . '});';
}
@ -229,9 +227,8 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
* @param mixed $url
* @param array $options
* @return string The completed ajax call.
* @access public
*/
function request($url, $options = array()) {
public function request($url, $options = array()) {
$url = '"'. $this->url($url) . '"';
$options = $this->_mapOptions('request', $options);
$type = '.Request';

View file

@ -106,9 +106,8 @@ class RssHelper extends XmlHelper {
*
* @param array $attrib `<rss />` tag attributes
* @return string An RSS document
* @access public
*/
function document($attrib = array(), $content = null) {
public function document($attrib = array(), $content = null) {
if ($content === null) {
$content = $attrib;
$attrib = array();
@ -127,9 +126,8 @@ class RssHelper extends XmlHelper {
* @param mixed $elements Named array elements which are converted to tags
* @param mixed $content Content (`<item />`'s belonging to this channel
* @return string An RSS `<channel />`
* @access public
*/
function channel($attrib = array(), $elements = array(), $content = null) {
public function channel($attrib = array(), $elements = array(), $content = null) {
$view =& ClassRegistry::getObject('view');
if (!isset($elements['title']) && !empty($view->pageTitle)) {
@ -174,9 +172,8 @@ class RssHelper extends XmlHelper {
* @param mixed $callback A string function name, or array containing an object
* and a string method name
* @return string A set of RSS `<item />` elements
* @access public
*/
function items($items, $callback = null) {
public function items($items, $callback = null) {
if ($callback != null) {
$items = array_map($callback, $items);
}
@ -196,9 +193,8 @@ class RssHelper extends XmlHelper {
* @param array $attrib The attributes of the `<item />` element
* @param array $elements The list of elements contained in this `<item />`
* @return string An RSS `<item />` element
* @access public
*/
function item($att = array(), $elements = array()) {
public function item($att = array(), $elements = array()) {
$content = null;
if (isset($elements['link']) && !isset($elements['guid'])) {

View file

@ -63,9 +63,8 @@ class SessionHelper extends CakeSession {
* Turn sessions on if 'Session.start' is set to false in core.php
*
* @param string $base
* @access public
*/
function activate($base = null) {
public function activate($base = null) {
$this->__active = true;
}
@ -77,9 +76,8 @@ class SessionHelper extends CakeSession {
*
* @param string $name the name of the session key you want to read
* @return values from the session vars
* @access public
*/
function read($name = null) {
public function read($name = null) {
if ($this->__active === true && $this->__start()) {
return parent::read($name);
}
@ -93,9 +91,8 @@ class SessionHelper extends CakeSession {
*
* @param string $name
* @return boolean
* @access public
*/
function check($name) {
public function check($name) {
if ($this->__active === true && $this->__start()) {
return parent::check($name);
}
@ -108,9 +105,8 @@ class SessionHelper extends CakeSession {
* In your view: `$session->error();`
*
* @return string last error
* @access public
*/
function error() {
public function error() {
if ($this->__active === true && $this->__start()) {
return parent::error();
}
@ -125,9 +121,8 @@ class SessionHelper extends CakeSession {
*
* @param string $key The [Message.]key you are rendering in the view.
* @return boolean|string Will return the value if $key is set, or false if not set.
* @access public
*/
function flash($key = 'flash') {
public function flash($key = 'flash') {
$out = false;
if ($this->__active === true && $this->__start()) {
@ -159,9 +154,8 @@ class SessionHelper extends CakeSession {
* Used to check is a session is valid in a view
*
* @return boolean
* @access public
*/
function valid() {
public function valid() {
if ($this->__active === true && $this->__start()) {
return parent::valid();
}
@ -172,9 +166,8 @@ class SessionHelper extends CakeSession {
* This method should not be used in a view
*
* @return boolean
* @access public
*/
function write() {
public function write() {
trigger_error(__('You can not write to a Session from the view', true), E_USER_WARNING);
}

View file

@ -54,9 +54,8 @@ class TextHelper extends AppHelper {
* @param string $phrase The phrase that will be searched
* @param array $options An array of html attributes and options.
* @return string The highlighted text
* @access public
*/
function highlight($text, $phrase, $options = array()) {
public function highlight($text, $phrase, $options = array()) {
if (empty($phrase)) {
return $text;
}
@ -98,9 +97,8 @@ class TextHelper extends AppHelper {
*
* @param string $text Text
* @return string The text without links
* @access public
*/
function stripLinks($text) {
public function stripLinks($text) {
return preg_replace('|<a\s+[^>]+>|im', '', preg_replace('|<\/a>|im', '', $text));
}
@ -111,9 +109,8 @@ class TextHelper extends AppHelper {
* @param string $text Text to add links to
* @param array $options Array of HTML options.
* @return string The text with links
* @access public
*/
function autoLinkUrls($text, $options = array()) {
public function autoLinkUrls($text, $options = array()) {
$linkOptions = 'array(';
foreach ($options as $option => $value) {
$value = var_export($value, true);
@ -134,9 +131,8 @@ class TextHelper extends AppHelper {
* @param string $text Text
* @param array $options Array of HTML options.
* @return string The text with links
* @access public
*/
function autoLinkEmails($text, $options = array()) {
public function autoLinkEmails($text, $options = array()) {
$linkOptions = 'array(';
foreach ($options as $option => $value) {
$value = var_export($value, true);
@ -154,9 +150,8 @@ class TextHelper extends AppHelper {
* @param string $text Text
* @param array $options Array of HTML options.
* @return string The text with links
* @access public
*/
function autoLink($text, $options = array()) {
public function autoLink($text, $options = array()) {
return $this->autoLinkEmails($this->autoLinkUrls($text, $options), $options);
}
@ -176,9 +171,8 @@ class TextHelper extends AppHelper {
* @param integer $length Length of returned string, including ellipsis.
* @param array $options An array of html attributes and options.
* @return string Trimmed string.
* @access public
*/
function truncate($text, $length = 100, $options = array()) {
public function truncate($text, $length = 100, $options = array()) {
$default = array(
'ending' => '...', 'exact' => true, 'html' => false
);
@ -276,9 +270,8 @@ class TextHelper extends AppHelper {
* @param integer $radius The amount of characters that will be returned on each side of the founded phrase
* @param string $ending Ending that will be appended
* @return string Modified string
* @access public
*/
function excerpt($text, $phrase, $radius = 100, $ending = '...') {
public function excerpt($text, $phrase, $radius = 100, $ending = '...') {
if (empty($text) or empty($phrase)) {
return $this->truncate($text, $radius * 2, array('ending' => $ending));
}
@ -321,9 +314,8 @@ class TextHelper extends AppHelper {
* @param string $and The word used to join the last and second last items together with. Defaults to 'and'
* @param string $separator The separator used to join all othe other items together. Defaults to ', '
* @return string The glued together string.
* @access public
*/
function toList($list, $and = 'and', $separator = ', ') {
public function toList($list, $and = 'and', $separator = ', ') {
if (count($list) > 1) {
return implode($separator, array_slice($list, null, -1)) . ' ' . $and . ' ' . array_pop($list);
} else {

View file

@ -36,9 +36,8 @@ class TimeHelper extends AppHelper {
* Accepts the special specifier %S which mimics th modifier S for date()
* @param string UNIX timestamp
* @return string windows safe and date() function compatible format for strftime
* @access public
*/
function convertSpecifiers($format, $time = null) {
public function convertSpecifiers($format, $time = null) {
if (!$time) {
$time = time();
}
@ -141,9 +140,8 @@ class TimeHelper extends AppHelper {
* @param string $serverTime UNIX timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return string UNIX timestamp
* @access public
*/
function convert($serverTime, $userOffset) {
public function convert($serverTime, $userOffset) {
$serverOffset = $this->serverOffset();
$gmtTime = $serverTime - $serverOffset;
$userTime = $gmtTime + $userOffset * (60*60);
@ -154,9 +152,8 @@ class TimeHelper extends AppHelper {
* Returns server's offset from GMT in seconds.
*
* @return int Offset
* @access public
*/
function serverOffset() {
public function serverOffset() {
return date('Z', time());
}
@ -166,9 +163,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString Datetime string
* @param int $userOffset User's offset from GMT (in hours)
* @return string Parsed timestamp
* @access public
*/
function fromString($dateString, $userOffset = null) {
public function fromString($dateString, $userOffset = null) {
if (empty($dateString)) {
return false;
}
@ -192,9 +188,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString Datetime string or Unix timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return string Formatted date string
* @access public
*/
function nice($dateString = null, $userOffset = null) {
public function nice($dateString = null, $userOffset = null) {
if ($dateString != null) {
$date = $this->fromString($dateString, $userOffset);
} else {
@ -215,9 +210,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString Datetime string or Unix timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return string Described, relative date string
* @access public
*/
function niceShort($dateString = null, $userOffset = null) {
public function niceShort($dateString = null, $userOffset = null) {
$date = $dateString ? $this->fromString($dateString, $userOffset) : time();
$y = $this->isThisYear($date) ? '' : ' %Y';
@ -242,9 +236,8 @@ class TimeHelper extends AppHelper {
* @param string $fieldName Name of database field to compare with
* @param int $userOffset User's offset from GMT (in hours)
* @return string Partial SQL string.
* @access public
*/
function daysAsSql($begin, $end, $fieldName, $userOffset = null) {
public function daysAsSql($begin, $end, $fieldName, $userOffset = null) {
$begin = $this->fromString($begin, $userOffset);
$end = $this->fromString($end, $userOffset);
$begin = date('Y-m-d', $begin) . ' 00:00:00';
@ -261,9 +254,8 @@ class TimeHelper extends AppHelper {
* @param string $fieldName Name of database field to compare with
* @param int $userOffset User's offset from GMT (in hours)
* @return string Partial SQL string.
* @access public
*/
function dayAsSql($dateString, $fieldName, $userOffset = null) {
public function dayAsSql($dateString, $fieldName, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
return $this->daysAsSql($dateString, $dateString, $fieldName);
}
@ -274,9 +266,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString Datetime string or Unix timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return boolean True if datetime string is today
* @access public
*/
function isToday($dateString, $userOffset = null) {
public function isToday($dateString, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
return date('Y-m-d', $date) == date('Y-m-d', time());
}
@ -286,9 +277,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString
* @param int $userOffset User's offset from GMT (in hours)
* @return boolean True if datetime string is within current week
* @access public
*/
function isThisWeek($dateString, $userOffset = null) {
public function isThisWeek($dateString, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
return date('W Y', $date) == date('W Y', time());
}
@ -298,9 +288,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString
* @param int $userOffset User's offset from GMT (in hours)
* @return boolean True if datetime string is within current month
* @access public
*/
function isThisMonth($dateString, $userOffset = null) {
public function isThisMonth($dateString, $userOffset = null) {
$date = $this->fromString($dateString);
return date('m Y',$date) == date('m Y', time());
}
@ -310,9 +299,8 @@ class TimeHelper extends AppHelper {
*
* @param string $dateString Datetime string or Unix timestamp
* @return boolean True if datetime string is within current year
* @access public
*/
function isThisYear($dateString, $userOffset = null) {
public function isThisYear($dateString, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
return date('Y', $date) == date('Y', time());
}
@ -323,9 +311,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString Datetime string or Unix timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return boolean True if datetime string was yesterday
* @access public
*/
function wasYesterday($dateString, $userOffset = null) {
public function wasYesterday($dateString, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
return date('Y-m-d', $date) == date('Y-m-d', strtotime('yesterday'));
}
@ -336,9 +323,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString Datetime string or Unix timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return boolean True if datetime string was yesterday
* @access public
*/
function isTomorrow($dateString, $userOffset = null) {
public function isTomorrow($dateString, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
return date('Y-m-d', $date) == date('Y-m-d', strtotime('tomorrow'));
}
@ -349,9 +335,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString
* @param boolean $range if true returns a range in Y-m-d format
* @return boolean True if datetime string is within current week
* @access public
*/
function toQuarter($dateString, $range = false) {
public function toQuarter($dateString, $range = false) {
$time = $this->fromString($dateString);
$date = ceil(date('m', $time) / 3);
@ -386,9 +371,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString Datetime string to be represented as a Unix timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return integer Unix timestamp
* @access public
*/
function toUnix($dateString, $userOffset = null) {
public function toUnix($dateString, $userOffset = null) {
return $this->fromString($dateString, $userOffset);
}
@ -398,9 +382,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString Datetime string or Unix timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return string Formatted date string
* @access public
*/
function toAtom($dateString, $userOffset = null) {
public function toAtom($dateString, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
return date('Y-m-d\TH:i:s\Z', $date);
}
@ -411,9 +394,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString Datetime string or Unix timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return string Formatted date string
* @access public
*/
function toRSS($dateString, $userOffset = null) {
public function toRSS($dateString, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
return date("r", $date);
}
@ -441,9 +423,8 @@ class TimeHelper extends AppHelper {
* @param string $dateString Datetime string or Unix timestamp
* @param array $options Default format if timestamp is used in $dateString
* @return string Relative time string.
* @access public
*/
function timeAgoInWords($dateTime, $options = array()) {
public function timeAgoInWords($dateTime, $options = array()) {
$userOffset = null;
if (is_array($options) && isset($options['userOffset'])) {
$userOffset = $options['userOffset'];
@ -622,9 +603,8 @@ class TimeHelper extends AppHelper {
* @param mixed $dateString the datestring or unix timestamp to compare
* @param int $userOffset User's offset from GMT (in hours)
* @return bool
* @access public
*/
function wasWithinLast($timeInterval, $dateString, $userOffset = null) {
public function wasWithinLast($timeInterval, $dateString, $userOffset = null) {
$tmp = str_replace(' ', '', $timeInterval);
if (is_numeric($tmp)) {
$timeInterval = $tmp . ' ' . __('days', true);
@ -645,9 +625,8 @@ class TimeHelper extends AppHelper {
*
* @param string $dateString Datetime string
* @return string Formatted date string
* @access public
*/
function gmt($string = null) {
public function gmt($string = null) {
if ($string != null) {
$string = $this->fromString($string);
} else {
@ -674,9 +653,8 @@ class TimeHelper extends AppHelper {
* @param boolean $invalid flag to ignore results of fromString == false
* @param int $userOffset User's offset from GMT (in hours)
* @return string Formatted date string
* @access public
*/
function format($format, $date = null, $invalid = false, $userOffset = null) {
public function format($format, $date = null, $invalid = false, $userOffset = null) {
$time = $this->fromString($date, $userOffset);
$_time = $this->fromString($format, $userOffset);
@ -699,9 +677,8 @@ class TimeHelper extends AppHelper {
* @param boolean $invalid flag to ignore results of fromString == false
* @param int $userOffset User's offset from GMT (in hours)
* @return string Formatted and translated date string @access public
* @access public
*/
function i18nFormat($date, $format = null, $invalid = false, $userOffset = null) {
public function i18nFormat($date, $format = null, $invalid = false, $userOffset = null) {
$date = $this->fromString($date, $userOffset);
if ($date === false && $invalid !== false) {
return $invalid;

View file

@ -53,9 +53,8 @@ class XmlHelper extends AppHelper {
*
* @param array $attrib Header tag attributes
* @return string XML header
* @access public
*/
function header($attrib = array()) {
public function header($attrib = array()) {
if (Configure::read('App.encoding') !== null) {
$this->encoding = Configure::read('App.encoding');
}
@ -90,9 +89,8 @@ class XmlHelper extends AppHelper {
* @param string $name The namespace name or URI
* @deprecated
* @see Xml::removeNs()
* @access public
*/
function removeNs($name) {
public function removeNs($name) {
return $this->Xml->removeGlobalNamespace($name);
}
@ -104,9 +102,8 @@ class XmlHelper extends AppHelper {
* @param mixed $content XML element content
* @param boolean $endTag Whether the end tag of the element should be printed
* @return string XML
* @access public
*/
function elem($name, $attrib = array(), $content = null, $endTag = true) {
public function elem($name, $attrib = array(), $content = null, $endTag = true) {
$namespace = null;
if (isset($attrib['namespace'])) {
$namespace = $attrib['namespace'];
@ -142,9 +139,8 @@ class XmlHelper extends AppHelper {
* Create closing tag for current element
*
* @return string
* @access public
*/
function closeElem() {
public function closeElem() {
$name = $this->Xml->name();
if ($parent =& $this->Xml->parent()) {
$this->Xml =& $parent;
@ -160,9 +156,8 @@ class XmlHelper extends AppHelper {
* XmlNode::__construct().
* @return string A copy of $data in XML format
* @see XmlNode
* @access public
*/
function serialize($data, $options = array()) {
public function serialize($data, $options = array()) {
$options += array('attributes' => false, 'format' => 'attributes');
$data =& new Xml($data, $options);
return $data->toString($options + array('header' => false));

View file

@ -338,9 +338,8 @@ class View extends Object {
* @param array $params Array of data to be made available to the for rendered
* view (i.e. the Element)
* @return string Rendered Element
* @access public
*/
function element($name, $params = array(), $loadHelpers = false) {
public function element($name, $params = array(), $loadHelpers = false) {
$file = $plugin = $key = null;
if (isset($params['plugin'])) {
@ -403,9 +402,8 @@ class View extends Object {
* @param string $layout Layout to use
* @param string $file Custom filename for view
* @return string Rendered Element
* @access public
*/
function render($action = null, $layout = null, $file = null) {
public function render($action = null, $layout = null, $file = null) {
if ($this->hasRendered) {
return true;
}
@ -454,9 +452,8 @@ class View extends Object {
*
* @param string $content_for_layout Content to render in a view, wrapped by the surrounding layout.
* @return mixed Rendered output, or false on error
* @access public
*/
function renderLayout($content_for_layout, $layout = null) {
public function renderLayout($content_for_layout, $layout = null) {
$layoutFileName = $this->_getLayoutFileName($layout);
if (empty($layoutFileName)) {
return $this->output;
@ -522,9 +519,8 @@ class View extends Object {
* @param string $filename the cache file to include
* @param string $timeStart the page render start time
* @return boolean Success of rendering the cached file.
* @access public
*/
function renderCache($filename, $timeStart) {
public function renderCache($filename, $timeStart) {
ob_start();
include ($filename);
@ -553,9 +549,8 @@ class View extends Object {
* Returns a list of variables available in the current View context
*
* @return array Array of the set view variable names.
* @access public
*/
function getVars() {
public function getVars() {
return array_keys($this->viewVars);
}
@ -564,9 +559,8 @@ class View extends Object {
*
* @param string $var The view var you want the contents of.
* @return mixed The content of the named var if its set, otherwise null.
* @access public
*/
function getVar($var) {
public function getVar($var) {
if (!isset($this->viewVars[$var])) {
return null;
} else {
@ -582,9 +576,8 @@ class View extends Object {
* update/replace a script element.
* @param string $content The content of the script being added, optional.
* @return void
* @access public
*/
function addScript($name, $content = null) {
public function addScript($name, $content = null) {
if (empty($content)) {
if (!in_array($name, array_values($this->__scripts))) {
$this->__scripts[] = $name;
@ -600,9 +593,8 @@ class View extends Object {
* @param string $object Type of object, i.e. 'form' or 'link'
* @param string $url The object's target URL
* @return string
* @access public
*/
function uuid($object, $url) {
public function uuid($object, $url) {
$c = 1;
$url = Router::url($url);
$hash = $object . substr(md5($object . $url), 0, 10);
@ -618,9 +610,8 @@ class View extends Object {
* Returns the entity reference of the current context as an array of identity parts
*
* @return array An array containing the identity elements of an entity
* @access public
*/
function entity() {
public function entity() {
$assoc = ($this->association) ? $this->association : $this->model;
if (!empty($this->entityPath)) {
$path = explode('.', $this->entityPath);
@ -648,9 +639,8 @@ class View extends Object {
* @param mixed $two Value in case $one is a string (which then works as the key).
* Unused if $one is an associative array, otherwise serves as the values to $one's keys.
* @return void
* @access public
*/
function set($one, $two = null) {
public function set($one, $two = null) {
$data = null;
if (is_array($one)) {
if (is_array($two)) {
@ -673,9 +663,8 @@ class View extends Object {
* @param integer $code HTTP Error code (for instance: 404)
* @param string $name Name of the error (for instance: Not Found)
* @param string $message Error message as a web page
* @access public
*/
function error($code, $name, $message) {
public function error($code, $name, $message) {
header ("HTTP/1.1 {$code} {$name}");
print ($this->_render(
$this->_getLayoutFileName('error'),

View file

@ -189,9 +189,8 @@ class XmlNode extends Object {
*
* @param object $object Object to get properties from
* @return array Properties from object
* @access public
*/
function normalize($object, $keyName = null, $options = array()) {
public function normalize($object, $keyName = null, $options = array()) {
if (is_a($object, 'XmlNode')) {
return $object;
}
@ -324,9 +323,8 @@ class XmlNode extends Object {
/**
* Returns the fully-qualified XML node name, with namespace
*
* @access public
*/
function name() {
public function name() {
if (!empty($this->namespace)) {
$_this =& XmlManager::getInstance();
if (!isset($_this->options['verifyNs']) || !$_this->options['verifyNs'] || in_array($this->namespace, array_keys($_this->namespaces))) {
@ -339,9 +337,8 @@ class XmlNode extends Object {
/**
* Sets the parent node of this XmlNode.
*
* @access public
*/
function setParent(&$parent) {
public function setParent(&$parent) {
if (strtolower(get_class($this)) == 'xml') {
return;
}
@ -368,9 +365,8 @@ class XmlNode extends Object {
* Returns a copy of self.
*
* @return object Cloned instance
* @access public
*/
function cloneNode() {
public function cloneNode() {
return clone($this);
}
@ -379,9 +375,8 @@ class XmlNode extends Object {
*
* @param object An XmlNode or subclass instance
* @return boolean True if the nodes match, false otherwise
* @access public
*/
function compare($node) {
public function compare($node) {
$keys = array(get_object_vars($this), get_object_vars($node));
return ($keys[0] === $keys[1]);
}
@ -392,9 +387,8 @@ class XmlNode extends Object {
* @param object $child XmlNode with appended child
* @param array $options XML generator options for objects and arrays
* @return object A reference to the appended child node
* @access public
*/
function &append(&$child, $options = array()) {
public function &append(&$child, $options = array()) {
if (empty($child)) {
$return = false;
return $return;
@ -445,9 +439,8 @@ class XmlNode extends Object {
* Returns first child node, or null if empty.
*
* @return object First XmlNode
* @access public
*/
function &first() {
public function &first() {
if (isset($this->children[0])) {
return $this->children[0];
} else {
@ -460,9 +453,8 @@ class XmlNode extends Object {
* Returns last child node, or null if empty.
*
* @return object Last XmlNode
* @access public
*/
function &last() {
public function &last() {
if (count($this->children) > 0) {
return $this->children[count($this->children) - 1];
} else {
@ -476,9 +468,8 @@ class XmlNode extends Object {
*
* @param string $id Name of child node
* @return object Child XmlNode
* @access public
*/
function &child($id) {
public function &child($id) {
$null = null;
if (is_int($id)) {
@ -502,9 +493,8 @@ class XmlNode extends Object {
*
* @param string $name Tag name of child nodes
* @return array An array of XmlNodes with the given tag name
* @access public
*/
function children($name) {
public function children($name) {
$nodes = array();
$count = count($this->children);
for ($i = 0; $i < $count; $i++) {
@ -519,9 +509,8 @@ class XmlNode extends Object {
* Gets a reference to the next child node in the list of this node's parent.
*
* @return object A reference to the XmlNode object
* @access public
*/
function &nextSibling() {
public function &nextSibling() {
$null = null;
$count = count($this->__parent->children);
for ($i = 0; $i < $count; $i++) {
@ -539,9 +528,8 @@ class XmlNode extends Object {
* Gets a reference to the previous child node in the list of this node's parent.
*
* @return object A reference to the XmlNode object
* @access public
*/
function &previousSibling() {
public function &previousSibling() {
$null = null;
$count = count($this->__parent->children);
for ($i = 0; $i < $count; $i++) {
@ -559,9 +547,8 @@ class XmlNode extends Object {
* Returns parent node.
*
* @return object Parent XmlNode
* @access public
*/
function &parent() {
public function &parent() {
return $this->__parent;
}
@ -569,9 +556,8 @@ class XmlNode extends Object {
* Returns the XML document to which this node belongs
*
* @return object Parent XML object
* @access public
*/
function &document() {
public function &document() {
$document =& $this;
while (true) {
if (get_class($document) == 'Xml' || $document == null) {
@ -586,9 +572,8 @@ class XmlNode extends Object {
* Returns true if this structure has child nodes.
*
* @return bool
* @access public
*/
function hasChildren() {
public function hasChildren() {
if (is_array($this->children) && !empty($this->children)) {
return true;
}
@ -599,9 +584,8 @@ class XmlNode extends Object {
* Returns this XML structure as a string.
*
* @return string String representation of the XML structure.
* @access public
*/
function toString($options = array(), $depth = 0) {
public function toString($options = array(), $depth = 0) {
if (is_int($options)) {
$depth = $options;
$options = array();
@ -683,9 +667,8 @@ class XmlNode extends Object {
*
* @param boolean $camelize true will camelize child nodes, false will not alter node names
* @return array Array representation
* @access public
*/
function toArray($camelize = true) {
public function toArray($camelize = true) {
$out = $this->attributes;
$multi = null;
@ -891,9 +874,8 @@ class Xml extends XmlNode {
*
* @param string $input XML string, a path to a file, or an HTTP resource to load
* @return boolean Success
* @access public
*/
function load($input) {
public function load($input) {
if (!is_string($input)) {
return false;
}
@ -994,9 +976,8 @@ class Xml extends XmlNode {
* @param string $msg Error message
* @param integer $code Error code
* @param integer $line Line in file
* @access public
*/
function error($msg, $code = 0, $line = 0) {
public function error($msg, $code = 0, $line = 0) {
if (Configure::read('debug')) {
echo $msg . " " . $code . " " . $line;
}
@ -1007,9 +988,8 @@ class Xml extends XmlNode {
*
* @param integer $code Error code
* @return string Error message
* @access public
*/
function getError($code) {
public function getError($code) {
$r = @xml_error_string($code);
return $r;
}
@ -1020,9 +1000,8 @@ class Xml extends XmlNode {
* Get next element. NOT implemented.
*
* @return object
* @access public
*/
function &next() {
public function &next() {
$return = null;
return $return;
}
@ -1031,9 +1010,8 @@ class Xml extends XmlNode {
* Get previous element. NOT implemented.
*
* @return object
* @access public
*/
function &previous() {
public function &previous() {
$return = null;
return $return;
}
@ -1042,9 +1020,8 @@ class Xml extends XmlNode {
* Get parent element. NOT implemented.
*
* @return object
* @access public
*/
function &parent() {
public function &parent() {
$return = null;
return $return;
}
@ -1086,9 +1063,8 @@ class Xml extends XmlNode {
* Return string representation of current object.
*
* @return string String representation
* @access public
*/
function toString($options = array()) {
public function toString($options = array()) {
if (is_bool($options)) {
$options = array('header' => $options);
}
@ -1379,9 +1355,8 @@ class XmlTextNode extends XmlNode {
* Return string representation of current text node object.
*
* @return string String representation
* @access public
*/
function toString($options = array(), $depth = 0) {
public function toString($options = array(), $depth = 0) {
if (is_int($options)) {
$depth = $options;
$options = array();
@ -1453,9 +1428,8 @@ class XmlManager {
* Returns a reference to the global XML object that manages app-wide XML settings
*
* @return object
* @access public
*/
function &getInstance() {
public function &getInstance() {
static $instance = array();
if (!$instance) {

View file

@ -32,9 +32,8 @@ class BasicsTest extends CakeTestCase {
* setUp method
*
* @return void
* @access public
*/
function setUp() {
public function setUp() {
App::build(array(
'locales' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'locale' . DS)
));
@ -45,9 +44,8 @@ class BasicsTest extends CakeTestCase {
* tearDown method
*
* @return void
* @access public
*/
function tearDown() {
public function tearDown() {
App::build();
Configure::write('Config.language', $this->_language);
}
@ -56,9 +54,8 @@ class BasicsTest extends CakeTestCase {
* test the array_diff_key compatibility function.
*
* @return void
* @access public
*/
function testArrayDiffKey() {
public function testArrayDiffKey() {
$one = array('one' => 1, 'two' => 2, 'three' => 3);
$two = array('one' => 'one', 'two' => 'two');
$result = array_diff_key($one, $two);
@ -87,9 +84,8 @@ class BasicsTest extends CakeTestCase {
* testHttpBase method
*
* @return void
* @access public
*/
function testEnv() {
public function testEnv() {
$this->skipIf(!function_exists('ini_get') || ini_get('safe_mode') === '1', '%s safe mode is on');
$__SERVER = $_SERVER;
@ -194,9 +190,8 @@ class BasicsTest extends CakeTestCase {
* Test h()
*
* @return void
* @access public
*/
function testH() {
public function testH() {
$string = '<foo>';
$result = h($string);
$this->assertEqual('&lt;foo&gt;', $result);
@ -211,9 +206,8 @@ class BasicsTest extends CakeTestCase {
* Test a()
*
* @return void
* @access public
*/
function testA() {
public function testA() {
$result = a('this', 'that', 'bar');
$this->assertEqual(array('this', 'that', 'bar'), $result);
}
@ -222,9 +216,8 @@ class BasicsTest extends CakeTestCase {
* Test aa()
*
* @return void
* @access public
*/
function testAa() {
public function testAa() {
$result = aa('a', 'b', 'c', 'd');
$expected = array('a' => 'b', 'c' => 'd');
$this->assertEqual($expected, $result);
@ -238,9 +231,8 @@ class BasicsTest extends CakeTestCase {
* Test am()
*
* @return void
* @access public
*/
function testAm() {
public function testAm() {
$result = am(array('one', 'two'), 2, 3, 4);
$expected = array('one', 'two', 2, 3, 4);
$this->assertEqual($result, $expected);
@ -254,9 +246,8 @@ class BasicsTest extends CakeTestCase {
* test cache()
*
* @return void
* @access public
*/
function testCache() {
public function testCache() {
$_cacheDisable = Configure::read('Cache.disable');
if ($this->skipIf($_cacheDisable, 'Cache is disabled, skipping cache() tests. %s')) {
return;
@ -290,9 +281,8 @@ class BasicsTest extends CakeTestCase {
* test clearCache()
*
* @return void
* @access public
*/
function testClearCache() {
public function testClearCache() {
$cacheOff = Configure::read('Cache.disable');
if ($this->skipIf($cacheOff, 'Cache is disabled, skipping clearCache() tests. %s')) {
return;
@ -355,9 +345,8 @@ class BasicsTest extends CakeTestCase {
* test __()
*
* @return void
* @access public
*/
function test__() {
public function test__() {
Configure::write('Config.language', 'rule_1_po');
$result = __('Plural Rule 1', true);
@ -379,9 +368,8 @@ class BasicsTest extends CakeTestCase {
* test __n()
*
* @return void
* @access public
*/
function test__n() {
public function test__n() {
Configure::write('Config.language', 'rule_1_po');
$result = __n('%d = 1', '%d = 0 or > 1', 0, true);
@ -407,9 +395,8 @@ class BasicsTest extends CakeTestCase {
* test __d()
*
* @return void
* @access public
*/
function test__d() {
public function test__d() {
Configure::write('Config.language', 'rule_1_po');
$result = __d('default', 'Plural Rule 1', true);
@ -435,9 +422,8 @@ class BasicsTest extends CakeTestCase {
* test __dn()
*
* @return void
* @access public
*/
function test__dn() {
public function test__dn() {
Configure::write('Config.language', 'rule_1_po');
$result = __dn('default', '%d = 1', '%d = 0 or > 1', 0, true);
@ -467,9 +453,8 @@ class BasicsTest extends CakeTestCase {
* test __c()
*
* @return void
* @access public
*/
function test__c() {
public function test__c() {
Configure::write('Config.language', 'rule_1_po');
$result = __c('Plural Rule 1', 6, true);
@ -491,9 +476,8 @@ class BasicsTest extends CakeTestCase {
* test __dc()
*
* @return void
* @access public
*/
function test__dc() {
public function test__dc() {
Configure::write('Config.language', 'rule_1_po');
$result = __dc('default', 'Plural Rule 1', 6, true);
@ -523,9 +507,8 @@ class BasicsTest extends CakeTestCase {
* test __dcn()
*
* @return void
* @access public
*/
function test__dcn() {
public function test__dcn() {
Configure::write('Config.language', 'rule_1_po');
$result = __dcn('default', '%d = 1', '%d = 0 or > 1', 0, 6, true);
@ -551,9 +534,8 @@ class BasicsTest extends CakeTestCase {
* test LogError()
*
* @return void
* @access public
*/
function testLogError() {
public function testLogError() {
@unlink(LOGS . 'error.log');
LogError('Testing LogError() basic function');
@ -569,9 +551,8 @@ class BasicsTest extends CakeTestCase {
* test fileExistsInPath()
*
* @return void
* @access public
*/
function testFileExistsInPath() {
public function testFileExistsInPath() {
$this->skipUnless(function_exists('ini_set'), '%s ini_set function not available');
$_includePath = ini_get('include_path');
@ -614,9 +595,8 @@ class BasicsTest extends CakeTestCase {
* test convertSlash()
*
* @return void
* @access public
*/
function testConvertSlash() {
public function testConvertSlash() {
$result = convertSlash('\path\to\location\\');
$expected = '\path\to\location\\';
$this->assertEqual($result, $expected);
@ -630,9 +610,8 @@ class BasicsTest extends CakeTestCase {
* test debug()
*
* @return void
* @access public
*/
function testDebug() {
public function testDebug() {
ob_start();
debug('this-is-a-test');
$result = ob_get_clean();
@ -654,9 +633,8 @@ class BasicsTest extends CakeTestCase {
* test pr()
*
* @return void
* @access public
*/
function testPr() {
public function testPr() {
ob_start();
pr('this is a test');
$result = ob_get_clean();
@ -674,9 +652,8 @@ class BasicsTest extends CakeTestCase {
* test params()
*
* @return void
* @access public
*/
function testParams() {
public function testParams() {
$this->assertNull(params('weekend'));
$this->assertNull(params(array()));
$this->assertEqual(params(array('weekend')), array('weekend'));
@ -692,9 +669,8 @@ class BasicsTest extends CakeTestCase {
* test stripslashes_deep()
*
* @return void
* @access public
*/
function testStripslashesDeep() {
public function testStripslashesDeep() {
$this->skipIf(ini_get('magic_quotes_sybase') === '1', '%s magic_quotes_sybase is on');
$this->assertEqual(stripslashes_deep("tes\'t"), "tes't");
@ -730,9 +706,8 @@ class BasicsTest extends CakeTestCase {
* test stripslashes_deep() with magic_quotes_sybase on
*
* @return void
* @access public
*/
function testStripslashesDeepSybase() {
public function testStripslashesDeepSybase() {
$this->skipUnless(ini_get('magic_quotes_sybase') === '1', '%s magic_quotes_sybase is off');
$this->assertEqual(stripslashes_deep("tes\'t"), "tes\'t");
@ -764,9 +739,8 @@ class BasicsTest extends CakeTestCase {
* test ife()
*
* @return void
* @access public
*/
function testIfe() {
public function testIfe() {
$this->assertEqual(ife(true, 'a', 'b'), 'a');
$this->assertEqual(ife(' ', 'a', 'b'), 'a');
$this->assertEqual(ife('test', 'a', 'b'), 'a');

View file

@ -91,9 +91,8 @@ class TestShellDispatcher extends ShellDispatcher {
* stderr method
*
* @return void
* @access public
*/
function stderr($string) {
public function stderr($string) {
$this->stderr .= rtrim($string, ' ');
}
@ -101,9 +100,8 @@ class TestShellDispatcher extends ShellDispatcher {
* stdout method
*
* @return void
* @access public
*/
function stdout($string, $newline = true) {
public function stdout($string, $newline = true) {
if ($newline) {
$this->stdout .= rtrim($string, ' ') . "\n";
} else {
@ -115,9 +113,8 @@ class TestShellDispatcher extends ShellDispatcher {
* clear method
*
* @return void
* @access public
*/
function clear() {
public function clear() {
}
@ -137,9 +134,8 @@ class TestShellDispatcher extends ShellDispatcher {
*
* @param mixed $plugin
* @return mixed
* @access public
*/
function getShell($plugin = null) {
public function getShell($plugin = null) {
return $this->_getShell($plugin);
}
@ -170,9 +166,8 @@ class ShellDispatcherTest extends CakeTestCase {
* setUp method
*
* @return void
* @access public
*/
function setUp() {
public function setUp() {
App::build(array(
'plugins' => array(
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS
@ -188,9 +183,8 @@ class ShellDispatcherTest extends CakeTestCase {
* tearDown method
*
* @return void
* @access public
*/
function tearDown() {
public function tearDown() {
App::build();
}
@ -198,9 +192,8 @@ class ShellDispatcherTest extends CakeTestCase {
* testParseParams method
*
* @return void
* @access public
*/
function testParseParams() {
public function testParseParams() {
$Dispatcher =& new TestShellDispatcher();
$params = array(
@ -457,9 +450,8 @@ class ShellDispatcherTest extends CakeTestCase {
* testBuildPaths method
*
* @return void
* @access public
*/
function testBuildPaths() {
public function testBuildPaths() {
$Dispatcher =& new TestShellDispatcher();
$result = $Dispatcher->shellPaths;
@ -480,9 +472,8 @@ class ShellDispatcherTest extends CakeTestCase {
* Verify loading of (plugin-) shells
*
* @return void
* @access public
*/
function testGetShell() {
public function testGetShell() {
$this->skipIf(class_exists('SampleShell'), '%s SampleShell Class already loaded');
$this->skipIf(class_exists('ExampleShell'), '%s ExampleShell Class already loaded');
@ -509,9 +500,8 @@ class ShellDispatcherTest extends CakeTestCase {
* Verify correct dispatch of Shell subclasses with a main method
*
* @return void
* @access public
*/
function testDispatchShellWithMain() {
public function testDispatchShellWithMain() {
Mock::generate('Shell', 'MockWithMainShell', array('main', '_secret'));
$Dispatcher =& new TestShellDispatcher();
@ -600,9 +590,8 @@ class ShellDispatcherTest extends CakeTestCase {
* Verify correct dispatch of Shell subclasses without a main method
*
* @return void
* @access public
*/
function testDispatchShellWithoutMain() {
public function testDispatchShellWithoutMain() {
Mock::generate('Shell', 'MockWithoutMainShell', array('initDb', '_secret'));
$Dispatcher =& new TestShellDispatcher();
@ -672,9 +661,8 @@ class ShellDispatcherTest extends CakeTestCase {
* Verify correct dispatch of custom classes with a main method
*
* @return void
* @access public
*/
function testDispatchNotAShellWithMain() {
public function testDispatchNotAShellWithMain() {
Mock::generate('Object', 'MockWithMainNotAShell',
array('main', 'initialize', 'loadTasks', 'startup', '_secret'));
@ -752,9 +740,8 @@ class ShellDispatcherTest extends CakeTestCase {
* Verify correct dispatch of custom classes without a main method
*
* @return void
* @access public
*/
function testDispatchNotAShellWithoutMain() {
public function testDispatchNotAShellWithoutMain() {
Mock::generate('Object', 'MockWithoutMainNotAShell',
array('initDb', 'initialize', 'loadTasks', 'startup', '_secret'));
@ -823,9 +810,8 @@ class ShellDispatcherTest extends CakeTestCase {
* the name of the task
*
* @return void
* @access public
*/
function testDispatchTask() {
public function testDispatchTask() {
Mock::generate('Shell', 'MockWeekShell', array('main'));
Mock::generate('Shell', 'MockOnSundayTask', array('execute'));
@ -871,9 +857,8 @@ class ShellDispatcherTest extends CakeTestCase {
* Verify shifting of arguments
*
* @return void
* @access public
*/
function testShiftArgs() {
public function testShiftArgs() {
$Dispatcher =& new TestShellDispatcher();
$Dispatcher->args = array('a', 'b', 'c');
@ -901,9 +886,8 @@ class ShellDispatcherTest extends CakeTestCase {
* testHelpCommand method
*
* @return void
* @access public
*/
function testHelpCommand() {
public function testHelpCommand() {
$Dispatcher =& new TestShellDispatcher();
$expected = "/example \[.*TestPlugin, TestPluginTwo.*\]/";

View file

@ -65,9 +65,8 @@ class AclShellTest extends CakeTestCase {
* configure Configure for testcase
*
* @return void
* @access public
*/
function startCase() {
public function startCase() {
$this->_aclDb = Configure::read('Acl.database');
$this->_aclClass = Configure::read('Acl.classname');
@ -79,9 +78,8 @@ class AclShellTest extends CakeTestCase {
* restore Environment settings
*
* @return void
* @access public
*/
function endCase() {
public function endCase() {
Configure::write('Acl.database', $this->_aclDb);
Configure::write('Acl.classname', $this->_aclClass);
}
@ -90,9 +88,8 @@ class AclShellTest extends CakeTestCase {
* startTest method
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatcher =& new TestAclShellMockShellDispatcher();
$this->Task =& new MockAclShell($this->Dispatcher);
$this->Task->Dispatch =& $this->Dispatcher;
@ -106,9 +103,8 @@ class AclShellTest extends CakeTestCase {
* endTest method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
ClassRegistry::flush();
}
@ -116,9 +112,8 @@ class AclShellTest extends CakeTestCase {
* test that model.foreign_key output works when looking at acl rows
*
* @return void
* @access public
*/
function testViewWithModelForeignKeyOutput() {
public function testViewWithModelForeignKeyOutput() {
$this->Task->command = 'view';
$this->Task->startup();
$data = array(
@ -142,9 +137,8 @@ class AclShellTest extends CakeTestCase {
* test view with an argument
*
* @return void
* @access public
*/
function testViewWithArgument() {
public function testViewWithArgument() {
$this->Task->args = array('aro', 'admins');
$this->Task->expectAt(0, 'out', array('Aro tree:'));
$this->Task->expectAt(1, 'out', array(' [2] admins'));
@ -157,9 +151,8 @@ class AclShellTest extends CakeTestCase {
* test the method that splits model.foreign key. and that it returns an array.
*
* @return void
* @access public
*/
function testParsingModelAndForeignKey() {
public function testParsingModelAndForeignKey() {
$result = $this->Task->parseIdentifier('Model.foreignKey');
$expected = array('model' => 'Model', 'foreign_key' => 'foreignKey');
@ -174,9 +167,8 @@ class AclShellTest extends CakeTestCase {
* test creating aro/aco nodes
*
* @return void
* @access public
*/
function testCreate() {
public function testCreate() {
$this->Task->args = array('aro', 'root', 'User.1');
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/created/'), '*'));
$this->Task->create();
@ -215,9 +207,8 @@ class AclShellTest extends CakeTestCase {
* test the delete method with different node types.
*
* @return void
* @access public
*/
function testDelete() {
public function testDelete() {
$this->Task->args = array('aro', 'AuthUser.1');
$this->Task->expectAt(0, 'out', array(new NoPatternExpectation('/not/'), true));
$this->Task->delete();
@ -231,9 +222,8 @@ class AclShellTest extends CakeTestCase {
* test setParent method.
*
* @return void
* @access public
*/
function testSetParent() {
public function testSetParent() {
$this->Task->args = array('aro', 'AuthUser.2', 'root');
$this->Task->setParent();
@ -246,9 +236,8 @@ class AclShellTest extends CakeTestCase {
* test grant
*
* @return void
* @access public
*/
function testGrant() {
public function testGrant() {
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create');
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission granted/'), true));
$this->Task->grant();
@ -262,9 +251,8 @@ class AclShellTest extends CakeTestCase {
* test deny
*
* @return void
* @access public
*/
function testDeny() {
public function testDeny() {
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create');
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission denied/'), true));
$this->Task->deny();
@ -278,9 +266,8 @@ class AclShellTest extends CakeTestCase {
* test checking allowed and denied perms
*
* @return void
* @access public
*/
function testCheck() {
public function testCheck() {
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', '*');
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/not allowed/'), true));
$this->Task->check();
@ -302,9 +289,8 @@ class AclShellTest extends CakeTestCase {
* test inherit and that it 0's the permission fields.
*
* @return void
* @access public
*/
function testInherit() {
public function testInherit() {
$this->Task->args = array('AuthUser.2', 'ROOT/Controller1', 'create');
$this->Task->expectAt(0, 'out', array(new PatternExpectation('/Permission granted/'), true));
$this->Task->grant();
@ -322,9 +308,8 @@ class AclShellTest extends CakeTestCase {
* test getting the path for an aro/aco
*
* @return void
* @access public
*/
function testGetPath() {
public function testGetPath() {
$this->Task->args = array('aro', 'AuthUser.2');
$this->Task->expectAt(1, 'out', array('[1] ROOT'));
$this->Task->expectAt(2, 'out', array(' [2] admins'));

View file

@ -55,9 +55,8 @@ class ApiShellTest extends CakeTestCase {
* setUp method
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatcher =& new ApiShellMockShellDispatcher();
$this->Shell =& new MockApiShell($this->Dispatcher);
$this->Shell->Dispatch =& $this->Dispatcher;
@ -67,9 +66,8 @@ class ApiShellTest extends CakeTestCase {
* tearDown method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
ClassRegistry::flush();
}
@ -77,9 +75,8 @@ class ApiShellTest extends CakeTestCase {
* Test that method names are detected properly including those with no arguments.
*
* @return void
* @access public
*/
function testMethodNameDetection () {
public function testMethodNameDetection () {
$this->Shell->setReturnValueAt(0, 'in', 'q');
$this->Shell->expectAt(0, 'out', array('Controller'));
$expected = array(

View file

@ -69,9 +69,8 @@ class BakeShellTestCase extends CakeTestCase {
* start test
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatch =& new BakeShellMockShellDispatcher();
$this->Shell =& new MockBakeShell();
$this->Shell->Dispatch =& $this->Dispatch;
@ -82,9 +81,8 @@ class BakeShellTestCase extends CakeTestCase {
* endTest method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
unset($this->Dispatch, $this->Shell);
}
@ -92,9 +90,8 @@ class BakeShellTestCase extends CakeTestCase {
* test bake all
*
* @return void
* @access public
*/
function testAllWithModelName() {
public function testAllWithModelName() {
App::import('Model', 'User');
$userExists = class_exists('User');
if ($this->skipIf($userExists, 'User class exists, cannot test `bake all [param]`. %s')) {

View file

@ -129,9 +129,8 @@ class SchemaShellTest extends CakeTestCase {
* startTest method
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatcher =& new TestSchemaShellMockShellDispatcher();
$this->Shell =& new MockSchemaShell($this->Dispatcher);
$this->Shell->Dispatch =& $this->Dispatcher;
@ -141,9 +140,8 @@ class SchemaShellTest extends CakeTestCase {
* endTest method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
ClassRegistry::flush();
}
@ -151,9 +149,8 @@ class SchemaShellTest extends CakeTestCase {
* test startup method
*
* @return void
* @access public
*/
function testStartup() {
public function testStartup() {
$this->Shell->startup();
$this->assertTrue(isset($this->Shell->Schema));
$this->assertTrue(is_a($this->Shell->Schema, 'CakeSchema'));
@ -187,9 +184,8 @@ class SchemaShellTest extends CakeTestCase {
* Test View - and that it dumps the schema file to stdout
*
* @return void
* @access public
*/
function testView() {
public function testView() {
$this->Shell->startup();
$this->Shell->Schema->path = APP . 'config' . DS . 'schema';
$this->Shell->params['file'] = 'i18n.php';
@ -202,9 +198,8 @@ class SchemaShellTest extends CakeTestCase {
* test that view() can find plugin schema files.
*
* @return void
* @access public
*/
function testViewWithPlugins() {
public function testViewWithPlugins() {
App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
@ -226,9 +221,8 @@ class SchemaShellTest extends CakeTestCase {
* test dump() with sql file generation
*
* @return void
* @access public
*/
function testDumpWithFileWriting() {
public function testDumpWithFileWriting() {
$this->Shell->params = array(
'name' => 'i18n',
'write' => TMP . 'tests' . DS . 'i18n.sql'
@ -255,9 +249,8 @@ class SchemaShellTest extends CakeTestCase {
* test that dump() can find and work with plugin schema files.
*
* @return void
* @access public
*/
function testDumpFileWritingWithPlugins() {
public function testDumpFileWritingWithPlugins() {
App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
@ -285,9 +278,8 @@ class SchemaShellTest extends CakeTestCase {
* test generate with snapshot generation
*
* @return void
* @access public
*/
function testGenerateSnaphot() {
public function testGenerateSnaphot() {
$this->Shell->path = TMP;
$this->Shell->params['file'] = 'schema.php';
$this->Shell->args = array('snapshot');
@ -305,9 +297,8 @@ class SchemaShellTest extends CakeTestCase {
* test generate without a snapshot.
*
* @return void
* @access public
*/
function testGenerateNoOverwrite() {
public function testGenerateNoOverwrite() {
touch(TMP . 'schema.php');
$this->Shell->params['file'] = 'schema.php';
$this->Shell->args = array();
@ -325,9 +316,8 @@ class SchemaShellTest extends CakeTestCase {
* test generate with overwriting of the schema files.
*
* @return void
* @access public
*/
function testGenerateOverwrite() {
public function testGenerateOverwrite() {
touch(TMP . 'schema.php');
$this->Shell->params['file'] = 'schema.php';
$this->Shell->args = array();
@ -351,9 +341,8 @@ class SchemaShellTest extends CakeTestCase {
* in a plugin.
*
* @return void
* @access public
*/
function testGenerateWithPlugins() {
public function testGenerateWithPlugins() {
App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
@ -383,9 +372,8 @@ class SchemaShellTest extends CakeTestCase {
* Test schema run create with no table args.
*
* @return void
* @access public
*/
function testCreateNoArgs() {
public function testCreateNoArgs() {
$this->Shell->params = array(
'connection' => 'test_suite',
'path' => APP . 'config' . DS . 'sql'
@ -407,9 +395,8 @@ class SchemaShellTest extends CakeTestCase {
* Test schema run create with no table args.
*
* @return void
* @access public
*/
function testCreateWithTableArgs() {
public function testCreateWithTableArgs() {
$this->Shell->params = array(
'connection' => 'test_suite',
'name' => 'DbAcl',
@ -433,9 +420,8 @@ class SchemaShellTest extends CakeTestCase {
* test run update with a table arg.
*
* @return void
* @access public
*/
function testUpdateWithTable() {
public function testUpdateWithTable() {
$this->Shell->params = array(
'connection' => 'test_suite',
'f' => true
@ -457,9 +443,8 @@ class SchemaShellTest extends CakeTestCase {
* test that the plugin param creates the correct path in the schema object.
*
* @return void
* @access public
*/
function testPluginParam() {
public function testPluginParam() {
App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));
@ -478,9 +463,8 @@ class SchemaShellTest extends CakeTestCase {
* test that using Plugin.name with write.
*
* @return void
* @access public
*/
function testPluginDotSyntaxWithCreate() {
public function testPluginDotSyntaxWithCreate() {
App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
));

View file

@ -114,9 +114,8 @@ class ShellTest extends CakeTestCase {
* setUp method
*
* @return void
* @access public
*/
function setUp() {
public function setUp() {
$this->Dispatcher =& new TestShellMockShellDispatcher();
$this->Shell =& new TestShell($this->Dispatcher);
}
@ -125,9 +124,8 @@ class ShellTest extends CakeTestCase {
* tearDown method
*
* @return void
* @access public
*/
function tearDown() {
public function tearDown() {
ClassRegistry::flush();
}
@ -135,9 +133,8 @@ class ShellTest extends CakeTestCase {
* testConstruct method
*
* @return void
* @access public
*/
function testConstruct() {
public function testConstruct() {
$this->assertIsA($this->Shell->Dispatch, 'TestShellMockShellDispatcher');
$this->assertEqual($this->Shell->name, 'TestShell');
$this->assertEqual($this->Shell->alias, 'TestShell');
@ -147,9 +144,8 @@ class ShellTest extends CakeTestCase {
* testInitialize method
*
* @return void
* @access public
*/
function testInitialize() {
public function testInitialize() {
App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS),
'models' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'models' . DS)
@ -180,9 +176,8 @@ class ShellTest extends CakeTestCase {
* testIn method
*
* @return void
* @access public
*/
function testIn() {
public function testIn() {
$this->Shell->Dispatch->setReturnValueAt(0, 'getInput', 'n');
$this->Shell->Dispatch->expectAt(0, 'getInput', array('Just a test?', array('y', 'n'), 'n'));
$result = $this->Shell->in('Just a test?', array('y', 'n'), 'n');
@ -218,9 +213,8 @@ class ShellTest extends CakeTestCase {
* testOut method
*
* @return void
* @access public
*/
function testOut() {
public function testOut() {
$this->Shell->Dispatch->expectAt(0, 'stdout', array("Just a test\n", false));
$this->Shell->out('Just a test');
@ -238,9 +232,8 @@ class ShellTest extends CakeTestCase {
* testErr method
*
* @return void
* @access public
*/
function testErr() {
public function testErr() {
$this->Shell->Dispatch->expectAt(0, 'stderr', array("Just a test\n"));
$this->Shell->err('Just a test');
@ -258,9 +251,8 @@ class ShellTest extends CakeTestCase {
* testNl
*
* @return void
* @access public
*/
function testNl() {
public function testNl() {
$this->assertEqual($this->Shell->nl(), "\n");
$this->assertEqual($this->Shell->nl(true), "\n");
$this->assertEqual($this->Shell->nl(false), "");
@ -272,9 +264,8 @@ class ShellTest extends CakeTestCase {
* testHr
*
* @return void
* @access public
*/
function testHr() {
public function testHr() {
$bar = '---------------------------------------------------------------';
$this->Shell->Dispatch->expectAt(0, 'stdout', array('', false));
@ -297,9 +288,8 @@ class ShellTest extends CakeTestCase {
* testError
*
* @return void
* @access public
*/
function testError() {
public function testError() {
$this->Shell->Dispatch->expectAt(0, 'stderr', array("Error: Foo Not Found\n"));
$this->Shell->error('Foo Not Found');
$this->assertIdentical($this->Shell->stopped, 1);
@ -316,9 +306,8 @@ class ShellTest extends CakeTestCase {
* testLoadTasks method
*
* @return void
* @access public
*/
function testLoadTasks() {
public function testLoadTasks() {
$this->assertTrue($this->Shell->loadTasks());
$this->Shell->tasks = null;
@ -359,9 +348,8 @@ class ShellTest extends CakeTestCase {
* testShortPath method
*
* @return void
* @access public
*/
function testShortPath() {
public function testShortPath() {
$path = $expected = DS . 'tmp' . DS . 'ab' . DS . 'cd';
$this->assertEqual($this->Shell->shortPath($path), $expected);
@ -401,9 +389,8 @@ class ShellTest extends CakeTestCase {
* testCreateFile method
*
* @return void
* @access public
*/
function testCreateFile() {
public function testCreateFile() {
$this->skipIf(DIRECTORY_SEPARATOR === '\\', '%s Not supported on Windows');
$path = TMP . 'shell_test';
@ -452,9 +439,8 @@ class ShellTest extends CakeTestCase {
* testCreateFileWindows method
*
* @return void
* @access public
*/
function testCreateFileWindows() {
public function testCreateFileWindows() {
$this->skipUnless(DIRECTORY_SEPARATOR === '\\', 'testCreateFileWindows supported on Windows only');
$path = TMP . 'shell_test';

View file

@ -96,9 +96,8 @@ class ControllerTaskTest extends CakeTestCase {
* startTest method
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatcher =& new TestControllerTaskMockShellDispatcher();
$this->Task =& new MockControllerTask($this->Dispatcher);
$this->Task->name = 'ControllerTask';
@ -115,9 +114,8 @@ class ControllerTaskTest extends CakeTestCase {
* endTest method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
unset($this->Task, $this->Dispatcher);
ClassRegistry::flush();
}
@ -126,9 +124,8 @@ class ControllerTaskTest extends CakeTestCase {
* test ListAll
*
* @return void
* @access public
*/
function testListAll() {
public function testListAll() {
$this->Task->connection = 'test_suite';
$this->Task->interactive = true;
$this->Task->expectAt(1, 'out', array('1. Articles'));
@ -156,9 +153,8 @@ class ControllerTaskTest extends CakeTestCase {
* Test that getName interacts with the user and returns the controller name.
*
* @return void
* @access public
*/
function testGetName() {
public function testGetName() {
$this->Task->interactive = true;
$this->Task->setReturnValue('in', 1);
@ -185,9 +181,8 @@ class ControllerTaskTest extends CakeTestCase {
* test helper interactions
*
* @return void
* @access public
*/
function testDoHelpers() {
public function testDoHelpers() {
$this->Task->setReturnValue('in', 'n');
$result = $this->Task->doHelpers();
$this->assertEqual($result, array());
@ -209,9 +204,8 @@ class ControllerTaskTest extends CakeTestCase {
* test component interactions
*
* @return void
* @access public
*/
function testDoComponents() {
public function testDoComponents() {
$this->Task->setReturnValue('in', 'n');
$result = $this->Task->doComponents();
$this->assertEqual($result, array());
@ -233,9 +227,8 @@ class ControllerTaskTest extends CakeTestCase {
* test Confirming controller user interaction
*
* @return void
* @access public
*/
function testConfirmController() {
public function testConfirmController() {
$controller = 'Posts';
$scaffold = false;
$helpers = array('Ajax', 'Time');
@ -252,9 +245,8 @@ class ControllerTaskTest extends CakeTestCase {
* test the bake method
*
* @return void
* @access public
*/
function testBake() {
public function testBake() {
$helpers = array('Ajax', 'Time');
$components = array('Acl', 'Auth');
$this->Task->setReturnValue('createFile', true);
@ -282,9 +274,8 @@ class ControllerTaskTest extends CakeTestCase {
* test bake() with a -plugin param
*
* @return void
* @access public
*/
function testBakeWithPlugin() {
public function testBakeWithPlugin() {
$this->Task->plugin = 'ControllerTest';
$helpers = array('Ajax', 'Time');
$components = array('Acl', 'Auth');
@ -305,9 +296,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that bakeActions is creating the correct controller Code. (Using sessions)
*
* @return void
* @access public
*/
function testBakeActionsUsingSessions() {
public function testBakeActionsUsingSessions() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Testing bakeActions requires Article, Comment & Tag Model to be undefined. %s');
if ($skip) {
@ -348,9 +338,8 @@ class ControllerTaskTest extends CakeTestCase {
* Test baking with Controller::flash() or no sessions.
*
* @return void
* @access public
*/
function testBakeActionsWithNoSessions() {
public function testBakeActionsWithNoSessions() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Testing bakeActions requires Article, Tag, Comment Models to be undefined. %s');
if ($skip) {
@ -384,9 +373,8 @@ class ControllerTaskTest extends CakeTestCase {
* test baking a test
*
* @return void
* @access public
*/
function testBakeTest() {
public function testBakeTest() {
$this->Task->plugin = 'ControllerTest';
$this->Task->connection = 'test_suite';
$this->Task->interactive = false;
@ -403,9 +391,8 @@ class ControllerTaskTest extends CakeTestCase {
* test Interactive mode.
*
* @return void
* @access public
*/
function testInteractive() {
public function testInteractive() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path';
$this->Task->setReturnValue('in', '1');
@ -428,9 +415,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that execute runs all when the first arg == all
*
* @return void
* @access public
*/
function testExecuteIntoAll() {
public function testExecuteIntoAll() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute into all could not be run as an Article, Tag or Comment model was already loaded. %s');
if ($skip) {
@ -454,9 +440,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that `cake bake controller foos` works.
*
* @return void
* @access public
*/
function testExecuteWithController() {
public function testExecuteWithController() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
if ($skip) {
@ -478,9 +463,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that both plural and singular forms work for controller baking.
*
* @return void
* @access public
*/
function testExecuteWithControllerNameVariations() {
public function testExecuteWithControllerNameVariations() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
if ($skip) {
@ -530,9 +514,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that `cake bake controller foo scaffold` works.
*
* @return void
* @access public
*/
function testExecuteWithPublicParam() {
public function testExecuteWithPublicParam() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
if ($skip) {
@ -554,9 +537,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that `cake bake controller foos both` works.
*
* @return void
* @access public
*/
function testExecuteWithControllerAndBoth() {
public function testExecuteWithControllerAndBoth() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
if ($skip) {
@ -579,9 +561,8 @@ class ControllerTaskTest extends CakeTestCase {
* test that `cake bake controller foos admin` works.
*
* @return void
* @access public
*/
function testExecuteWithControllerAndAdmin() {
public function testExecuteWithControllerAndAdmin() {
$skip = $this->skipIf(!defined('ARTICLE_MODEL_CREATED'),
'Execute with scaffold param requires no Article, Tag or Comment model to be defined. %s');
if ($skip) {

View file

@ -77,9 +77,8 @@ class DbConfigTaskTest extends CakeTestCase {
* startTest method
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatcher =& new TestDbConfigTaskMockShellDispatcher();
$this->Task =& new MockDbConfigTask($this->Dispatcher);
$this->Task->Dispatch =& $this->Dispatcher;
@ -93,9 +92,8 @@ class DbConfigTaskTest extends CakeTestCase {
* endTest method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
unset($this->Task, $this->Dispatcher);
ClassRegistry::flush();
}
@ -104,9 +102,8 @@ class DbConfigTaskTest extends CakeTestCase {
* Test the getConfig method.
*
* @return void
* @access public
*/
function testGetConfig() {
public function testGetConfig() {
$this->Task->setReturnValueAt(0, 'in', 'otherOne');
$result = $this->Task->getConfig();
$this->assertEqual($result, 'otherOne');
@ -116,9 +113,8 @@ class DbConfigTaskTest extends CakeTestCase {
* test that initialize sets the path up.
*
* @return void
* @access public
*/
function testInitialize() {
public function testInitialize() {
$this->assertTrue(empty($this->Task->path));
$this->Task->initialize();
$this->assertFalse(empty($this->Task->path));
@ -130,9 +126,8 @@ class DbConfigTaskTest extends CakeTestCase {
* test execute and by extension __interactive
*
* @return void
* @access public
*/
function testExecuteIntoInteractive() {
public function testExecuteIntoInteractive() {
$this->Task->initialize();
$this->Task->expectOnce('_stop');

View file

@ -53,9 +53,8 @@ class ExtractTaskTest extends CakeTestCase {
* setUp method
*
* @return void
* @access public
*/
function setUp() {
public function setUp() {
$this->Dispatcher =& new TestExtractTaskMockShellDispatcher();
$this->Task =& new ExtractTask($this->Dispatcher);
}
@ -64,9 +63,8 @@ class ExtractTaskTest extends CakeTestCase {
* tearDown method
*
* @return void
* @access public
*/
function tearDown() {
public function tearDown() {
ClassRegistry::flush();
}
@ -74,9 +72,8 @@ class ExtractTaskTest extends CakeTestCase {
* testExecute method
*
* @return void
* @access public
*/
function testExecute() {
public function testExecute() {
$path = TMP . 'tests' . DS . 'extract_task_test';
new Folder($path . DS . 'locale', true);

View file

@ -68,9 +68,8 @@ class FixtureTaskTest extends CakeTestCase {
* startTest method
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatcher =& new TestFixtureTaskMockShellDispatcher();
$this->Task =& new MockFixtureTask();
$this->Task->Model =& new MockFixtureModelTask();
@ -84,9 +83,8 @@ class FixtureTaskTest extends CakeTestCase {
* endTest method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
unset($this->Task, $this->Dispatcher);
ClassRegistry::flush();
}
@ -95,9 +93,8 @@ class FixtureTaskTest extends CakeTestCase {
* test that initialize sets the path
*
* @return void
* @access public
*/
function testConstruct() {
public function testConstruct() {
$this->Dispatch->params['working'] = DS . 'my' . DS . 'path';
$Task =& new FixtureTask($this->Dispatch);
@ -109,9 +106,8 @@ class FixtureTaskTest extends CakeTestCase {
* test import option array generation
*
* @return void
* @access public
*/
function testImportOptions() {
public function testImportOptions() {
$this->Task->setReturnValueAt(0, 'in', 'y');
$this->Task->setReturnValueAt(1, 'in', 'y');
@ -139,9 +135,8 @@ class FixtureTaskTest extends CakeTestCase {
* test generating a fixture with database conditions.
*
* @return void
* @access public
*/
function testImportRecordsFromDatabaseWithConditions() {
public function testImportRecordsFromDatabaseWithConditions() {
$this->Task->interactive = true;
$this->Task->setReturnValueAt(0, 'in', 'WHERE 1=1 LIMIT 10');
$this->Task->connection = 'test_suite';
@ -160,9 +155,8 @@ class FixtureTaskTest extends CakeTestCase {
* test that execute passes runs bake depending with named model.
*
* @return void
* @access public
*/
function testExecuteWithNamedModel() {
public function testExecuteWithNamedModel() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->args = array('article');
@ -175,9 +169,8 @@ class FixtureTaskTest extends CakeTestCase {
* test that execute passes runs bake depending with named model.
*
* @return void
* @access public
*/
function testExecuteWithNamedModelVariations() {
public function testExecuteWithNamedModelVariations() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
@ -206,9 +199,8 @@ class FixtureTaskTest extends CakeTestCase {
* test that execute runs all() when args[0] = all
*
* @return void
* @access public
*/
function testExecuteIntoAll() {
public function testExecuteIntoAll() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->args = array('all');
@ -227,9 +219,8 @@ class FixtureTaskTest extends CakeTestCase {
* test using all() with -count and -records
*
* @return void
* @access public
*/
function testAllWithCountAndRecordsFlags() {
public function testAllWithCountAndRecordsFlags() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->args = array('all');
@ -249,9 +240,8 @@ class FixtureTaskTest extends CakeTestCase {
* test interactive mode of execute
*
* @return void
* @access public
*/
function testExecuteInteractive() {
public function testExecuteInteractive() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
@ -268,9 +258,8 @@ class FixtureTaskTest extends CakeTestCase {
* Test that bake works
*
* @return void
* @access public
*/
function testBake() {
public function testBake() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
@ -304,9 +293,8 @@ class FixtureTaskTest extends CakeTestCase {
* test record generation with float and binary types
*
* @return void
* @access public
*/
function testRecordGenerationForBinaryAndFloat() {
public function testRecordGenerationForBinaryAndFloat() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
@ -321,9 +309,8 @@ class FixtureTaskTest extends CakeTestCase {
* Test that file generation includes headers and correct path for plugins.
*
* @return void
* @access public
*/
function testGenerateFixtureFile() {
public function testGenerateFixtureFile() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$filename = '/my/path/article_fixture.php';
@ -339,9 +326,8 @@ class FixtureTaskTest extends CakeTestCase {
* test generating files into plugins.
*
* @return void
* @access public
*/
function testGeneratePluginFixtureFile() {
public function testGeneratePluginFixtureFile() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->plugin = 'TestFixture';

View file

@ -73,9 +73,8 @@ class ModelTaskTest extends CakeTestCase {
* starTest method
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatcher =& new TestModelTaskMockShellDispatcher();
$this->Task =& new MockModelTask($this->Dispatcher);
$this->Task->name = 'ModelTask';
@ -91,9 +90,8 @@ class ModelTaskTest extends CakeTestCase {
* endTest method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
unset($this->Task, $this->Dispatcher);
ClassRegistry::flush();
}
@ -102,9 +100,8 @@ class ModelTaskTest extends CakeTestCase {
* Test that listAll scans the database connection and lists all the tables in it.s
*
* @return void
* @access public
*/
function testListAll() {
public function testListAll() {
$this->Task->expectAt(1, 'out', array('1. Article'));
$this->Task->expectAt(2, 'out', array('2. ArticlesTag'));
$this->Task->expectAt(3, 'out', array('3. CategoryThread'));
@ -130,9 +127,8 @@ class ModelTaskTest extends CakeTestCase {
* Test that getName interacts with the user and returns the model name.
*
* @return void
* @access public
*/
function testGetName() {
public function testGetName() {
$this->Task->setReturnValue('in', 1);
$this->Task->setReturnValueAt(0, 'in', 'q');
@ -158,9 +154,8 @@ class ModelTaskTest extends CakeTestCase {
* Test table name interactions
*
* @return void
* @access public
*/
function testGetTableName() {
public function testGetTableName() {
$this->Task->setReturnValueAt(0, 'in', 'y');
$result = $this->Task->getTable('Article', 'test_suite');
$expected = 'articles';
@ -177,9 +172,8 @@ class ModelTaskTest extends CakeTestCase {
* test that initializing the validations works.
*
* @return void
* @access public
*/
function testInitValidations() {
public function testInitValidations() {
$result = $this->Task->initValidations();
$this->assertTrue(in_array('notempty', $result));
}
@ -189,9 +183,8 @@ class ModelTaskTest extends CakeTestCase {
* tests the guessing features of validation
*
* @return void
* @access public
*/
function testFieldValidationGuessing() {
public function testFieldValidationGuessing() {
$this->Task->interactive = false;
$this->Task->initValidations();
@ -218,9 +211,8 @@ class ModelTaskTest extends CakeTestCase {
* test that interactive field validation works and returns multiple validators.
*
* @return void
* @access public
*/
function testInteractiveFieldValidation() {
public function testInteractiveFieldValidation() {
$this->Task->initValidations();
$this->Task->interactive = true;
$this->Task->setReturnValueAt(0, 'in', '19');
@ -271,9 +263,8 @@ class ModelTaskTest extends CakeTestCase {
* test the validation Generation routine
*
* @return void
* @access public
*/
function testNonInteractiveDoValidation() {
public function testNonInteractiveDoValidation() {
$Model =& new MockModelTaskModel();
$Model->primaryKey = 'id';
$Model->setReturnValue('schema', array(
@ -333,9 +324,8 @@ class ModelTaskTest extends CakeTestCase {
* test that finding primary key works
*
* @return void
* @access public
*/
function testFindPrimaryKey() {
public function testFindPrimaryKey() {
$fields = array(
'one' => array(),
'two' => array(),
@ -352,9 +342,8 @@ class ModelTaskTest extends CakeTestCase {
* test finding Display field
*
* @return void
* @access public
*/
function testFindDisplayField() {
public function testFindDisplayField() {
$fields = array('id' => array(), 'tagname' => array(), 'body' => array(),
'created' => array(), 'modified' => array());
@ -373,9 +362,8 @@ class ModelTaskTest extends CakeTestCase {
* test that belongsTo generation works.
*
* @return void
* @access public
*/
function testBelongsToGeneration() {
public function testBelongsToGeneration() {
$model = new Model(array('ds' => 'test_suite', 'name' => 'Comment'));
$result = $this->Task->findBelongsTo($model, array());
$expected = array(
@ -412,9 +400,8 @@ class ModelTaskTest extends CakeTestCase {
* test that hasOne and/or hasMany relations are generated properly.
*
* @return void
* @access public
*/
function testHasManyHasOneGeneration() {
public function testHasManyHasOneGeneration() {
$model = new Model(array('ds' => 'test_suite', 'name' => 'Article'));
$this->Task->connection = 'test_suite';
$this->Task->listAll();
@ -462,9 +449,8 @@ class ModelTaskTest extends CakeTestCase {
* Test that HABTM generation works
*
* @return void
* @access public
*/
function testHasAndBelongsToManyGeneration() {
public function testHasAndBelongsToManyGeneration() {
$model = new Model(array('ds' => 'test_suite', 'name' => 'Article'));
$this->Task->connection = 'test_suite';
$this->Task->listAll();
@ -487,9 +473,8 @@ class ModelTaskTest extends CakeTestCase {
* test non interactive doAssociations
*
* @return void
* @access public
*/
function testDoAssociationsNonInteractive() {
public function testDoAssociationsNonInteractive() {
$this->Task->connection = 'test_suite';
$this->Task->interactive = false;
$model = new Model(array('ds' => 'test_suite', 'name' => 'Article'));
@ -518,9 +503,8 @@ class ModelTaskTest extends CakeTestCase {
* Ensure that the fixutre object is correctly called.
*
* @return void
* @access public
*/
function testBakeFixture() {
public function testBakeFixture() {
$this->Task->plugin = 'test_plugin';
$this->Task->interactive = true;
$this->Task->Fixture->expectAt(0, 'bake', array('Article', 'articles'));
@ -535,9 +519,8 @@ class ModelTaskTest extends CakeTestCase {
* Ensure that the test object is correctly called.
*
* @return void
* @access public
*/
function testBakeTest() {
public function testBakeTest() {
$this->Task->plugin = 'test_plugin';
$this->Task->interactive = true;
$this->Task->Test->expectAt(0, 'bake', array('Model', 'Article'));
@ -553,9 +536,8 @@ class ModelTaskTest extends CakeTestCase {
* a question for the hasOne is also not asked.
*
* @return void
* @access public
*/
function testConfirmAssociations() {
public function testConfirmAssociations() {
$associations = array(
'hasOne' => array(
array(
@ -594,9 +576,8 @@ class ModelTaskTest extends CakeTestCase {
* test that inOptions generates questions and only accepts a valid answer
*
* @return void
* @access public
*/
function testInOptions() {
public function testInOptions() {
$options = array('one', 'two', 'three');
$this->Task->expectAt(0, 'out', array('1. one'));
$this->Task->expectAt(1, 'out', array('2. two'));
@ -615,9 +596,8 @@ class ModelTaskTest extends CakeTestCase {
* test baking validation
*
* @return void
* @access public
*/
function testBakeValidation() {
public function testBakeValidation() {
$validate = array(
'name' => array(
'notempty' => 'notempty'
@ -655,9 +635,8 @@ STRINGEND;
* test baking relations
*
* @return void
* @access public
*/
function testBakeRelations() {
public function testBakeRelations() {
$associations = array(
'belongsTo' => array(
array(
@ -710,9 +689,8 @@ STRINGEND;
* test bake() with a -plugin param
*
* @return void
* @access public
*/
function testBakeWithPlugin() {
public function testBakeWithPlugin() {
$this->Task->plugin = 'ControllerTest';
$path = APP . 'plugins' . DS . 'controller_test' . DS . 'models' . DS . 'article.php';
@ -734,9 +712,8 @@ STRINGEND;
* test that execute passes runs bake depending with named model.
*
* @return void
* @access public
*/
function testExecuteWithNamedModel() {
public function testExecuteWithNamedModel() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->args = array('article');
@ -753,9 +730,8 @@ STRINGEND;
* test that execute passes with different inflections of the same name.
*
* @return void
* @access public
*/
function testExecuteWithNamedModelVariations() {
public function testExecuteWithNamedModelVariations() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->setReturnValue('_checkUnitTest', 1);
@ -779,9 +755,8 @@ STRINGEND;
* test that execute with a model name picks up hasMany associations.
*
* @return void
* @access public
*/
function testExecuteWithNamedModelHasManyCreated() {
public function testExecuteWithNamedModelHasManyCreated() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->args = array('article');
@ -795,9 +770,8 @@ STRINGEND;
* test that execute runs all() when args[0] = all
*
* @return void
* @access public
*/
function testExecuteIntoAll() {
public function testExecuteIntoAll() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->args = array('all');
@ -861,9 +835,8 @@ STRINGEND;
* test the interactive side of bake.
*
* @return void
* @access public
*/
function testExecuteIntoInteractive() {
public function testExecuteIntoInteractive() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';
$this->Task->interactive = true;
@ -894,9 +867,8 @@ STRINGEND;
* test using bake interactively with a table that does not exist.
*
* @return void
* @access public
*/
function testExecuteWithNonExistantTableName() {
public function testExecuteWithNonExistantTableName() {
$this->Task->connection = 'test_suite';
$this->Task->path = '/my/path/';

View file

@ -58,9 +58,8 @@ class PluginTaskTest extends CakeTestCase {
* startTest method
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatcher =& new TestPluginTaskMockShellDispatcher();
$this->Dispatcher->shellPaths = App::path('shells');
$this->Task =& new MockPluginTask($this->Dispatcher);
@ -72,9 +71,8 @@ class PluginTaskTest extends CakeTestCase {
* startCase methods
*
* @return void
* @access public
*/
function startCase() {
public function startCase() {
$this->_paths = $paths = App::path('plugins');
$this->_testPath = array_push($paths, TMP . 'tests' . DS);
App::build(array('plugins' => $paths));
@ -84,9 +82,8 @@ class PluginTaskTest extends CakeTestCase {
* endCase
*
* @return void
* @access public
*/
function endCase() {
public function endCase() {
App::build(array('plugins' => $this->_paths));
}
@ -94,9 +91,8 @@ class PluginTaskTest extends CakeTestCase {
* endTest method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
ClassRegistry::flush();
}
@ -104,9 +100,8 @@ class PluginTaskTest extends CakeTestCase {
* test bake()
*
* @return void
* @access public
*/
function testBakeFoldersAndFiles() {
public function testBakeFoldersAndFiles() {
$this->Task->setReturnValueAt(0, 'in', $this->_testPath);
$this->Task->setReturnValueAt(1, 'in', 'y');
$this->Task->bake('BakeTestPlugin');
@ -192,9 +187,8 @@ class PluginTaskTest extends CakeTestCase {
* test execute with no args, flowing into interactive,
*
* @return void
* @access public
*/
function testExecuteWithNoArgs() {
public function testExecuteWithNoArgs() {
$this->Task->setReturnValueAt(0, 'in', 'TestPlugin');
$this->Task->setReturnValueAt(1, 'in', '3');
$this->Task->setReturnValueAt(2, 'in', 'y');
@ -218,9 +212,8 @@ class PluginTaskTest extends CakeTestCase {
* Test Execute
*
* @return void
* @access public
*/
function testExecuteWithOneArg() {
public function testExecuteWithOneArg() {
$this->Task->setReturnValueAt(0, 'in', $this->_testPath);
$this->Task->setReturnValueAt(1, 'in', 'y');
$this->Task->Dispatch->args = array('BakeTestPlugin');
@ -243,9 +236,8 @@ class PluginTaskTest extends CakeTestCase {
* test execute chaining into MVC parts
*
* @return void
* @access public
*/
function testExecuteWithTwoArgs() {
public function testExecuteWithTwoArgs() {
$this->Task->Model =& new PluginTestMockModelTask();
$this->Task->setReturnValueAt(0, 'in', $this->_testPath);
$this->Task->setReturnValueAt(1, 'in', 'y');

View file

@ -55,9 +55,8 @@ class ProjectTaskTest extends CakeTestCase {
* startTest method
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatcher =& new TestProjectTaskMockShellDispatcher();
$this->Dispatcher->shellPaths = App::path('shells');
$this->Task =& new MockProjectTask($this->Dispatcher);
@ -69,9 +68,8 @@ class ProjectTaskTest extends CakeTestCase {
* endTest method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
ClassRegistry::flush();
$Folder =& new Folder($this->Task->path . 'bake_test_app');
@ -95,9 +93,8 @@ class ProjectTaskTest extends CakeTestCase {
* test bake() method and directory creation.
*
* @return void
* @access public
*/
function testBake() {
public function testBake() {
$this->_setupTestProject();
$path = $this->Task->path . 'bake_test_app';
@ -117,9 +114,8 @@ class ProjectTaskTest extends CakeTestCase {
* test bake() method with -empty flag, directory creation and empty files.
*
* @return void
* @access public
*/
function testBakeEmptyFlag() {
public function testBakeEmptyFlag() {
$this->Task->params['empty'] = true;
$this->_setupTestProject();
$path = $this->Task->path . 'bake_test_app';
@ -159,9 +155,8 @@ class ProjectTaskTest extends CakeTestCase {
* test generation of Security.salt
*
* @return void
* @access public
*/
function testSecuritySaltGeneration() {
public function testSecuritySaltGeneration() {
$this->_setupTestProject();
$path = $this->Task->path . 'bake_test_app' . DS;
@ -177,9 +172,8 @@ class ProjectTaskTest extends CakeTestCase {
* test generation of Security.cipherSeed
*
* @return void
* @access public
*/
function testSecurityCipherSeedGeneration() {
*/
public function testSecurityCipherSeedGeneration() {
$this->_setupTestProject();
$path = $this->Task->path . 'bake_test_app' . DS;
@ -195,9 +189,8 @@ class ProjectTaskTest extends CakeTestCase {
* Test that index.php is generated correctly.
*
* @return void
* @access public
*/
function testIndexPhpGeneration() {
public function testIndexPhpGeneration() {
$this->_setupTestProject();
$path = $this->Task->path . 'bake_test_app' . DS;
@ -216,9 +209,8 @@ class ProjectTaskTest extends CakeTestCase {
* test getPrefix method, and that it returns Routing.prefix or writes to config file.
*
* @return void
* @access public
*/
function testGetPrefix() {
public function testGetPrefix() {
Configure::write('Routing.prefixes', array('admin'));
$result = $this->Task->getPrefix();
$this->assertEqual($result, 'admin_');
@ -239,9 +231,8 @@ class ProjectTaskTest extends CakeTestCase {
* test cakeAdmin() writing core.php
*
* @return void
* @access public
*/
function testCakeAdmin() {
public function testCakeAdmin() {
$file =& new File(CONFIGS . 'core.php');
$contents = $file->read();;
$file =& new File(TMP . 'tests' . DS . 'core.php');
@ -260,9 +251,8 @@ class ProjectTaskTest extends CakeTestCase {
* test getting the prefix with more than one prefix setup
*
* @return void
* @access public
*/
function testGetPrefixWithMultiplePrefixes() {
public function testGetPrefixWithMultiplePrefixes() {
Configure::write('Routing.prefixes', array('admin', 'ninja', 'shinobi'));
$this->_setupTestProject();
$this->Task->configPath = $this->Task->path . 'bake_test_app' . DS . 'config' . DS;
@ -276,9 +266,8 @@ class ProjectTaskTest extends CakeTestCase {
* Test execute method with one param to destination folder.
*
* @return void
* @access public
*/
function testExecute() {
public function testExecute() {
$this->Task->params['skel'] = CAKE_CORE_INCLUDE_PATH . DS . CAKE . DS . 'console' . DS. 'templates' . DS . 'skel';
$this->Task->params['working'] = TMP . 'tests' . DS;

View file

@ -57,9 +57,8 @@ class TemplateTaskTest extends CakeTestCase {
* startTest method
*
* @return void
* @access public
*/
function startTest() {
public function startTest() {
$this->Dispatcher =& new TestTemplateTaskMockShellDispatcher();
$this->Task =& new MockTemplateTask($this->Dispatcher);
$this->Task->Dispatch =& $this->Dispatcher;
@ -70,9 +69,8 @@ class TemplateTaskTest extends CakeTestCase {
* endTest method
*
* @return void
* @access public
*/
function endTest() {
public function endTest() {
unset($this->Task, $this->Dispatcher);
ClassRegistry::flush();
}
@ -81,9 +79,8 @@ class TemplateTaskTest extends CakeTestCase {
* test that set sets variables
*
* @return void
* @access public
*/
function testSet() {
public function testSet() {
$this->Task->set('one', 'two');
$this->assertTrue(isset($this->Task->templateVars['one']));
$this->assertEqual($this->Task->templateVars['one'], 'two');
@ -99,9 +96,8 @@ class TemplateTaskTest extends CakeTestCase {
* test finding themes installed in
*
* @return void
* @access public
*/
function testFindingInstalledThemesForBake() {
public function testFindingInstalledThemesForBake() {
$consoleLibs = CAKE_CORE_INCLUDE_PATH . DS . CAKE . 'console' . DS;
$this->Task->Dispatch->shellPaths = array($consoleLibs);
$this->Task->initialize();
@ -113,9 +109,8 @@ class TemplateTaskTest extends CakeTestCase {
* that the user is not bugged. If there are more, find and return the correct theme name
*
* @return void
* @access public
*/
function testGetThemePath() {
public function testGetThemePath() {
$defaultTheme = CAKE_CORE_INCLUDE_PATH . DS . dirname(CONSOLE_LIBS) . 'templates' . DS . 'default' .DS;
$this->Task->templatePaths = array('default' => $defaultTheme);
$this->Task->expectCallCount('in', 1);
@ -139,9 +134,8 @@ class TemplateTaskTest extends CakeTestCase {
* test generate
*
* @return void
* @access public
*/
function testGenerate() {
public function testGenerate() {
App::build(array(
'shells' => array(
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS . 'shells' . DS
@ -159,9 +153,8 @@ class TemplateTaskTest extends CakeTestCase {
* ensure fallback to default works.
*
* @return void
* @access public
*/
function testGenerateWithTemplateFallbacks() {
public function testGenerateWithTemplateFallbacks() {
App::build(array(
'shells' => array(
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS . 'shells' . DS,

Some files were not shown because too many files have changed in this diff Show more