From 4c042ae1330d66bc310a1ef8b174a4af8c7f3e57 Mon Sep 17 00:00:00 2001 From: ADmad Date: Sun, 29 May 2011 02:08:46 +0530 Subject: [PATCH] Adding proper visibility keywords for class functions --- lib/Cake/Controller/CakeErrorController.php | 4 +- lib/Cake/Controller/Component.php | 12 ++-- lib/Cake/Controller/Scaffold.php | 12 ++-- lib/Cake/Core/Configure.php | 2 +- lib/Cake/Core/Object.php | 4 +- lib/Cake/Error/ExceptionRenderer.php | 2 +- lib/Cake/I18n/I18n.php | 2 +- lib/Cake/I18n/L10n.php | 10 +-- lib/Cake/Model/AclNode.php | 2 +- lib/Cake/Model/Behavior/TranslateBehavior.php | 8 +-- lib/Cake/Model/Behavior/TreeBehavior.php | 10 +-- lib/Cake/Model/BehaviorCollection.php | 8 +-- lib/Cake/Model/CakeSchema.php | 10 +-- lib/Cake/Model/Datasource/DataSource.php | 4 +- lib/Cake/Model/Datasource/Database/Mysql.php | 32 ++++----- lib/Cake/Model/Datasource/Database/Oracle.php | 40 +++++------ .../Model/Datasource/Database/Postgres.php | 50 ++++++------- lib/Cake/Model/Datasource/Database/Sqlite.php | 34 ++++----- lib/Cake/Model/Datasource/DboSource.php | 28 ++++---- .../Datasource/Session/DatabaseSession.php | 4 +- lib/Cake/Model/Model.php | 71 +++++++++---------- lib/Cake/Model/ModelBehavior.php | 18 ++--- lib/Cake/Model/Permission.php | 2 +- lib/Cake/Network/CakeSocket.php | 4 +- lib/Cake/Network/Email/SmtpTransport.php | 2 +- lib/Cake/Network/Http/HttpResponse.php | 2 +- lib/Cake/Utility/Debugger.php | 2 +- lib/Cake/Utility/File.php | 6 +- lib/Cake/Utility/Folder.php | 8 +-- lib/Cake/Utility/Security.php | 2 +- lib/Cake/View/Helper.php | 12 ++-- lib/Cake/View/MediaView.php | 4 +- lib/Cake/View/ThemeView.php | 4 +- lib/Cake/View/View.php | 4 +- 34 files changed, 209 insertions(+), 210 deletions(-) diff --git a/lib/Cake/Controller/CakeErrorController.php b/lib/Cake/Controller/CakeErrorController.php index 7066b0e2a..f75ec24a7 100644 --- a/lib/Cake/Controller/CakeErrorController.php +++ b/lib/Cake/Controller/CakeErrorController.php @@ -22,7 +22,7 @@ class CakeErrorController extends AppController { * @access public * @return void */ - function __construct($request = null) { + public function __construct($request = null) { parent::__construct($request); $this->constructClasses(); $this->Components->trigger('initialize', array(&$this)); @@ -34,7 +34,7 @@ class CakeErrorController extends AppController { * * @return void */ - function beforeRender() { + public function beforeRender() { parent::beforeRender(); foreach ($this->viewVars as $key => $value) { if (!is_object($value)){ diff --git a/lib/Cake/Controller/Component.php b/lib/Cake/Controller/Component.php index 0993c171b..14fc7b077 100644 --- a/lib/Cake/Controller/Component.php +++ b/lib/Cake/Controller/Component.php @@ -19,7 +19,7 @@ App::uses('ComponentCollection', 'Controller'); /** * Base class for an individual Component. Components provide resuable bits of - * controller logic that can be composed into a controller. Components also + * controller logic that can be composed into a controller. Components also * provide request life-cycle callbacks for injecting logic at specific points. * * ## Life cycle callbacks @@ -30,8 +30,8 @@ App::uses('ComponentCollection', 'Controller'); * - `initialize()` - Fired before the controller's beforeFilter method. * - `startup()` - Fired after the controller's beforeFilter method. * - `beforeRender()` - Fired before the view + layout are rendered. - * - `shutdown()` - Fired after the action is complete and the view has been rendered - * but before Controller::afterFilter(). + * - `shutdown()` - Fired after the action is complete and the view has been rendered + * but before Controller::afterFilter(). * - `beforeRedirect()` - Fired before a redirect() is done. * * @package cake.libs.controller @@ -132,18 +132,18 @@ class Component extends Object { * @param object $controller Controller with components to shutdown * @return void */ - function shutdown($controller) { } + public function shutdown($controller) { } /** * Called before Controller::redirect(). Allows you to replace the url that will * be redirected to with a new url. The return of this method can either be an array or a string. * * If the return is an array and contains a 'url' key. You may also supply the following: - * + * * - `status` The status code for the redirect * - `exit` Whether or not the redirect should exit. * - * If your response is a string or an array that does not contain a 'url' key it will + * If your response is a string or an array that does not contain a 'url' key it will * be used as the new url to redirect to. * * @param object $controller Controller with components to beforeRedirect diff --git a/lib/Cake/Controller/Scaffold.php b/lib/Cake/Controller/Scaffold.php index 2f10bbb1b..29db0d076 100644 --- a/lib/Cake/Controller/Scaffold.php +++ b/lib/Cake/Controller/Scaffold.php @@ -106,7 +106,7 @@ class Scaffold { * @param Controller $controller Controller to scaffold * @param CakeRequest $request Request parameters. */ - function __construct(Controller $controller, CakeRequest $request) { + public function __construct(Controller $controller, CakeRequest $request) { $this->controller = $controller; $count = count($this->__passedVars); @@ -254,7 +254,7 @@ class Scaffold { if ($this->ScaffoldModel->save($request->data)) { if ($this->controller->_afterScaffoldSave($action)) { - $message = __d('cake', + $message = __d('cake', 'The %1$s has been %2$s', Inflector::humanize($this->modelKey), $success @@ -318,9 +318,9 @@ class Scaffold { $message = __d('cake', 'The %1$s with id: %2$d has been deleted.', Inflector::humanize($this->modelClass), $id); return $this->_sendMessage($message); } else { - $message = __d('cake', - 'There was an error deleting the %1$s with id: %2$d', - Inflector::humanize($this->modelClass), + $message = __d('cake', + 'There was an error deleting the %1$s with id: %2$d', + Inflector::humanize($this->modelClass), $id ); return $this->_sendMessage($message); @@ -331,7 +331,7 @@ class Scaffold { } /** - * Sends a message to the user. Either uses Sessions or flash messages depending + * Sends a message to the user. Either uses Sessions or flash messages depending * on the availability of a session * * @param string $message Message to display diff --git a/lib/Cake/Core/Configure.php b/lib/Cake/Core/Configure.php index 40671621d..cd7952ccf 100644 --- a/lib/Cake/Core/Configure.php +++ b/lib/Cake/Core/Configure.php @@ -372,5 +372,5 @@ interface ConfigReaderInterface { * @param string $key * @return array An array of data to merge into the runtime configuration */ - function read($key); + public function read($key); } diff --git a/lib/Cake/Core/Object.php b/lib/Cake/Core/Object.php index 345a4ca67..f3bf349e2 100644 --- a/lib/Cake/Core/Object.php +++ b/lib/Cake/Core/Object.php @@ -177,7 +177,7 @@ class Object { * @access protected * @todo add examples to manual */ - function _persist($name, $return = null, &$object, $type = null) { + protected function _persist($name, $return = null, &$object, $type = null) { $file = CACHE . 'persistent' . DS . strtolower($name) . '.php'; if ($return === null) { if (!file_exists($file)) { @@ -256,7 +256,7 @@ class Object { * @return void * @access private */ - function __openPersistent($name, $type = null) { + private function __openPersistent($name, $type = null) { $file = CACHE . 'persistent' . DS . strtolower($name) . '.php'; include($file); diff --git a/lib/Cake/Error/ExceptionRenderer.php b/lib/Cake/Error/ExceptionRenderer.php index c6146c7f2..9e20d3619 100644 --- a/lib/Cake/Error/ExceptionRenderer.php +++ b/lib/Cake/Error/ExceptionRenderer.php @@ -89,7 +89,7 @@ class ExceptionRenderer { * @param string $method Method producing the error * @param array $messages Error messages */ - function __construct(Exception $exception) { + public function __construct(Exception $exception) { $this->controller = $this->_getController($exception); if (method_exists($this->controller, 'apperror')) { diff --git a/lib/Cake/I18n/I18n.php b/lib/Cake/I18n/I18n.php index 0b6d87fe0..d952b36b3 100644 --- a/lib/Cake/I18n/I18n.php +++ b/lib/Cake/I18n/I18n.php @@ -558,7 +558,7 @@ class I18n { * @param string $domain Domain where format is stored * @return mixed translated format string if only value or array of translated strings for corresponding format. */ - function __translateTime($format, $domain) { + private function __translateTime($format, $domain) { if (!empty($this->__domains[$domain][$this->__lang]['LC_TIME'][$format])) { if (($trans = $this->__domains[$domain][$this->__lang][$this->category][$format])) { return $trans; diff --git a/lib/Cake/I18n/L10n.php b/lib/Cake/I18n/L10n.php index c9bef1e79..032de02e6 100644 --- a/lib/Cake/I18n/L10n.php +++ b/lib/Cake/I18n/L10n.php @@ -328,7 +328,7 @@ class L10n { /** * Class constructor */ - function __construct() { + public function __construct() { if (defined('DEFAULT_LANGUAGE')) { $this->default = DEFAULT_LANGUAGE; } @@ -356,7 +356,7 @@ class L10n { * @param string $language Language (if null will use DEFAULT_LANGUAGE if defined) * @access private */ - function __setLanguage($language = null) { + private function __setLanguage($language = null) { $langKey = null; if ($language !== null && isset($this->__l10nMap[$language]) && isset($this->__l10nCatalog[$this->__l10nMap[$language]])) { $langKey = $this->__l10nMap[$language]; @@ -405,7 +405,7 @@ class L10n { * @return boolean Success * @access private */ - function __autoLanguage() { + private function __autoLanguage() { $_detectableLanguages = CakeRequest::acceptLanguage(); foreach ($_detectableLanguages as $key => $langKey) { if (isset($this->__l10nCatalog[$langKey])) { @@ -426,7 +426,7 @@ class L10n { * Attempts to find locale for language, or language for locale * * @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, + * @return mixed string language/locale, array of those values, whole map as an array, * or false when language/locale doesn't exist */ public function map($mixed = null) { @@ -453,7 +453,7 @@ class L10n { * Attempts to find catalog record for requested language * * @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, + * @return mixed array catalog record for requested language, array of catalog records, whole catalog, * or false when language doesn't exist */ public function catalog($language = null) { diff --git a/lib/Cake/Model/AclNode.php b/lib/Cake/Model/AclNode.php index 17997c29d..af36c1879 100644 --- a/lib/Cake/Model/AclNode.php +++ b/lib/Cake/Model/AclNode.php @@ -49,7 +49,7 @@ class AclNode extends AppModel { * Constructor * */ - function __construct() { + public function __construct() { $config = Configure::read('Acl.database'); if (isset($config)) { $this->useDbConfig = $config; diff --git a/lib/Cake/Model/Behavior/TranslateBehavior.php b/lib/Cake/Model/Behavior/TranslateBehavior.php index 48c3d36e3..1366caa67 100644 --- a/lib/Cake/Model/Behavior/TranslateBehavior.php +++ b/lib/Cake/Model/Behavior/TranslateBehavior.php @@ -29,7 +29,7 @@ class TranslateBehavior extends ModelBehavior { /** * Used for runtime configuration of model - * + * * @var array */ public $runtime = array(); @@ -381,7 +381,7 @@ class TranslateBehavior extends ModelBehavior { * @param boolean $reset * @return bool */ - function bindTranslation($model, $fields, $reset = true) { + public function bindTranslation($model, $fields, $reset = true) { if (is_string($fields)) { $fields = array($fields); } @@ -450,11 +450,11 @@ class TranslateBehavior extends ModelBehavior { * fake field * * @param object $model instance of model - * @param mixed $fields string with field, or array(field1, field2=>AssocName, field3), or null for + * @param mixed $fields string with field, or array(field1, field2=>AssocName, field3), or null for * unbind all original translations * @return bool */ - function unbindTranslation($model, $fields = null) { + public function unbindTranslation($model, $fields = null) { if (empty($fields) && empty($this->settings[$model->alias])) { return false; } diff --git a/lib/Cake/Model/Behavior/TreeBehavior.php b/lib/Cake/Model/Behavior/TreeBehavior.php index b65cefac3..425a302e0 100644 --- a/lib/Cake/Model/Behavior/TreeBehavior.php +++ b/lib/Cake/Model/Behavior/TreeBehavior.php @@ -632,7 +632,7 @@ class TreeBehavior extends ModelBehavior { * @link http://book.cakephp.org/view/1355/reorder * @link http://book.cakephp.org/view/1629/Reorder */ - function reorder($Model, $options = array()) { + public function reorder($Model, $options = array()) { $options = array_merge(array('id' => null, 'field' => $Model->displayField, 'order' => 'ASC', 'verify' => true), $options); extract($options); if ($verify && !$this->verify($Model)) { @@ -702,7 +702,7 @@ class TreeBehavior extends ModelBehavior { $db = ConnectionManager::getDataSource($Model->useDbConfig); $Model->updateAll( - array($parent => $db->value($node[$parent], $parent)), + array($parent => $db->value($node[$parent], $parent)), array($Model->escapeField($parent) => $node[$Model->primaryKey]) ); $this->__sync($Model, 1, '-', 'BETWEEN ' . ($node[$left] + 1) . ' AND ' . ($node[$right] - 1)); @@ -885,7 +885,7 @@ class TreeBehavior extends ModelBehavior { * @return int * @access private */ - function __getMax($Model, $scope, $right, $recursive = -1, $created = false) { + private function __getMax($Model, $scope, $right, $recursive = -1, $created = false) { $db = ConnectionManager::getDataSource($Model->useDbConfig); if ($created) { if (is_string($scope)) { @@ -913,7 +913,7 @@ class TreeBehavior extends ModelBehavior { * @return int * @access private */ - function __getMin($Model, $scope, $left, $recursive = -1) { + private function __getMin($Model, $scope, $left, $recursive = -1) { $db = ConnectionManager::getDataSource($Model->useDbConfig); $name = $Model->alias . '.' . $left; list($edge) = array_values($Model->find('first', array( @@ -936,7 +936,7 @@ class TreeBehavior extends ModelBehavior { * @param string $field * @access private */ - function __sync($Model, $shift, $dir = '+', $conditions = array(), $created = false, $field = 'both') { + private function __sync($Model, $shift, $dir = '+', $conditions = array(), $created = false, $field = 'both') { $ModelRecursive = $Model->recursive; extract($this->settings[$Model->alias]); $Model->recursive = $recursive; diff --git a/lib/Cake/Model/BehaviorCollection.php b/lib/Cake/Model/BehaviorCollection.php index 90a8085e3..1e6cfde8d 100644 --- a/lib/Cake/Model/BehaviorCollection.php +++ b/lib/Cake/Model/BehaviorCollection.php @@ -59,7 +59,7 @@ class BehaviorCollection extends ObjectCollection { * @access public * @return void */ - function init($modelName, $behaviors = array()) { + public function init($modelName, $behaviors = array()) { $this->modelName = $modelName; if (!empty($behaviors)) { @@ -206,7 +206,7 @@ class BehaviorCollection extends ObjectCollection { /** * Dispatches a behavior method. Will call either normal methods or mapped methods. * - * If a method is not handeled by the BehaviorCollection, and $strict is false, a + * If a method is not handeled by the BehaviorCollection, and $strict is false, a * special return of `array('unhandled')` will be returned to signal the method was not found. * * @param Model $model The model the method was originally called on. @@ -217,7 +217,7 @@ class BehaviorCollection extends ObjectCollection { */ public function dispatchMethod($model, $method, $params = array(), $strict = false) { $method = $this->hasMethod($method, true); - + if ($strict && empty($method)) { trigger_error(__d('cake_dev', "BehaviorCollection::dispatchMethod() - Method %s not found in any attached behavior", $method), E_USER_WARNING); return null; @@ -236,7 +236,7 @@ class BehaviorCollection extends ObjectCollection { } /** - * Gets the method list for attached behaviors, i.e. all public, non-callback methods. + * Gets the method list for attached behaviors, i.e. all public, non-callback methods. * This does not include mappedMethods. * * @return array All public methods for all behaviors attached to this collection diff --git a/lib/Cake/Model/CakeSchema.php b/lib/Cake/Model/CakeSchema.php index b4fd682dd..e51de2159 100644 --- a/lib/Cake/Model/CakeSchema.php +++ b/lib/Cake/Model/CakeSchema.php @@ -79,7 +79,7 @@ class CakeSchema extends Object { * * @param array $options optional load object properties */ - function __construct($options = array()) { + public function __construct($options = array()) { parent::__construct(); if (empty($options['name'])) { @@ -391,7 +391,7 @@ class CakeSchema extends Object { * @param array $fields Array of field information to generate the table with. * @return string Variable declaration for a schema class */ - function generateTable($table, $fields) { + public function generateTable($table, $fields) { $out = "\tvar \${$table} = array(\n"; if (is_array($fields)) { $cols = array(); @@ -529,7 +529,7 @@ class CakeSchema extends Object { * where match was not found. * @access protected */ - function _arrayDiffAssoc($array1, $array2) { + public function _arrayDiffAssoc($array1, $array2) { $difference = array(); foreach ($array1 as $key => $value) { if (!array_key_exists($key, $array2)) { @@ -626,7 +626,7 @@ class CakeSchema extends Object { * @param array $old Old indexes * @return mixed False on failure, or an array of parameters to add & drop. */ - function _compareTableParameters($new, $old) { + protected function _compareTableParameters($new, $old) { if (!is_array($new) || !is_array($old)) { return false; } @@ -641,7 +641,7 @@ class CakeSchema extends Object { * @param array $old Old indexes * @return mixed false on failure or array of indexes to add and drop */ - function _compareIndexes($new, $old) { + protected function _compareIndexes($new, $old) { if (!is_array($new) || !is_array($old)) { return false; } diff --git a/lib/Cake/Model/Datasource/DataSource.php b/lib/Cake/Model/Datasource/DataSource.php index 8f89e37de..8c6e6c6ba 100644 --- a/lib/Cake/Model/Datasource/DataSource.php +++ b/lib/Cake/Model/Datasource/DataSource.php @@ -87,7 +87,7 @@ class DataSource extends Object { * @param array $config Array of configuration information for the datasource. * @return void. */ - function __construct($config = array()) { + public function __construct($config = array()) { parent::__construct(); $this->setConfig($config); } @@ -329,7 +329,7 @@ class DataSource extends Object { * @access public * @todo Remove and refactor $assocData, ensure uses of the method have the param removed too. */ - function insertQueryData($query, $data, $association, $assocData, Model $model, Model $linkModel, $stack) { + public function insertQueryData($query, $data, $association, $assocData, Model $model, Model $linkModel, $stack) { $keys = array('{$__cakeID__$}', '{$__cakeForeignKey__$}'); foreach ($keys as $key) { diff --git a/lib/Cake/Model/Datasource/Database/Mysql.php b/lib/Cake/Model/Datasource/Database/Mysql.php index 72208f0a7..812f7cd2f 100644 --- a/lib/Cake/Model/Datasource/Database/Mysql.php +++ b/lib/Cake/Model/Datasource/Database/Mysql.php @@ -138,7 +138,7 @@ class Mysql extends DboSource { * * @return boolean True if the database could be connected, else false */ - function connect() { + public function connect() { $config = $this->config; $this->connected = false; try { @@ -170,7 +170,7 @@ class Mysql extends DboSource { * * @return boolean */ - function enabled() { + public function enabled() { return in_array('mysql', PDO::getAvailableDrivers()); } @@ -179,7 +179,7 @@ class Mysql extends DboSource { * * @return array Array of tablenames in the database */ - function listSources($data = null) { + public function listSources($data = null) { $cache = parent::listSources(); if ($cache != null) { return $cache; @@ -207,7 +207,7 @@ class Mysql extends DboSource { * * @param PDOStatement $results */ - function resultSet($results) { + public function resultSet($results) { $this->map = array(); $numFields = $results->columnCount(); $index = 0; @@ -232,7 +232,7 @@ class Mysql extends DboSource { * * @return mixed array with results fetched and mapped to column names or false if there is no results left to fetch */ - function fetchResult() { + public function fetchResult() { if ($row = $this->_result->fetch()) { $resultRow = array(); foreach ($this->map as $col => $meta) { @@ -290,7 +290,7 @@ class Mysql extends DboSource { * @param mixed $tableName Name of database table to inspect or model instance * @return array Fields in table. Keys are name and type */ - function describe($model) { + public function describe($model) { $cache = parent::describe($model); if ($cache != null) { return $cache; @@ -337,7 +337,7 @@ class Mysql extends DboSource { * @param mixed $conditions * @return array */ - function update($model, $fields = array(), $values = null, $conditions = null) { + public function update($model, $fields = array(), $values = null, $conditions = null) { if (!$this->_useAlias) { return parent::update($model, $fields, $values, $conditions); } @@ -379,7 +379,7 @@ class Mysql extends DboSource { * @param mixed $conditions * @return boolean Success */ - function delete($model, $conditions = null) { + public function delete($model, $conditions = null) { if (!$this->_useAlias) { return parent::delete($model, $conditions); } @@ -417,7 +417,7 @@ class Mysql extends DboSource { * * @param string $enc Database encoding */ - function setEncoding($enc) { + public function setEncoding($enc) { return $this->_execute('SET NAMES ' . $enc) !== false; } @@ -427,7 +427,7 @@ class Mysql extends DboSource { * @param string $model Name of model to inspect * @return array Fields in table. Keys are column and unique */ - function index($model) { + public function index($model) { $index = array(); $table = $this->fullTableName($model); $old = version_compare($this->getVersion(), '4.1', '<='); @@ -460,7 +460,7 @@ class Mysql extends DboSource { * @param array $compare Result of a CakeSchema::compare() * @return array Array of alter statements to make. */ - function alterSchema($compare, $table = null) { + public function alterSchema($compare, $table = null) { if (!is_array($compare)) { return false; } @@ -522,7 +522,7 @@ class Mysql extends DboSource { * Otherwise, all tables defined in the schema are generated. * @return string */ - function dropSchema(CakeSchema $schema, $table = null) { + public function dropSchema(CakeSchema $schema, $table = null) { $out = ''; foreach ($schema->tables as $curTable => $columns) { if (!$table || $table === $curTable) { @@ -540,7 +540,7 @@ class Mysql extends DboSource { * @return array Array of table property alteration statementes. * @todo Implement this method. */ - function _alterTableParameters($table, $parameters) { + protected function _alterTableParameters($table, $parameters) { if (isset($parameters['change'])) { return $this->buildTableParameters($parameters['change']); } @@ -554,7 +554,7 @@ class Mysql extends DboSource { * @param array $new Indexes to add and drop * @return array Index alteration statements */ - function _alterIndexes($table, $indexes) { + protected function _alterIndexes($table, $indexes) { $alter = array(); if (isset($indexes['drop'])) { foreach($indexes['drop'] as $name => $value) { @@ -595,7 +595,7 @@ class Mysql extends DboSource { * @param string $name Table name to get parameters * @return array Array of tablenames in the database */ - function listDetailedSources($name = null) { + public function listDetailedSources($name = null) { $condition = ''; $params = array(); if (is_string($name)) { @@ -633,7 +633,7 @@ class Mysql extends DboSource { * @param string $real Real database-layer column type (i.e. "varchar(255)") * @return string Abstract column type (i.e. "string") */ - function column($real) { + public function column($real) { if (is_array($real)) { $col = $real['name']; if (isset($real['limit'])) { diff --git a/lib/Cake/Model/Datasource/Database/Oracle.php b/lib/Cake/Model/Datasource/Database/Oracle.php index 76dfe1e1c..b98e04500 100644 --- a/lib/Cake/Model/Datasource/Database/Oracle.php +++ b/lib/Cake/Model/Datasource/Database/Oracle.php @@ -197,7 +197,7 @@ class DboOracle extends DboSource { * Keeps track of the most recent Oracle error * */ - function _setError($source = null, $clear = false) { + protected function _setError($source = null, $clear = false) { if ($source) { $e = ocierror($source); } else { @@ -215,7 +215,7 @@ class DboOracle extends DboSource { * @param string $lang language constant * @return bool */ - function setEncoding($lang) { + public function setEncoding($lang) { if (!$this->execute('ALTER SESSION SET NLS_LANGUAGE='.$lang)) { return false; } @@ -227,7 +227,7 @@ class DboOracle extends DboSource { * * @return string language constant */ - function getEncoding() { + public function getEncoding() { $sql = 'SELECT VALUE FROM NLS_SESSION_PARAMETERS WHERE PARAMETER=\'NLS_LANGUAGE\''; if (!$this->execute($sql)) { return false; @@ -404,7 +404,7 @@ class DboOracle extends DboSource { * * @return unknown */ - function fetchResult() { + public function fetchResult() { return $this->fetchRow(); } @@ -522,7 +522,7 @@ class DboOracle extends DboSource { * @access public * */ - function truncate($table, $reset = 0) { + public function truncate($table, $reset = 0) { if (empty($this->_sequences)) { $sql = "SELECT sequence_name FROM all_sequences"; @@ -569,7 +569,7 @@ class DboOracle extends DboSource { * @param string $table * @return mixed boolean true or array of constraints */ - function constraint($action, $table) { + public function constraint($action, $table) { if (empty($table)) { trigger_error(__d('cake_dev', 'Must specify table to operate on constraints')); } @@ -641,7 +641,7 @@ class DboOracle extends DboSource { * @param string $model Name of model to inspect * @return array Fields in table. Keys are column and unique */ - function index($model) { + public function index($model) { $index = array(); $table = $this->fullTableName($model, false); if ($table) { @@ -683,7 +683,7 @@ class DboOracle extends DboSource { * @param unknown_type $schema * @return unknown */ - function alterSchema($compare, $table = null) { + public function alterSchema($compare, $table = null) { if (!is_array($compare)) { return false; } @@ -754,7 +754,7 @@ class DboOracle extends DboSource { * @return boolean True on success, false on fail * (i.e. if the database/model does not support transactions). */ - function begin() { + public function begin() { $this->__transactionStarted = true; return true; } @@ -767,7 +767,7 @@ class DboOracle extends DboSource { * (i.e. if the database/model does not support transactions, * or a transaction has not started). */ - function rollback() { + public function rollback() { return ocirollback($this->connection); } @@ -779,7 +779,7 @@ class DboOracle extends DboSource { * (i.e. if the database/model does not support transactions, * or a transaction has not started). */ - function commit() { + public function commit() { $this->__transactionStarted = false; return ocicommit($this->connection); } @@ -919,7 +919,7 @@ class DboOracle extends DboSource { * @param array $data * @return string */ - function renderStatement($type, $data) { + public function renderStatement($type, $data) { extract($data); $aliases = null; @@ -972,7 +972,7 @@ class DboOracle extends DboSource { * @param integer $recursive Number of levels of association * @param array $stack */ - function queryAssociation($model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet, $recursive, $stack) { + public function queryAssociation($model, &$linkModel, $type, $association, $assocData, &$queryData, $external = false, &$resultSet, $recursive, $stack) { if ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) { if (!isset($resultSet) || !is_array($resultSet)) { if (Configure::read('debug') > 0) { @@ -1124,14 +1124,14 @@ class DboOracle extends DboSource { * Otherwise, all tables defined in the schema are generated. * @return string */ - function dropSchema(CakeSchema $schema, $table = null) { - $out = ''; + public function dropSchema(CakeSchema $schema, $table = null) { + $out = ''; - foreach ($schema->tables as $curTable => $columns) { - if (!$table || $table == $curTable) { - $out .= 'DROP TABLE ' . $this->fullTableName($curTable) . "\n"; - } + foreach ($schema->tables as $curTable => $columns) { + if (!$table || $table == $curTable) { + $out .= 'DROP TABLE ' . $this->fullTableName($curTable) . "\n"; } - return $out; } + return $out; + } } diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index b964d73ff..edba69436 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -110,7 +110,7 @@ class Postgres extends DboSource { * * @return True if successfully connected. */ - function connect() { + public function connect() { $config = $this->config; $this->connected = false; try { @@ -143,7 +143,7 @@ class Postgres extends DboSource { * * @return boolean */ - function enabled() { + public function enabled() { return in_array('pgsql', PDO::getAvailableDrivers()); } @@ -152,7 +152,7 @@ class Postgres extends DboSource { * * @return array Array of tablenames in the database */ - function listSources($data = null) { + public function listSources($data = null) { $cache = parent::listSources(); if ($cache != null) { @@ -184,7 +184,7 @@ class Postgres extends DboSource { * @param string $tableName Name of database table to inspect * @return array Fields in table. Keys are name and type */ - function describe($model) { + public function describe($model) { $fields = parent::describe($model); $table = $this->fullTableName($model, false); $this->_sequenceMap[$table] = array(); @@ -253,7 +253,7 @@ class Postgres extends DboSource { } if ($cols) { - $cols->closeCursor(); + $cols->closeCursor(); } return $fields; } @@ -265,7 +265,7 @@ class Postgres extends DboSource { * @param string $field Name of the ID database field. Defaults to "id" * @return integer */ - function lastInsertId($source, $field = 'id') { + public function lastInsertId($source, $field = 'id') { $seq = $this->getSequence($source, $field); return $this->_connection->lastInsertId($seq); } @@ -277,7 +277,7 @@ class Postgres extends DboSource { * @param string $field Name of the ID database field. Defaults to "id" * @return string The associated sequence name from the sequence map, defaults to "{$table}_{$field}_seq" */ - function getSequence($table, $field = 'id') { + public function getSequence($table, $field = 'id') { if (is_object($table)) { $table = $this->fullTableName($table, false); } @@ -321,7 +321,7 @@ class Postgres extends DboSource { * @param string $data * @return string SQL field */ - function name($data) { + public function name($data) { if (is_string($data)) { $data = str_replace('"__"', '__', $data); } @@ -336,7 +336,7 @@ class Postgres extends DboSource { * @param mixed $fields * @return array */ - 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; } @@ -393,7 +393,7 @@ class Postgres extends DboSource { * @return string quoted strig * @access private */ - function __quoteFunctionField($match) { + private function __quoteFunctionField($match) { $prepend = ''; if (strpos($match[1], 'DISTINCT') !== false) { $prepend = 'DISTINCT '; @@ -416,7 +416,7 @@ class Postgres extends DboSource { * @param string $model Name of model to inspect * @return array Fields in table. Keys are column and unique */ - function index($model) { + public function index($model) { $index = array(); $table = $this->fullTableName($model, false); if ($table) { @@ -457,7 +457,7 @@ class Postgres extends DboSource { * @access public * @return array */ - function alterSchema($compare, $table = null) { + public function alterSchema($compare, $table = null) { if (!is_array($compare)) { return false; } @@ -545,7 +545,7 @@ class Postgres extends DboSource { * @param array $new Indexes to add and drop * @return array Index alteration statements */ - function _alterIndexes($table, $indexes) { + protected function _alterIndexes($table, $indexes) { $alter = array(); if (isset($indexes['drop'])) { foreach($indexes['drop'] as $name => $value) { @@ -587,7 +587,7 @@ class Postgres extends DboSource { * @param integer $offset Offset from which to start results * @return string SQL limit/offset statement */ - function limit($limit, $offset = null) { + public function limit($limit, $offset = null) { if ($limit) { $rt = ''; if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0) { @@ -610,7 +610,7 @@ class Postgres extends DboSource { * @param string $real Real database-layer column type (i.e. "varchar(255)") * @return string Abstract column type (i.e. "string") */ - function column($real) { + public function column($real) { if (is_array($real)) { $col = $real['name']; if (isset($real['limit'])) { @@ -659,7 +659,7 @@ class Postgres extends DboSource { * @param string $real Real database-layer column type (i.e. "varchar(255)") * @return int An integer representing the length of the column */ - function length($real) { + public function length($real) { $col = str_replace(array(')', 'unsigned'), '', $real); $limit = null; @@ -680,7 +680,7 @@ class Postgres extends DboSource { * * @param unknown_type $results */ - function resultSet(&$results) { + public function resultSet(&$results) { $this->map = array(); $numFields = $results->columnCount(); $index = 0; @@ -703,7 +703,7 @@ class Postgres extends DboSource { * * @return unknown */ - function fetchResult() { + public function fetchResult() { if ($row = $this->_result->fetch()) { $resultRow = array(); @@ -733,11 +733,11 @@ class Postgres extends DboSource { /** * Translates between PHP boolean values and PostgreSQL boolean values * - * @param mixed $data Value to be translated + * @param mixed $data Value to be translated * @param boolean $quote true to quote a boolean to be used in a query, flase to return the boolean value * @return boolean Converted boolean value */ - function boolean($data, $quote = false) { + public function boolean($data, $quote = false) { switch (true) { case ($data === true || $data === false): $result = $data; @@ -768,7 +768,7 @@ class Postgres extends DboSource { * @param mixed $enc Database encoding * @return boolean True on success, false on failure */ - function setEncoding($enc) { + public function setEncoding($enc) { if ($this->_execute('SET NAMES ?', array($enc))) { return true; } @@ -780,7 +780,7 @@ class Postgres extends DboSource { * * @return string The database encoding */ - function getEncoding() { + public function getEncoding() { $cosa = $this->_execute('SHOW client_encoding')->fetch(); } @@ -792,7 +792,7 @@ class Postgres extends DboSource { * where options can be 'default', 'length', or 'key'. * @return string */ - function buildColumn($column) { + public function buildColumn($column) { $col = $this->columns[$column['type']]; if (!isset($col['length']) && !isset($col['limit'])) { unset($column['length']); @@ -825,7 +825,7 @@ class Postgres extends DboSource { * @param string $table * @return string */ - function buildIndex($indexes, $table = null) { + public function buildIndex($indexes, $table = null) { $join = array(); if (!is_array($indexes)) { return array(); @@ -857,7 +857,7 @@ class Postgres extends DboSource { * @param array $data * @return string */ - function renderStatement($type, $data) { + public function renderStatement($type, $data) { switch (strtolower($type)) { case 'schema': extract($data); diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index d4daa3aac..a2c9f88db 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -109,7 +109,7 @@ class Sqlite extends DboSource { * @return mixed * @access public */ - function connect() { + public function connect() { $config = $this->config; $flags = array(PDO::ATTR_PERSISTENT => $config['persistent']); try { @@ -127,7 +127,7 @@ class Sqlite extends DboSource { * * @return boolean */ - function enabled() { + public function enabled() { return in_array('sqlite', PDO::getAvailableDrivers()); } @@ -137,7 +137,7 @@ class Sqlite extends DboSource { * @return array Array of tablenames in the database * @access public */ - function listSources($data = null) { + public function listSources($data = null) { $cache = parent::listSources(); if ($cache != null) { return $cache; @@ -165,7 +165,7 @@ class Sqlite extends DboSource { * @return array Fields in table. Keys are name and type * @access public */ - function describe($model) { + public function describe($model) { $cache = parent::describe($model); if ($cache != null) { return $cache; @@ -207,7 +207,7 @@ class Sqlite extends DboSource { * @return array * @access public */ - function update($model, $fields = array(), $values = null, $conditions = null) { + public function update($model, $fields = array(), $values = null, $conditions = null) { if (empty($values) && !empty($fields)) { foreach ($fields as $field => $value) { if (strpos($field, $model->alias . '.') !== false) { @@ -229,7 +229,7 @@ class Sqlite extends DboSource { * @return boolean SQL TRUNCATE TABLE statement, false if not applicable. * @access public */ - function truncate($table) { + public function truncate($table) { $this->_execute('DELETE FROM sqlite_sequence where name=' . $this->fullTableName($table)); return $this->execute('DELETE FROM ' . $this->fullTableName($table)); } @@ -241,7 +241,7 @@ class Sqlite extends DboSource { * @return string Abstract column type (i.e. "string") * @access public */ - function column($real) { + public function column($real) { if (is_array($real)) { $col = $real['name']; if (isset($real['limit'])) { @@ -275,7 +275,7 @@ class Sqlite extends DboSource { * @param mixed $results * @access public */ - function resultSet($results) { + public function resultSet($results) { $this->results = $results; $this->map = array(); $num_fields = $results->columnCount(); @@ -332,7 +332,7 @@ class Sqlite extends DboSource { * * @return mixed array with results fetched and mapped to column names or false if there is no results left to fetch */ - function fetchResult() { + public function fetchResult() { if ($row = $this->_result->fetch()) { $resultRow = array(); foreach ($this->map as $col => $meta) { @@ -358,7 +358,7 @@ class Sqlite extends DboSource { * @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) { @@ -381,7 +381,7 @@ class Sqlite extends DboSource { * @return string * @access public */ - function buildColumn($column) { + public function buildColumn($column) { $name = $type = null; $column = array_merge(array('null' => true), $column); extract($column); @@ -410,7 +410,7 @@ class Sqlite extends DboSource { * @param string $enc Database encoding * @access public */ - function setEncoding($enc) { + public function setEncoding($enc) { if (!in_array($enc, array("UTF-8", "UTF-16", "UTF-16le", "UTF-16be"))) { return false; } @@ -423,7 +423,7 @@ class Sqlite extends DboSource { * @return string The database encoding * @access public */ - function getEncoding() { + public function getEncoding() { return $this->fetchRow('PRAGMA encoding'); } @@ -435,7 +435,7 @@ class Sqlite extends DboSource { * @return string * @access public */ - function buildIndex($indexes, $table = null) { + public function buildIndex($indexes, $table = null) { $join = array(); foreach ($indexes as $name => $value) { @@ -468,7 +468,7 @@ class Sqlite extends DboSource { * @return array Fields in table. Keys are column and unique * @access public */ - function index($model) { + public function index($model) { $index = array(); $table = $this->fullTableName($model); if ($table) { @@ -509,7 +509,7 @@ class Sqlite extends DboSource { * @return string * @access public */ - function renderStatement($type, $data) { + public function renderStatement($type, $data) { switch (strtolower($type)) { case 'schema': extract($data); @@ -533,7 +533,7 @@ class Sqlite extends DboSource { * @return boolean * @access public */ - function hasResult() { + public function hasResult() { return is_object($this->_result); } diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 600b10625..48716400f 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -280,7 +280,7 @@ class DboSource extends DataSource { * @param array $config An array defining the new configuration settings * @return boolean True on success, false on failure */ - function reconnect($config = array()) { + public function reconnect($config = array()) { $this->disconnect(); $this->setConfig($config); $this->_sources = null; @@ -293,7 +293,7 @@ class DboSource extends DataSource { * * @return boolean True if the database could be disconnected, else false */ - function disconnect() { + public function disconnect() { if ($this->_result instanceof PDOStatement) { $this->_result->closeCursor(); } @@ -318,7 +318,7 @@ class DboSource extends DataSource { * @param string $column The column into which this data will be inserted * @return string Quoted and escaped data */ - function value($data, $column = null) { + public function value($data, $column = null) { if (is_array($data) && !empty($data)) { return array_map( array(&$this, 'value'), @@ -491,7 +491,7 @@ class DboSource extends DataSource { * @param PDOStatement $query the query to extract the error from if any * @return string Error message with error number */ - function lastError(PDOStatement $query = null) { + public function lastError(PDOStatement $query = null) { $error = $query->errorInfo(); if (empty($error[2])) { return null; @@ -505,7 +505,7 @@ class DboSource extends DataSource { * * @return integer Number of affected rows */ - function lastAffected() { + public function lastAffected() { if ($this->hasResult()) { return $this->_result->rowCount(); } @@ -518,7 +518,7 @@ class DboSource extends DataSource { * * @return integer Number of rows in resultset */ - function lastNumRows() { + public function lastNumRows() { return $this->lastAffected(); } @@ -1333,7 +1333,7 @@ class DboSource extends DataSource { * @param object $linkModel Model being merged * @return void */ - function __mergeHasMany(&$resultSet, $merge, $association, $model, $linkModel) { + private function __mergeHasMany(&$resultSet, $merge, $association, $model, $linkModel) { $modelAlias = $model->alias; $modelPK = $model->primaryKey; $modelFK = $model->hasMany[$association]['foreignKey']; @@ -2073,7 +2073,7 @@ class DboSource extends DataSource { * @param unknown_type $source * @return in */ - function lastInsertId($source = null) { + public function lastInsertId($source = null) { return $this->_connection->lastInsertId(); } @@ -2133,7 +2133,7 @@ class DboSource extends DataSource { * @param array $data * @return array */ - public function __scrubQueryData($data) { + function __scrubQueryData($data) { static $base = null; if ($base === null) { $base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array()); @@ -2453,7 +2453,7 @@ class DboSource extends DataSource { * @return string * @access private */ - function __parseKey($model, $key, $value) { + private function __parseKey($model, $key, $value) { $operatorMatch = '/^((' . implode(')|(', $this->__sqlOps); $operatorMatch .= '\\x20)|<[>=]?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)/is'; $bound = (strpos($key, '?') !== false || (is_array($value) && strpos($key, ':') !== false)); @@ -2540,7 +2540,7 @@ class DboSource extends DataSource { * @return string or false if no match * @access private */ - function __quoteFields($conditions) { + private function __quoteFields($conditions) { $start = $end = null; $original = $conditions; @@ -2566,7 +2566,7 @@ class DboSource extends DataSource { * @return string quoted strig * @access private */ - function __quoteMatchedField($match) { + private function __quoteMatchedField($match) { if (is_numeric($match[0])) { return $match[0]; } @@ -2881,7 +2881,7 @@ class DboSource extends DataSource { * @param unknown_type $schema * @return boolean */ - function alterSchema($compare, $table = null) { + public function alterSchema($compare, $table = null) { return false; } @@ -2975,7 +2975,7 @@ class DboSource extends DataSource { * @param string $position The position type to use. 'beforeDefault' or 'afterDefault' are common * @return string a built column with the field parameters added. */ - public function _buildFieldParameters($columnString, $columnData, $position) { + protected 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'])) { diff --git a/lib/Cake/Model/Datasource/Session/DatabaseSession.php b/lib/Cake/Model/Datasource/Session/DatabaseSession.php index ceff5fdb0..4d405ce68 100644 --- a/lib/Cake/Model/Datasource/Session/DatabaseSession.php +++ b/lib/Cake/Model/Datasource/Session/DatabaseSession.php @@ -24,12 +24,12 @@ class DatabaseSession implements CakeSessionHandlerInterface { /** - * Constructor. Looks at Session configuration information and + * Constructor. Looks at Session configuration information and * sets up the session model. * * @return void */ - function __construct() { + public function __construct() { $modelName = Configure::read('Session.handler.model'); $database = Configure::read('Session.handler.database'); $table = Configure::read('Session.handler.table'); diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index 63f1f6017..3f07a7672 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -412,7 +412,7 @@ class Model extends Object { * @param string $table Name of database table to use. * @param string $ds DataSource connection name. */ - function __construct($id = false, $table = null, $ds = null) { + public function __construct($id = false, $table = null, $ds = null) { parent::__construct(); if (is_array($id)) { @@ -569,7 +569,7 @@ class Model extends Object { * @param string $name variable requested for it's value or reference * @return mixed value of requested variable if it is set */ - function __get($name) { + public function __get($name) { if ($name === 'displayField') { return $this->displayField = $this->hasField(array('title', 'name', $this->primaryKey)); } @@ -598,7 +598,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1045/Creating-and-Destroying-Associations-on-the-Fly */ - function bindModel($params, $reset = true) { + public function bindModel($params, $reset = true) { foreach ($params as $assoc => $model) { if ($reset === true && !isset($this->__backAssociation[$assoc])) { $this->__backAssociation[$assoc] = $this->{$assoc}; @@ -643,7 +643,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1045/Creating-and-Destroying-Associations-on-the-Fly */ - function unbindModel($params, $reset = true) { + public function unbindModel($params, $reset = true) { foreach ($params as $assoc => $models) { if ($reset === true && !isset($this->__backAssociation[$assoc])) { $this->__backAssociation[$assoc] = $this->{$assoc}; @@ -664,7 +664,7 @@ class Model extends Object { * @return void * @access private */ - function __createLinks() { + private function __createLinks() { foreach ($this->__associations as $type) { if (!is_array($this->{$type})) { $this->{$type} = explode(',', $this->{$type}); @@ -711,7 +711,7 @@ class Model extends Object { * @return void * @access private */ - function __constructLinkedModel($assoc, $className = null, $plugin = null) { + private function __constructLinkedModel($assoc, $className = null, $plugin = null) { if (empty($className)) { $className = $assoc; } @@ -736,7 +736,7 @@ class Model extends Object { * @return void * @access private */ - function __generateAssociation($type, $assocKey) { + private function __generateAssociation($type, $assocKey) { $class = $assocKey; $dynamicWith = false; @@ -829,7 +829,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1031/Saving-Your-Data */ - function set($one, $two = null) { + public function set($one, $two = null) { if (!$one) { return; } @@ -1146,7 +1146,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1031/Saving-Your-Data */ - function create($data = array(), $filterKey = false) { + public function create($data = array(), $filterKey = false) { $defaults = array(); $this->id = false; $this->data = array(); @@ -1177,7 +1177,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1017/Retrieving-Your-Data#read-1029 */ - function read($fields = null, $id = null) { + public function read($fields = null, $id = null) { $this->validationErrors = array(); if ($id != null) { @@ -1212,7 +1212,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1017/Retrieving-Your-Data#field-1028 */ - function field($name, $conditions = null, $order = null) { + public function field($name, $conditions = null, $order = null) { if ($conditions === null && $this->id !== false) { $conditions = array($this->alias . '.' . $this->primaryKey => $this->id); } @@ -1253,7 +1253,7 @@ class Model extends Object { * @see Model::save() * @link http://book.cakephp.org/view/1031/Saving-Your-Data */ - function saveField($name, $value, $validate = false) { + public function saveField($name, $value, $validate = false) { $id = $this->id; $this->create(false); @@ -1278,7 +1278,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1031/Saving-Your-Data */ - function save($data = null, $validate = true, $fieldList = array()) { + public function save($data = null, $validate = true, $fieldList = array()) { $defaults = array('validate' => true, 'fieldList' => array(), 'callbacks' => true); $_whitelist = $this->whitelist; $fields = array(); @@ -1449,7 +1449,7 @@ class Model extends Object { * @param mixed $id ID of record in this model * @access private */ - function __saveMulti($joined, $id, $db) { + private function __saveMulti($joined, $id, $db) { foreach ($joined as $assoc => $data) { if (isset($this->hasAndBelongsToMany[$assoc])) { @@ -1634,7 +1634,7 @@ class Model extends Object { * @link http://book.cakephp.org/view/1032/Saving-Related-Model-Data-hasOne-hasMany-belongsTo * @link http://book.cakephp.org/view/1031/Saving-Your-Data */ - function saveAll($data = null, $options = array()) { + public function saveAll($data = null, $options = array()) { if (empty($data)) { $data = $this->data; } @@ -1833,7 +1833,7 @@ class Model extends Object { * @access private * @see Model::saveAll() */ - function __save($data, $options) { + private function __save($data, $options) { if ($options['validate'] === 'first' || $options['validate'] === 'only') { if (!($this->create($data) && $this->validates($options))) { return false; @@ -1854,7 +1854,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1031/Saving-Your-Data */ - function updateAll($fields, $conditions = true) { + public function updateAll($fields, $conditions = true) { return $this->getDataSource()->update($this, $fields, null, $conditions); } @@ -1867,7 +1867,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1036/delete */ - function delete($id = null, $cascade = true) { + public function delete($id = null, $cascade = true) { if (!empty($id)) { $this->id = $id; } @@ -1983,7 +1983,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1038/deleteAll */ - function deleteAll($conditions, $cascade = true, $callbacks = false) { + public function deleteAll($conditions, $cascade = true, $callbacks = false) { if (empty($conditions)) { return false; } @@ -2031,7 +2031,7 @@ class Model extends Object { * @return array * @access private */ - function __collectForeignKeys($type = 'belongsTo') { + private function __collectForeignKeys($type = 'belongsTo') { $result = array(); foreach ($this->{$type} as $assoc => $data) { @@ -2499,7 +2499,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1027/query */ - function query() { + public function query() { $params = func_get_args(); $db = $this->getDataSource(); return call_user_func_array(array(&$db, 'query'), $params); @@ -2516,7 +2516,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller */ - function validates($options = array()) { + public function validates($options = array()) { $errors = $this->invalidFields($options); if (empty($errors) && $errors !== false) { $errors = $this->__validateWithModels($options); @@ -2536,7 +2536,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller */ - function invalidFields($options = array()) { + public function invalidFields($options = array()) { if ( !$this->Behaviors->trigger( 'beforeValidate', @@ -2688,7 +2688,7 @@ class Model extends Object { * @access private * @see Model::validates() */ - function __validateWithModels($options) { + private function __validateWithModels($options) { $valid = true; foreach ($this->hasAndBelongsToMany as $assoc => $association) { if (empty($association['with']) || !isset($this->data[$assoc])) { @@ -2972,7 +2972,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeFind-1049 */ - function beforeFind($queryData) { + public function beforeFind($queryData) { return true; } @@ -2986,7 +2986,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1048/Callback-Methods#afterFind-1050 */ - function afterFind($results, $primary = false) { + public function afterFind($results, $primary = false) { return $results; } @@ -2998,7 +2998,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeSave-1052 */ - function beforeSave($options = array()) { + public function beforeSave($options = array()) { return true; } @@ -3009,7 +3009,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1048/Callback-Methods#afterSave-1053 */ - function afterSave($created) { + public function afterSave($created) { } /** @@ -3020,7 +3020,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeDelete-1054 */ - function beforeDelete($cascade = true) { + public function beforeDelete($cascade = true) { return true; } @@ -3030,7 +3030,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1048/Callback-Methods#afterDelete-1055 */ - function afterDelete() { + public function afterDelete() { } /** @@ -3042,7 +3042,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeValidate-1051 */ - function beforeValidate($options = array()) { + public function beforeValidate($options = array()) { return true; } @@ -3052,7 +3052,7 @@ class Model extends Object { * @access public * @link http://book.cakephp.org/view/1048/Callback-Methods#onError-1056 */ - function onError() { + public function onError() { } /** @@ -3064,7 +3064,7 @@ class Model extends Object { * @access protected * @todo */ - function _clearCache($type = null) { + protected function _clearCache($type = null) { if ($type === null) { if (Configure::read('Cache.check') === true) { $assoc[] = strtolower(Inflector::pluralize($this->alias)); @@ -3092,7 +3092,7 @@ class Model extends Object { * @return array Set of object variable names this model has * @access private */ - function __sleep() { + private function __sleep() { $return = array_keys(get_object_vars($this)); return $return; } @@ -3103,7 +3103,6 @@ class Model extends Object { * @access private * @todo */ - function __wakeup() { + private function __wakeup() { } } - diff --git a/lib/Cake/Model/ModelBehavior.php b/lib/Cake/Model/ModelBehavior.php index 7ff613b71..c60668331 100644 --- a/lib/Cake/Model/ModelBehavior.php +++ b/lib/Cake/Model/ModelBehavior.php @@ -36,13 +36,13 @@ * //do something * } * }}} - * + * * Would be called like `$this->Model->doSomething($arg1, $arg2);`. * * ### Mapped methods * * Behaviors can also define mapped methods. Mapped methods use pattern matching for method invocation. This - * allows you to create methods similar to Model::findAllByXXX methods on your behaviors. Mapped methods need to + * allows you to create methods similar to Model::findAllByXXX methods on your behaviors. Mapped methods need to * be declared in your behaviors `$mapMethods` array. The method signature for a mapped method is slightly different * than a normal behavior mixin method. * @@ -100,7 +100,7 @@ class ModelBehavior extends Object { * @param object $model Model using this behavior * @see BehaviorCollection::detach() */ - function cleanup($model) { + public function cleanup($model) { if (isset($this->settings[$model->alias])) { unset($this->settings[$model->alias]); } @@ -113,7 +113,7 @@ 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 mixed False or null will abort the operation. You can return an array to replace the + * @return mixed False or null will abort the operation. You can return an array to replace the * $query that will be eventually run. */ public function beforeFind($model, $query) { @@ -131,7 +131,7 @@ class ModelBehavior extends Object { public function afterFind($model, $results, $primary) { } /** - * beforeValidate is called before a model is validated, you can use this callback to + * beforeValidate is called before a model is validated, you can use this callback to * add behavior validation rules into a models validate array. Returning false * will allow you to make the validation fail. * @@ -139,7 +139,7 @@ class ModelBehavior extends Object { * @return mixed False or null will abort the operation. Any other result will continue. * @access public */ - public function beforeValidate($model) { + public function beforeValidate($model) { return true; } @@ -150,7 +150,7 @@ class ModelBehavior extends Object { * @param object $model Model using this behavior * @return mixed False if the operation should abort. Any other result will continue. */ - public function beforeSave($model) { + public function beforeSave($model) { return true; } @@ -173,7 +173,7 @@ class ModelBehavior extends Object { * @return mixed False if the operation should abort. Any other result will continue. * @access public */ - public function beforeDelete($model, $cascade = true) { + public function beforeDelete($model, $cascade = true) { return true; } @@ -202,7 +202,7 @@ class ModelBehavior extends Object { * @param string $field Field to be added to $model's whitelist * @return void */ - function _addToWhitelist($model, $field) { + protected function _addToWhitelist($model, $field) { if (is_array($field)) { foreach ($field as $f) { $this->_addToWhitelist($model, $f); diff --git a/lib/Cake/Model/Permission.php b/lib/Cake/Model/Permission.php index 5ca0f0682..fbfb200c7 100644 --- a/lib/Cake/Model/Permission.php +++ b/lib/Cake/Model/Permission.php @@ -74,7 +74,7 @@ class Permission extends AppModel { * Constructor, used to tell this model to use the * database configured for ACL */ - function __construct() { + public function __construct() { $config = Configure::read('Acl.database'); if (!empty($config)) { $this->useDbConfig = $config; diff --git a/lib/Cake/Network/CakeSocket.php b/lib/Cake/Network/CakeSocket.php index 603a84ace..ba2f9ffbd 100644 --- a/lib/Cake/Network/CakeSocket.php +++ b/lib/Cake/Network/CakeSocket.php @@ -87,7 +87,7 @@ class CakeSocket { * @param array $config Socket configuration, which will be merged with the base configuration * @see CakeSocket::$_baseConfig */ - function __construct($config = array()) { + public function __construct($config = array()) { $this->config = array_merge($this->_baseConfig, $config); if (!is_numeric($this->config['protocol'])) { $this->config['protocol'] = getprotobyname($this->config['protocol']); @@ -258,7 +258,7 @@ class CakeSocket { * * @access private */ - function __destruct() { + public function __destruct() { $this->disconnect(); } diff --git a/lib/Cake/Network/Email/SmtpTransport.php b/lib/Cake/Network/Email/SmtpTransport.php index 4cd698e73..a5c4452df 100644 --- a/lib/Cake/Network/Email/SmtpTransport.php +++ b/lib/Cake/Network/Email/SmtpTransport.php @@ -193,7 +193,7 @@ class SmtpTransport extends AbstractTransport { * @return void * @throws SocketException */ - function _smtpSend($data, $checkCode = '250') { + protected function _smtpSend($data, $checkCode = '250') { if (!is_null($data)) { $this->_socket->write($data . "\r\n"); } diff --git a/lib/Cake/Network/Http/HttpResponse.php b/lib/Cake/Network/Http/HttpResponse.php index 58b74bffc..6464c40d1 100644 --- a/lib/Cake/Network/Http/HttpResponse.php +++ b/lib/Cake/Network/Http/HttpResponse.php @@ -429,7 +429,7 @@ class HttpResponse implements ArrayAccess { * * @return string */ - public function __toString() { + function __toString() { return $this->body(); } diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index 7f43d8ce2..343427cf7 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -107,7 +107,7 @@ class Debugger { * Constructor. * */ - function __construct() { + public function __construct() { $docRef = ini_get('docref_root'); if (empty($docRef) && function_exists('ini_set')) { diff --git a/lib/Cake/Utility/File.php b/lib/Cake/Utility/File.php index ff0eadaa1..2e6f629a5 100644 --- a/lib/Cake/Utility/File.php +++ b/lib/Cake/Utility/File.php @@ -87,7 +87,7 @@ class File { * @param boolean $create Create file if it does not exist (if true) * @param integer $mode Mode to apply to the folder holding the file */ - function __construct($path, $create = false, $mode = 0755) { + public function __construct($path, $create = false, $mode = 0755) { $this->Folder = new Folder(dirname($path), $create, $mode); if (!is_dir($path)) { $this->name = basename($path); @@ -100,7 +100,7 @@ class File { * Closes the current file if it is opened * */ - function __destruct() { + public function __destruct() { $this->close(); } @@ -201,7 +201,7 @@ class File { } /** - * Prepares a ascii string for writing. Converts line endings to the + * Prepares a ascii string for writing. Converts line endings to the * correct terminator for the current platform. If windows "\r\n" will be used * all other platforms will use "\n" * diff --git a/lib/Cake/Utility/Folder.php b/lib/Cake/Utility/Folder.php index f8d8f283a..61e2e8952 100644 --- a/lib/Cake/Utility/Folder.php +++ b/lib/Cake/Utility/Folder.php @@ -89,7 +89,7 @@ class Folder { * @param boolean $create Create folder if not found * @param mixed $mode Mode (CHMOD) to apply to created folder, false to ignore */ - function __construct($path = false, $create = false, $mode = false) { + public function __construct($path = false, $create = false, $mode = false) { if (empty($path)) { $path = TMP; } @@ -215,7 +215,7 @@ class Folder { * @return array Files matching pattern * @access private */ - function _findRecursive($pattern, $sort = false) { + public function _findRecursive($pattern, $sort = false) { list($dirs, $files) = $this->read($sort); $found = array(); @@ -428,7 +428,7 @@ class Folder { * @param mixed $exceptions Array of files to exclude from the read that will be performed. * @access private */ - function __tree($path, $exceptions) { + public function __tree($path, $exceptions) { $this->path = $path; list($dirs, $files) = $this->read(false, $exceptions, true); $this->__directories = array_merge($this->__directories, $dirs); @@ -702,7 +702,7 @@ class Folder { * @param string $path Path to resolve * @return string The resolved path */ - function realpath($path) { + public function realpath($path) { $path = str_replace('/', DS, trim($path)); if (strpos($path, '..') === false) { if (!Folder::isAbsolute($path)) { diff --git a/lib/Cake/Utility/Security.php b/lib/Cake/Utility/Security.php index fb20e187c..16f3c1e9b 100644 --- a/lib/Cake/Utility/Security.php +++ b/lib/Cake/Utility/Security.php @@ -69,7 +69,7 @@ class Security { * @return boolean Success * @todo Complete implementation */ - function validateAuthKey($authKey) { + public static function validateAuthKey($authKey) { return true; } diff --git a/lib/Cake/View/Helper.php b/lib/Cake/View/Helper.php index a292a02ee..3f69b071d 100644 --- a/lib/Cake/View/Helper.php +++ b/lib/Cake/View/Helper.php @@ -51,7 +51,7 @@ class Helper extends Object { public $theme = null; /** - * Request object + * Request object * * @var CakeRequest */ @@ -430,8 +430,8 @@ class Helper extends Object { $ModelObj = ClassRegistry::getObject($model); for ($i = 0; $i < $count; $i++) { if ( - is_a($ModelObj, 'Model') && - ($ModelObj->hasField($parts[$i]) || + is_a($ModelObj, 'Model') && + ($ModelObj->hasField($parts[$i]) || array_key_exists($parts[$i], $ModelObj->validate)) ) { $hasField = $i; @@ -821,7 +821,7 @@ class Helper extends Object { * @return array * @access private */ - function __selectedArray($data, $key = 'id') { + private function __selectedArray($data, $key = 'id') { if (!is_array($data)) { $model = $data; if (!empty($this->request->data[$model][$model])) { @@ -846,7 +846,7 @@ class Helper extends Object { * @return void * @access private */ - function __reset() { + private function __reset() { $this->__tainted = null; $this->__cleaned = null; } @@ -857,7 +857,7 @@ class Helper extends Object { * @return void * @access private */ - function __clean() { + private function __clean() { if (get_magic_quotes_gpc()) { $this->__cleaned = stripslashes($this->__tainted); } else { diff --git a/lib/Cake/View/MediaView.php b/lib/Cake/View/MediaView.php index 70e92979c..69d67362b 100644 --- a/lib/Cake/View/MediaView.php +++ b/lib/Cake/View/MediaView.php @@ -74,7 +74,7 @@ class MediaView extends View { * * @param object $controller The controller with viewVars */ - function __construct($controller = null) { + public function __construct($controller = null) { parent::__construct($controller); if (is_object($controller) && isset($controller->response)) { $this->response = $controller->response; @@ -88,7 +88,7 @@ class MediaView extends View { * * @return mixed */ - function render() { + public function render() { $name = $download = $extension = $id = $modified = $path = $cache = $mimeType = $compress = null; extract($this->viewVars, EXTR_OVERWRITE); diff --git a/lib/Cake/View/ThemeView.php b/lib/Cake/View/ThemeView.php index 622ce2a28..6dedaacbe 100644 --- a/lib/Cake/View/ThemeView.php +++ b/lib/Cake/View/ThemeView.php @@ -36,7 +36,7 @@ class ThemeView extends View { * * @param Controller $controller Controller object to be rendered. */ - function __construct($controller) { + public function __construct($controller) { parent::__construct($controller); $this->theme = $controller->theme; } @@ -50,7 +50,7 @@ class ThemeView extends View { * @access protected * @todo Make theme path building respect $cached parameter. */ - function _paths($plugin = null, $cached = true) { + protected function _paths($plugin = null, $cached = true) { $paths = parent::_paths($plugin, $cached); $themePaths = array(); diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index 59c116aa4..6a4a4082f 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -271,7 +271,7 @@ class View extends Object { * * @param Controller $controller A controller object to pull View::__passedArgs from. */ - function __construct($controller) { + public function __construct($controller) { if (is_object($controller)) { $count = count($this->__passedVars); for ($j = 0; $j < $count; $j++) { @@ -764,7 +764,7 @@ class View extends Object { * @return array Array of extensions view files use. * @access protected */ - function _getExtensions() { + protected function _getExtensions() { $exts = array($this->ext); if ($this->ext !== '.ctp') { array_push($exts, '.ctp');