Adding proper visibility keywords for class functions

This commit is contained in:
ADmad 2011-05-29 02:08:46 +05:30
parent e5f2f6a236
commit 4c042ae133
34 changed files with 209 additions and 210 deletions

View file

@ -22,7 +22,7 @@ class CakeErrorController extends AppController {
* @access public * @access public
* @return void * @return void
*/ */
function __construct($request = null) { public function __construct($request = null) {
parent::__construct($request); parent::__construct($request);
$this->constructClasses(); $this->constructClasses();
$this->Components->trigger('initialize', array(&$this)); $this->Components->trigger('initialize', array(&$this));
@ -34,7 +34,7 @@ class CakeErrorController extends AppController {
* *
* @return void * @return void
*/ */
function beforeRender() { public function beforeRender() {
parent::beforeRender(); parent::beforeRender();
foreach ($this->viewVars as $key => $value) { foreach ($this->viewVars as $key => $value) {
if (!is_object($value)){ if (!is_object($value)){

View file

@ -132,7 +132,7 @@ class Component extends Object {
* @param object $controller Controller with components to shutdown * @param object $controller Controller with components to shutdown
* @return void * @return void
*/ */
function shutdown($controller) { } public function shutdown($controller) { }
/** /**
* Called before Controller::redirect(). Allows you to replace the url that will * Called before Controller::redirect(). Allows you to replace the url that will

View file

@ -106,7 +106,7 @@ class Scaffold {
* @param Controller $controller Controller to scaffold * @param Controller $controller Controller to scaffold
* @param CakeRequest $request Request parameters. * @param CakeRequest $request Request parameters.
*/ */
function __construct(Controller $controller, CakeRequest $request) { public function __construct(Controller $controller, CakeRequest $request) {
$this->controller = $controller; $this->controller = $controller;
$count = count($this->__passedVars); $count = count($this->__passedVars);

View file

@ -372,5 +372,5 @@ interface ConfigReaderInterface {
* @param string $key * @param string $key
* @return array An array of data to merge into the runtime configuration * @return array An array of data to merge into the runtime configuration
*/ */
function read($key); public function read($key);
} }

View file

@ -177,7 +177,7 @@ class Object {
* @access protected * @access protected
* @todo add examples to manual * @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'; $file = CACHE . 'persistent' . DS . strtolower($name) . '.php';
if ($return === null) { if ($return === null) {
if (!file_exists($file)) { if (!file_exists($file)) {
@ -256,7 +256,7 @@ class Object {
* @return void * @return void
* @access private * @access private
*/ */
function __openPersistent($name, $type = null) { private function __openPersistent($name, $type = null) {
$file = CACHE . 'persistent' . DS . strtolower($name) . '.php'; $file = CACHE . 'persistent' . DS . strtolower($name) . '.php';
include($file); include($file);

View file

@ -89,7 +89,7 @@ class ExceptionRenderer {
* @param string $method Method producing the error * @param string $method Method producing the error
* @param array $messages Error messages * @param array $messages Error messages
*/ */
function __construct(Exception $exception) { public function __construct(Exception $exception) {
$this->controller = $this->_getController($exception); $this->controller = $this->_getController($exception);
if (method_exists($this->controller, 'apperror')) { if (method_exists($this->controller, 'apperror')) {

View file

@ -558,7 +558,7 @@ class I18n {
* @param string $domain Domain where format is stored * @param string $domain Domain where format is stored
* @return mixed translated format string if only value or array of translated strings for corresponding format. * @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 (!empty($this->__domains[$domain][$this->__lang]['LC_TIME'][$format])) {
if (($trans = $this->__domains[$domain][$this->__lang][$this->category][$format])) { if (($trans = $this->__domains[$domain][$this->__lang][$this->category][$format])) {
return $trans; return $trans;

View file

@ -328,7 +328,7 @@ class L10n {
/** /**
* Class constructor * Class constructor
*/ */
function __construct() { public function __construct() {
if (defined('DEFAULT_LANGUAGE')) { if (defined('DEFAULT_LANGUAGE')) {
$this->default = DEFAULT_LANGUAGE; $this->default = DEFAULT_LANGUAGE;
} }
@ -356,7 +356,7 @@ class L10n {
* @param string $language Language (if null will use DEFAULT_LANGUAGE if defined) * @param string $language Language (if null will use DEFAULT_LANGUAGE if defined)
* @access private * @access private
*/ */
function __setLanguage($language = null) { private function __setLanguage($language = null) {
$langKey = null; $langKey = null;
if ($language !== null && isset($this->__l10nMap[$language]) && isset($this->__l10nCatalog[$this->__l10nMap[$language]])) { if ($language !== null && isset($this->__l10nMap[$language]) && isset($this->__l10nCatalog[$this->__l10nMap[$language]])) {
$langKey = $this->__l10nMap[$language]; $langKey = $this->__l10nMap[$language];
@ -405,7 +405,7 @@ class L10n {
* @return boolean Success * @return boolean Success
* @access private * @access private
*/ */
function __autoLanguage() { private function __autoLanguage() {
$_detectableLanguages = CakeRequest::acceptLanguage(); $_detectableLanguages = CakeRequest::acceptLanguage();
foreach ($_detectableLanguages as $key => $langKey) { foreach ($_detectableLanguages as $key => $langKey) {
if (isset($this->__l10nCatalog[$langKey])) { if (isset($this->__l10nCatalog[$langKey])) {

View file

@ -49,7 +49,7 @@ class AclNode extends AppModel {
* Constructor * Constructor
* *
*/ */
function __construct() { public function __construct() {
$config = Configure::read('Acl.database'); $config = Configure::read('Acl.database');
if (isset($config)) { if (isset($config)) {
$this->useDbConfig = $config; $this->useDbConfig = $config;

View file

@ -381,7 +381,7 @@ class TranslateBehavior extends ModelBehavior {
* @param boolean $reset * @param boolean $reset
* @return bool * @return bool
*/ */
function bindTranslation($model, $fields, $reset = true) { public function bindTranslation($model, $fields, $reset = true) {
if (is_string($fields)) { if (is_string($fields)) {
$fields = array($fields); $fields = array($fields);
} }
@ -454,7 +454,7 @@ class TranslateBehavior extends ModelBehavior {
* unbind all original translations * unbind all original translations
* @return bool * @return bool
*/ */
function unbindTranslation($model, $fields = null) { public function unbindTranslation($model, $fields = null) {
if (empty($fields) && empty($this->settings[$model->alias])) { if (empty($fields) && empty($this->settings[$model->alias])) {
return false; return false;
} }

View file

@ -632,7 +632,7 @@ class TreeBehavior extends ModelBehavior {
* @link http://book.cakephp.org/view/1355/reorder * @link http://book.cakephp.org/view/1355/reorder
* @link http://book.cakephp.org/view/1629/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); $options = array_merge(array('id' => null, 'field' => $Model->displayField, 'order' => 'ASC', 'verify' => true), $options);
extract($options); extract($options);
if ($verify && !$this->verify($Model)) { if ($verify && !$this->verify($Model)) {
@ -885,7 +885,7 @@ class TreeBehavior extends ModelBehavior {
* @return int * @return int
* @access private * @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); $db = ConnectionManager::getDataSource($Model->useDbConfig);
if ($created) { if ($created) {
if (is_string($scope)) { if (is_string($scope)) {
@ -913,7 +913,7 @@ class TreeBehavior extends ModelBehavior {
* @return int * @return int
* @access private * @access private
*/ */
function __getMin($Model, $scope, $left, $recursive = -1) { private function __getMin($Model, $scope, $left, $recursive = -1) {
$db = ConnectionManager::getDataSource($Model->useDbConfig); $db = ConnectionManager::getDataSource($Model->useDbConfig);
$name = $Model->alias . '.' . $left; $name = $Model->alias . '.' . $left;
list($edge) = array_values($Model->find('first', array( list($edge) = array_values($Model->find('first', array(
@ -936,7 +936,7 @@ class TreeBehavior extends ModelBehavior {
* @param string $field * @param string $field
* @access private * @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; $ModelRecursive = $Model->recursive;
extract($this->settings[$Model->alias]); extract($this->settings[$Model->alias]);
$Model->recursive = $recursive; $Model->recursive = $recursive;

View file

@ -59,7 +59,7 @@ class BehaviorCollection extends ObjectCollection {
* @access public * @access public
* @return void * @return void
*/ */
function init($modelName, $behaviors = array()) { public function init($modelName, $behaviors = array()) {
$this->modelName = $modelName; $this->modelName = $modelName;
if (!empty($behaviors)) { if (!empty($behaviors)) {

View file

@ -79,7 +79,7 @@ class CakeSchema extends Object {
* *
* @param array $options optional load object properties * @param array $options optional load object properties
*/ */
function __construct($options = array()) { public function __construct($options = array()) {
parent::__construct(); parent::__construct();
if (empty($options['name'])) { if (empty($options['name'])) {
@ -391,7 +391,7 @@ class CakeSchema extends Object {
* @param array $fields Array of field information to generate the table with. * @param array $fields Array of field information to generate the table with.
* @return string Variable declaration for a schema class * @return string Variable declaration for a schema class
*/ */
function generateTable($table, $fields) { public function generateTable($table, $fields) {
$out = "\tvar \${$table} = array(\n"; $out = "\tvar \${$table} = array(\n";
if (is_array($fields)) { if (is_array($fields)) {
$cols = array(); $cols = array();
@ -529,7 +529,7 @@ class CakeSchema extends Object {
* where match was not found. * where match was not found.
* @access protected * @access protected
*/ */
function _arrayDiffAssoc($array1, $array2) { public function _arrayDiffAssoc($array1, $array2) {
$difference = array(); $difference = array();
foreach ($array1 as $key => $value) { foreach ($array1 as $key => $value) {
if (!array_key_exists($key, $array2)) { if (!array_key_exists($key, $array2)) {
@ -626,7 +626,7 @@ class CakeSchema extends Object {
* @param array $old Old indexes * @param array $old Old indexes
* @return mixed False on failure, or an array of parameters to add & drop. * @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)) { if (!is_array($new) || !is_array($old)) {
return false; return false;
} }
@ -641,7 +641,7 @@ class CakeSchema extends Object {
* @param array $old Old indexes * @param array $old Old indexes
* @return mixed false on failure or array of indexes to add and drop * @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)) { if (!is_array($new) || !is_array($old)) {
return false; return false;
} }

View file

@ -87,7 +87,7 @@ class DataSource extends Object {
* @param array $config Array of configuration information for the datasource. * @param array $config Array of configuration information for the datasource.
* @return void. * @return void.
*/ */
function __construct($config = array()) { public function __construct($config = array()) {
parent::__construct(); parent::__construct();
$this->setConfig($config); $this->setConfig($config);
} }
@ -329,7 +329,7 @@ class DataSource extends Object {
* @access public * @access public
* @todo Remove and refactor $assocData, ensure uses of the method have the param removed too. * @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__$}'); $keys = array('{$__cakeID__$}', '{$__cakeForeignKey__$}');
foreach ($keys as $key) { foreach ($keys as $key) {

View file

@ -138,7 +138,7 @@ class Mysql extends DboSource {
* *
* @return boolean True if the database could be connected, else false * @return boolean True if the database could be connected, else false
*/ */
function connect() { public function connect() {
$config = $this->config; $config = $this->config;
$this->connected = false; $this->connected = false;
try { try {
@ -170,7 +170,7 @@ class Mysql extends DboSource {
* *
* @return boolean * @return boolean
*/ */
function enabled() { public function enabled() {
return in_array('mysql', PDO::getAvailableDrivers()); return in_array('mysql', PDO::getAvailableDrivers());
} }
@ -179,7 +179,7 @@ class Mysql extends DboSource {
* *
* @return array Array of tablenames in the database * @return array Array of tablenames in the database
*/ */
function listSources($data = null) { public function listSources($data = null) {
$cache = parent::listSources(); $cache = parent::listSources();
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
@ -207,7 +207,7 @@ class Mysql extends DboSource {
* *
* @param PDOStatement $results * @param PDOStatement $results
*/ */
function resultSet($results) { public function resultSet($results) {
$this->map = array(); $this->map = array();
$numFields = $results->columnCount(); $numFields = $results->columnCount();
$index = 0; $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 * @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()) { if ($row = $this->_result->fetch()) {
$resultRow = array(); $resultRow = array();
foreach ($this->map as $col => $meta) { 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 * @param mixed $tableName Name of database table to inspect or model instance
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
function describe($model) { public function describe($model) {
$cache = parent::describe($model); $cache = parent::describe($model);
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
@ -337,7 +337,7 @@ class Mysql extends DboSource {
* @param mixed $conditions * @param mixed $conditions
* @return array * @return array
*/ */
function update($model, $fields = array(), $values = null, $conditions = null) { public function update($model, $fields = array(), $values = null, $conditions = null) {
if (!$this->_useAlias) { if (!$this->_useAlias) {
return parent::update($model, $fields, $values, $conditions); return parent::update($model, $fields, $values, $conditions);
} }
@ -379,7 +379,7 @@ class Mysql extends DboSource {
* @param mixed $conditions * @param mixed $conditions
* @return boolean Success * @return boolean Success
*/ */
function delete($model, $conditions = null) { public function delete($model, $conditions = null) {
if (!$this->_useAlias) { if (!$this->_useAlias) {
return parent::delete($model, $conditions); return parent::delete($model, $conditions);
} }
@ -417,7 +417,7 @@ class Mysql extends DboSource {
* *
* @param string $enc Database encoding * @param string $enc Database encoding
*/ */
function setEncoding($enc) { public function setEncoding($enc) {
return $this->_execute('SET NAMES ' . $enc) !== false; return $this->_execute('SET NAMES ' . $enc) !== false;
} }
@ -427,7 +427,7 @@ class Mysql extends DboSource {
* @param string $model Name of model to inspect * @param string $model Name of model to inspect
* @return array Fields in table. Keys are column and unique * @return array Fields in table. Keys are column and unique
*/ */
function index($model) { public function index($model) {
$index = array(); $index = array();
$table = $this->fullTableName($model); $table = $this->fullTableName($model);
$old = version_compare($this->getVersion(), '4.1', '<='); $old = version_compare($this->getVersion(), '4.1', '<=');
@ -460,7 +460,7 @@ class Mysql extends DboSource {
* @param array $compare Result of a CakeSchema::compare() * @param array $compare Result of a CakeSchema::compare()
* @return array Array of alter statements to make. * @return array Array of alter statements to make.
*/ */
function alterSchema($compare, $table = null) { public function alterSchema($compare, $table = null) {
if (!is_array($compare)) { if (!is_array($compare)) {
return false; return false;
} }
@ -522,7 +522,7 @@ class Mysql extends DboSource {
* Otherwise, all tables defined in the schema are generated. * Otherwise, all tables defined in the schema are generated.
* @return string * @return string
*/ */
function dropSchema(CakeSchema $schema, $table = null) { public function dropSchema(CakeSchema $schema, $table = null) {
$out = ''; $out = '';
foreach ($schema->tables as $curTable => $columns) { foreach ($schema->tables as $curTable => $columns) {
if (!$table || $table === $curTable) { if (!$table || $table === $curTable) {
@ -540,7 +540,7 @@ class Mysql extends DboSource {
* @return array Array of table property alteration statementes. * @return array Array of table property alteration statementes.
* @todo Implement this method. * @todo Implement this method.
*/ */
function _alterTableParameters($table, $parameters) { protected function _alterTableParameters($table, $parameters) {
if (isset($parameters['change'])) { if (isset($parameters['change'])) {
return $this->buildTableParameters($parameters['change']); return $this->buildTableParameters($parameters['change']);
} }
@ -554,7 +554,7 @@ class Mysql extends DboSource {
* @param array $new Indexes to add and drop * @param array $new Indexes to add and drop
* @return array Index alteration statements * @return array Index alteration statements
*/ */
function _alterIndexes($table, $indexes) { protected function _alterIndexes($table, $indexes) {
$alter = array(); $alter = array();
if (isset($indexes['drop'])) { if (isset($indexes['drop'])) {
foreach($indexes['drop'] as $name => $value) { foreach($indexes['drop'] as $name => $value) {
@ -595,7 +595,7 @@ class Mysql extends DboSource {
* @param string $name Table name to get parameters * @param string $name Table name to get parameters
* @return array Array of tablenames in the database * @return array Array of tablenames in the database
*/ */
function listDetailedSources($name = null) { public function listDetailedSources($name = null) {
$condition = ''; $condition = '';
$params = array(); $params = array();
if (is_string($name)) { if (is_string($name)) {
@ -633,7 +633,7 @@ class Mysql extends DboSource {
* @param string $real Real database-layer column type (i.e. "varchar(255)") * @param string $real Real database-layer column type (i.e. "varchar(255)")
* @return string Abstract column type (i.e. "string") * @return string Abstract column type (i.e. "string")
*/ */
function column($real) { public function column($real) {
if (is_array($real)) { if (is_array($real)) {
$col = $real['name']; $col = $real['name'];
if (isset($real['limit'])) { if (isset($real['limit'])) {

View file

@ -197,7 +197,7 @@ class DboOracle extends DboSource {
* Keeps track of the most recent Oracle error * Keeps track of the most recent Oracle error
* *
*/ */
function _setError($source = null, $clear = false) { protected function _setError($source = null, $clear = false) {
if ($source) { if ($source) {
$e = ocierror($source); $e = ocierror($source);
} else { } else {
@ -215,7 +215,7 @@ class DboOracle extends DboSource {
* @param string $lang language constant * @param string $lang language constant
* @return bool * @return bool
*/ */
function setEncoding($lang) { public function setEncoding($lang) {
if (!$this->execute('ALTER SESSION SET NLS_LANGUAGE='.$lang)) { if (!$this->execute('ALTER SESSION SET NLS_LANGUAGE='.$lang)) {
return false; return false;
} }
@ -227,7 +227,7 @@ class DboOracle extends DboSource {
* *
* @return string language constant * @return string language constant
*/ */
function getEncoding() { public function getEncoding() {
$sql = 'SELECT VALUE FROM NLS_SESSION_PARAMETERS WHERE PARAMETER=\'NLS_LANGUAGE\''; $sql = 'SELECT VALUE FROM NLS_SESSION_PARAMETERS WHERE PARAMETER=\'NLS_LANGUAGE\'';
if (!$this->execute($sql)) { if (!$this->execute($sql)) {
return false; return false;
@ -404,7 +404,7 @@ class DboOracle extends DboSource {
* *
* @return unknown * @return unknown
*/ */
function fetchResult() { public function fetchResult() {
return $this->fetchRow(); return $this->fetchRow();
} }
@ -522,7 +522,7 @@ class DboOracle extends DboSource {
* @access public * @access public
* *
*/ */
function truncate($table, $reset = 0) { public function truncate($table, $reset = 0) {
if (empty($this->_sequences)) { if (empty($this->_sequences)) {
$sql = "SELECT sequence_name FROM all_sequences"; $sql = "SELECT sequence_name FROM all_sequences";
@ -569,7 +569,7 @@ class DboOracle extends DboSource {
* @param string $table * @param string $table
* @return mixed boolean true or array of constraints * @return mixed boolean true or array of constraints
*/ */
function constraint($action, $table) { public function constraint($action, $table) {
if (empty($table)) { if (empty($table)) {
trigger_error(__d('cake_dev', 'Must specify table to operate on constraints')); 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 * @param string $model Name of model to inspect
* @return array Fields in table. Keys are column and unique * @return array Fields in table. Keys are column and unique
*/ */
function index($model) { public function index($model) {
$index = array(); $index = array();
$table = $this->fullTableName($model, false); $table = $this->fullTableName($model, false);
if ($table) { if ($table) {
@ -683,7 +683,7 @@ class DboOracle extends DboSource {
* @param unknown_type $schema * @param unknown_type $schema
* @return unknown * @return unknown
*/ */
function alterSchema($compare, $table = null) { public function alterSchema($compare, $table = null) {
if (!is_array($compare)) { if (!is_array($compare)) {
return false; return false;
} }
@ -754,7 +754,7 @@ class DboOracle extends DboSource {
* @return boolean True on success, false on fail * @return boolean True on success, false on fail
* (i.e. if the database/model does not support transactions). * (i.e. if the database/model does not support transactions).
*/ */
function begin() { public function begin() {
$this->__transactionStarted = true; $this->__transactionStarted = true;
return true; return true;
} }
@ -767,7 +767,7 @@ class DboOracle extends DboSource {
* (i.e. if the database/model does not support transactions, * (i.e. if the database/model does not support transactions,
* or a transaction has not started). * or a transaction has not started).
*/ */
function rollback() { public function rollback() {
return ocirollback($this->connection); return ocirollback($this->connection);
} }
@ -779,7 +779,7 @@ class DboOracle extends DboSource {
* (i.e. if the database/model does not support transactions, * (i.e. if the database/model does not support transactions,
* or a transaction has not started). * or a transaction has not started).
*/ */
function commit() { public function commit() {
$this->__transactionStarted = false; $this->__transactionStarted = false;
return ocicommit($this->connection); return ocicommit($this->connection);
} }
@ -919,7 +919,7 @@ class DboOracle extends DboSource {
* @param array $data * @param array $data
* @return string * @return string
*/ */
function renderStatement($type, $data) { public function renderStatement($type, $data) {
extract($data); extract($data);
$aliases = null; $aliases = null;
@ -972,7 +972,7 @@ class DboOracle extends DboSource {
* @param integer $recursive Number of levels of association * @param integer $recursive Number of levels of association
* @param array $stack * @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 ($query = $this->generateAssociationQuery($model, $linkModel, $type, $association, $assocData, $queryData, $external, $resultSet)) {
if (!isset($resultSet) || !is_array($resultSet)) { if (!isset($resultSet) || !is_array($resultSet)) {
if (Configure::read('debug') > 0) { if (Configure::read('debug') > 0) {
@ -1124,7 +1124,7 @@ class DboOracle extends DboSource {
* Otherwise, all tables defined in the schema are generated. * Otherwise, all tables defined in the schema are generated.
* @return string * @return string
*/ */
function dropSchema(CakeSchema $schema, $table = null) { public function dropSchema(CakeSchema $schema, $table = null) {
$out = ''; $out = '';
foreach ($schema->tables as $curTable => $columns) { foreach ($schema->tables as $curTable => $columns) {

View file

@ -110,7 +110,7 @@ class Postgres extends DboSource {
* *
* @return True if successfully connected. * @return True if successfully connected.
*/ */
function connect() { public function connect() {
$config = $this->config; $config = $this->config;
$this->connected = false; $this->connected = false;
try { try {
@ -143,7 +143,7 @@ class Postgres extends DboSource {
* *
* @return boolean * @return boolean
*/ */
function enabled() { public function enabled() {
return in_array('pgsql', PDO::getAvailableDrivers()); return in_array('pgsql', PDO::getAvailableDrivers());
} }
@ -152,7 +152,7 @@ class Postgres extends DboSource {
* *
* @return array Array of tablenames in the database * @return array Array of tablenames in the database
*/ */
function listSources($data = null) { public function listSources($data = null) {
$cache = parent::listSources(); $cache = parent::listSources();
if ($cache != null) { if ($cache != null) {
@ -184,7 +184,7 @@ class Postgres extends DboSource {
* @param string $tableName Name of database table to inspect * @param string $tableName Name of database table to inspect
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
*/ */
function describe($model) { public function describe($model) {
$fields = parent::describe($model); $fields = parent::describe($model);
$table = $this->fullTableName($model, false); $table = $this->fullTableName($model, false);
$this->_sequenceMap[$table] = array(); $this->_sequenceMap[$table] = array();
@ -265,7 +265,7 @@ class Postgres extends DboSource {
* @param string $field Name of the ID database field. Defaults to "id" * @param string $field Name of the ID database field. Defaults to "id"
* @return integer * @return integer
*/ */
function lastInsertId($source, $field = 'id') { public function lastInsertId($source, $field = 'id') {
$seq = $this->getSequence($source, $field); $seq = $this->getSequence($source, $field);
return $this->_connection->lastInsertId($seq); 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" * @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" * @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)) { if (is_object($table)) {
$table = $this->fullTableName($table, false); $table = $this->fullTableName($table, false);
} }
@ -321,7 +321,7 @@ class Postgres extends DboSource {
* @param string $data * @param string $data
* @return string SQL field * @return string SQL field
*/ */
function name($data) { public function name($data) {
if (is_string($data)) { if (is_string($data)) {
$data = str_replace('"__"', '__', $data); $data = str_replace('"__"', '__', $data);
} }
@ -336,7 +336,7 @@ class Postgres extends DboSource {
* @param mixed $fields * @param mixed $fields
* @return array * @return array
*/ */
function fields($model, $alias = null, $fields = array(), $quote = true) { public function fields($model, $alias = null, $fields = array(), $quote = true) {
if (empty($alias)) { if (empty($alias)) {
$alias = $model->alias; $alias = $model->alias;
} }
@ -393,7 +393,7 @@ class Postgres extends DboSource {
* @return string quoted strig * @return string quoted strig
* @access private * @access private
*/ */
function __quoteFunctionField($match) { private function __quoteFunctionField($match) {
$prepend = ''; $prepend = '';
if (strpos($match[1], 'DISTINCT') !== false) { if (strpos($match[1], 'DISTINCT') !== false) {
$prepend = 'DISTINCT '; $prepend = 'DISTINCT ';
@ -416,7 +416,7 @@ class Postgres extends DboSource {
* @param string $model Name of model to inspect * @param string $model Name of model to inspect
* @return array Fields in table. Keys are column and unique * @return array Fields in table. Keys are column and unique
*/ */
function index($model) { public function index($model) {
$index = array(); $index = array();
$table = $this->fullTableName($model, false); $table = $this->fullTableName($model, false);
if ($table) { if ($table) {
@ -457,7 +457,7 @@ class Postgres extends DboSource {
* @access public * @access public
* @return array * @return array
*/ */
function alterSchema($compare, $table = null) { public function alterSchema($compare, $table = null) {
if (!is_array($compare)) { if (!is_array($compare)) {
return false; return false;
} }
@ -545,7 +545,7 @@ class Postgres extends DboSource {
* @param array $new Indexes to add and drop * @param array $new Indexes to add and drop
* @return array Index alteration statements * @return array Index alteration statements
*/ */
function _alterIndexes($table, $indexes) { protected function _alterIndexes($table, $indexes) {
$alter = array(); $alter = array();
if (isset($indexes['drop'])) { if (isset($indexes['drop'])) {
foreach($indexes['drop'] as $name => $value) { foreach($indexes['drop'] as $name => $value) {
@ -587,7 +587,7 @@ class Postgres extends DboSource {
* @param integer $offset Offset from which to start results * @param integer $offset Offset from which to start results
* @return string SQL limit/offset statement * @return string SQL limit/offset statement
*/ */
function limit($limit, $offset = null) { public function limit($limit, $offset = null) {
if ($limit) { if ($limit) {
$rt = ''; $rt = '';
if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0) { 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)") * @param string $real Real database-layer column type (i.e. "varchar(255)")
* @return string Abstract column type (i.e. "string") * @return string Abstract column type (i.e. "string")
*/ */
function column($real) { public function column($real) {
if (is_array($real)) { if (is_array($real)) {
$col = $real['name']; $col = $real['name'];
if (isset($real['limit'])) { if (isset($real['limit'])) {
@ -659,7 +659,7 @@ class Postgres extends DboSource {
* @param string $real Real database-layer column type (i.e. "varchar(255)") * @param string $real Real database-layer column type (i.e. "varchar(255)")
* @return int An integer representing the length of the column * @return int An integer representing the length of the column
*/ */
function length($real) { public function length($real) {
$col = str_replace(array(')', 'unsigned'), '', $real); $col = str_replace(array(')', 'unsigned'), '', $real);
$limit = null; $limit = null;
@ -680,7 +680,7 @@ class Postgres extends DboSource {
* *
* @param unknown_type $results * @param unknown_type $results
*/ */
function resultSet(&$results) { public function resultSet(&$results) {
$this->map = array(); $this->map = array();
$numFields = $results->columnCount(); $numFields = $results->columnCount();
$index = 0; $index = 0;
@ -703,7 +703,7 @@ class Postgres extends DboSource {
* *
* @return unknown * @return unknown
*/ */
function fetchResult() { public function fetchResult() {
if ($row = $this->_result->fetch()) { if ($row = $this->_result->fetch()) {
$resultRow = array(); $resultRow = array();
@ -737,7 +737,7 @@ class Postgres extends DboSource {
* @param boolean $quote true to quote a boolean to be used in a query, flase to return the boolean value * @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 * @return boolean Converted boolean value
*/ */
function boolean($data, $quote = false) { public function boolean($data, $quote = false) {
switch (true) { switch (true) {
case ($data === true || $data === false): case ($data === true || $data === false):
$result = $data; $result = $data;
@ -768,7 +768,7 @@ class Postgres extends DboSource {
* @param mixed $enc Database encoding * @param mixed $enc Database encoding
* @return boolean True on success, false on failure * @return boolean True on success, false on failure
*/ */
function setEncoding($enc) { public function setEncoding($enc) {
if ($this->_execute('SET NAMES ?', array($enc))) { if ($this->_execute('SET NAMES ?', array($enc))) {
return true; return true;
} }
@ -780,7 +780,7 @@ class Postgres extends DboSource {
* *
* @return string The database encoding * @return string The database encoding
*/ */
function getEncoding() { public function getEncoding() {
$cosa = $this->_execute('SHOW client_encoding')->fetch(); $cosa = $this->_execute('SHOW client_encoding')->fetch();
} }
@ -792,7 +792,7 @@ class Postgres extends DboSource {
* where options can be 'default', 'length', or 'key'. * where options can be 'default', 'length', or 'key'.
* @return string * @return string
*/ */
function buildColumn($column) { public function buildColumn($column) {
$col = $this->columns[$column['type']]; $col = $this->columns[$column['type']];
if (!isset($col['length']) && !isset($col['limit'])) { if (!isset($col['length']) && !isset($col['limit'])) {
unset($column['length']); unset($column['length']);
@ -825,7 +825,7 @@ class Postgres extends DboSource {
* @param string $table * @param string $table
* @return string * @return string
*/ */
function buildIndex($indexes, $table = null) { public function buildIndex($indexes, $table = null) {
$join = array(); $join = array();
if (!is_array($indexes)) { if (!is_array($indexes)) {
return array(); return array();
@ -857,7 +857,7 @@ class Postgres extends DboSource {
* @param array $data * @param array $data
* @return string * @return string
*/ */
function renderStatement($type, $data) { public function renderStatement($type, $data) {
switch (strtolower($type)) { switch (strtolower($type)) {
case 'schema': case 'schema':
extract($data); extract($data);

View file

@ -109,7 +109,7 @@ class Sqlite extends DboSource {
* @return mixed * @return mixed
* @access public * @access public
*/ */
function connect() { public function connect() {
$config = $this->config; $config = $this->config;
$flags = array(PDO::ATTR_PERSISTENT => $config['persistent']); $flags = array(PDO::ATTR_PERSISTENT => $config['persistent']);
try { try {
@ -127,7 +127,7 @@ class Sqlite extends DboSource {
* *
* @return boolean * @return boolean
*/ */
function enabled() { public function enabled() {
return in_array('sqlite', PDO::getAvailableDrivers()); return in_array('sqlite', PDO::getAvailableDrivers());
} }
@ -137,7 +137,7 @@ class Sqlite extends DboSource {
* @return array Array of tablenames in the database * @return array Array of tablenames in the database
* @access public * @access public
*/ */
function listSources($data = null) { public function listSources($data = null) {
$cache = parent::listSources(); $cache = parent::listSources();
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
@ -165,7 +165,7 @@ class Sqlite extends DboSource {
* @return array Fields in table. Keys are name and type * @return array Fields in table. Keys are name and type
* @access public * @access public
*/ */
function describe($model) { public function describe($model) {
$cache = parent::describe($model); $cache = parent::describe($model);
if ($cache != null) { if ($cache != null) {
return $cache; return $cache;
@ -207,7 +207,7 @@ class Sqlite extends DboSource {
* @return array * @return array
* @access public * @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)) { if (empty($values) && !empty($fields)) {
foreach ($fields as $field => $value) { foreach ($fields as $field => $value) {
if (strpos($field, $model->alias . '.') !== false) { if (strpos($field, $model->alias . '.') !== false) {
@ -229,7 +229,7 @@ class Sqlite extends DboSource {
* @return boolean SQL TRUNCATE TABLE statement, false if not applicable. * @return boolean SQL TRUNCATE TABLE statement, false if not applicable.
* @access public * @access public
*/ */
function truncate($table) { public function truncate($table) {
$this->_execute('DELETE FROM sqlite_sequence where name=' . $this->fullTableName($table)); $this->_execute('DELETE FROM sqlite_sequence where name=' . $this->fullTableName($table));
return $this->execute('DELETE FROM ' . $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") * @return string Abstract column type (i.e. "string")
* @access public * @access public
*/ */
function column($real) { public function column($real) {
if (is_array($real)) { if (is_array($real)) {
$col = $real['name']; $col = $real['name'];
if (isset($real['limit'])) { if (isset($real['limit'])) {
@ -275,7 +275,7 @@ class Sqlite extends DboSource {
* @param mixed $results * @param mixed $results
* @access public * @access public
*/ */
function resultSet($results) { public function resultSet($results) {
$this->results = $results; $this->results = $results;
$this->map = array(); $this->map = array();
$num_fields = $results->columnCount(); $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 * @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()) { if ($row = $this->_result->fetch()) {
$resultRow = array(); $resultRow = array();
foreach ($this->map as $col => $meta) { foreach ($this->map as $col => $meta) {
@ -358,7 +358,7 @@ class Sqlite extends DboSource {
* @return string SQL limit/offset statement * @return string SQL limit/offset statement
* @access public * @access public
*/ */
function limit($limit, $offset = null) { public function limit($limit, $offset = null) {
if ($limit) { if ($limit) {
$rt = ''; $rt = '';
if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0) { if (!strpos(strtolower($limit), 'limit') || strpos(strtolower($limit), 'limit') === 0) {
@ -381,7 +381,7 @@ class Sqlite extends DboSource {
* @return string * @return string
* @access public * @access public
*/ */
function buildColumn($column) { public function buildColumn($column) {
$name = $type = null; $name = $type = null;
$column = array_merge(array('null' => true), $column); $column = array_merge(array('null' => true), $column);
extract($column); extract($column);
@ -410,7 +410,7 @@ class Sqlite extends DboSource {
* @param string $enc Database encoding * @param string $enc Database encoding
* @access public * @access public
*/ */
function setEncoding($enc) { public function setEncoding($enc) {
if (!in_array($enc, array("UTF-8", "UTF-16", "UTF-16le", "UTF-16be"))) { if (!in_array($enc, array("UTF-8", "UTF-16", "UTF-16le", "UTF-16be"))) {
return false; return false;
} }
@ -423,7 +423,7 @@ class Sqlite extends DboSource {
* @return string The database encoding * @return string The database encoding
* @access public * @access public
*/ */
function getEncoding() { public function getEncoding() {
return $this->fetchRow('PRAGMA encoding'); return $this->fetchRow('PRAGMA encoding');
} }
@ -435,7 +435,7 @@ class Sqlite extends DboSource {
* @return string * @return string
* @access public * @access public
*/ */
function buildIndex($indexes, $table = null) { public function buildIndex($indexes, $table = null) {
$join = array(); $join = array();
foreach ($indexes as $name => $value) { foreach ($indexes as $name => $value) {
@ -468,7 +468,7 @@ class Sqlite extends DboSource {
* @return array Fields in table. Keys are column and unique * @return array Fields in table. Keys are column and unique
* @access public * @access public
*/ */
function index($model) { public function index($model) {
$index = array(); $index = array();
$table = $this->fullTableName($model); $table = $this->fullTableName($model);
if ($table) { if ($table) {
@ -509,7 +509,7 @@ class Sqlite extends DboSource {
* @return string * @return string
* @access public * @access public
*/ */
function renderStatement($type, $data) { public function renderStatement($type, $data) {
switch (strtolower($type)) { switch (strtolower($type)) {
case 'schema': case 'schema':
extract($data); extract($data);
@ -533,7 +533,7 @@ class Sqlite extends DboSource {
* @return boolean * @return boolean
* @access public * @access public
*/ */
function hasResult() { public function hasResult() {
return is_object($this->_result); return is_object($this->_result);
} }

View file

@ -280,7 +280,7 @@ class DboSource extends DataSource {
* @param array $config An array defining the new configuration settings * @param array $config An array defining the new configuration settings
* @return boolean True on success, false on failure * @return boolean True on success, false on failure
*/ */
function reconnect($config = array()) { public function reconnect($config = array()) {
$this->disconnect(); $this->disconnect();
$this->setConfig($config); $this->setConfig($config);
$this->_sources = null; $this->_sources = null;
@ -293,7 +293,7 @@ class DboSource extends DataSource {
* *
* @return boolean True if the database could be disconnected, else false * @return boolean True if the database could be disconnected, else false
*/ */
function disconnect() { public function disconnect() {
if ($this->_result instanceof PDOStatement) { if ($this->_result instanceof PDOStatement) {
$this->_result->closeCursor(); $this->_result->closeCursor();
} }
@ -318,7 +318,7 @@ class DboSource extends DataSource {
* @param string $column The column into which this data will be inserted * @param string $column The column into which this data will be inserted
* @return string Quoted and escaped data * @return string Quoted and escaped data
*/ */
function value($data, $column = null) { public function value($data, $column = null) {
if (is_array($data) && !empty($data)) { if (is_array($data) && !empty($data)) {
return array_map( return array_map(
array(&$this, 'value'), array(&$this, 'value'),
@ -491,7 +491,7 @@ class DboSource extends DataSource {
* @param PDOStatement $query the query to extract the error from if any * @param PDOStatement $query the query to extract the error from if any
* @return string Error message with error number * @return string Error message with error number
*/ */
function lastError(PDOStatement $query = null) { public function lastError(PDOStatement $query = null) {
$error = $query->errorInfo(); $error = $query->errorInfo();
if (empty($error[2])) { if (empty($error[2])) {
return null; return null;
@ -505,7 +505,7 @@ class DboSource extends DataSource {
* *
* @return integer Number of affected rows * @return integer Number of affected rows
*/ */
function lastAffected() { public function lastAffected() {
if ($this->hasResult()) { if ($this->hasResult()) {
return $this->_result->rowCount(); return $this->_result->rowCount();
} }
@ -518,7 +518,7 @@ class DboSource extends DataSource {
* *
* @return integer Number of rows in resultset * @return integer Number of rows in resultset
*/ */
function lastNumRows() { public function lastNumRows() {
return $this->lastAffected(); return $this->lastAffected();
} }
@ -1333,7 +1333,7 @@ class DboSource extends DataSource {
* @param object $linkModel Model being merged * @param object $linkModel Model being merged
* @return void * @return void
*/ */
function __mergeHasMany(&$resultSet, $merge, $association, $model, $linkModel) { private function __mergeHasMany(&$resultSet, $merge, $association, $model, $linkModel) {
$modelAlias = $model->alias; $modelAlias = $model->alias;
$modelPK = $model->primaryKey; $modelPK = $model->primaryKey;
$modelFK = $model->hasMany[$association]['foreignKey']; $modelFK = $model->hasMany[$association]['foreignKey'];
@ -2073,7 +2073,7 @@ class DboSource extends DataSource {
* @param unknown_type $source * @param unknown_type $source
* @return in * @return in
*/ */
function lastInsertId($source = null) { public function lastInsertId($source = null) {
return $this->_connection->lastInsertId(); return $this->_connection->lastInsertId();
} }
@ -2133,7 +2133,7 @@ class DboSource extends DataSource {
* @param array $data * @param array $data
* @return array * @return array
*/ */
public function __scrubQueryData($data) { function __scrubQueryData($data) {
static $base = null; static $base = null;
if ($base === null) { if ($base === null) {
$base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array()); $base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array());
@ -2453,7 +2453,7 @@ class DboSource extends DataSource {
* @return string * @return string
* @access private * @access private
*/ */
function __parseKey($model, $key, $value) { private function __parseKey($model, $key, $value) {
$operatorMatch = '/^((' . implode(')|(', $this->__sqlOps); $operatorMatch = '/^((' . implode(')|(', $this->__sqlOps);
$operatorMatch .= '\\x20)|<[>=]?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)/is'; $operatorMatch .= '\\x20)|<[>=]?(?![^>]+>)\\x20?|[>=!]{1,3}(?!<)\\x20?)/is';
$bound = (strpos($key, '?') !== false || (is_array($value) && strpos($key, ':') !== false)); $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 * @return string or false if no match
* @access private * @access private
*/ */
function __quoteFields($conditions) { private function __quoteFields($conditions) {
$start = $end = null; $start = $end = null;
$original = $conditions; $original = $conditions;
@ -2566,7 +2566,7 @@ class DboSource extends DataSource {
* @return string quoted strig * @return string quoted strig
* @access private * @access private
*/ */
function __quoteMatchedField($match) { private function __quoteMatchedField($match) {
if (is_numeric($match[0])) { if (is_numeric($match[0])) {
return $match[0]; return $match[0];
} }
@ -2881,7 +2881,7 @@ class DboSource extends DataSource {
* @param unknown_type $schema * @param unknown_type $schema
* @return boolean * @return boolean
*/ */
function alterSchema($compare, $table = null) { public function alterSchema($compare, $table = null) {
return false; return false;
} }
@ -2975,7 +2975,7 @@ class DboSource extends DataSource {
* @param string $position The position type to use. 'beforeDefault' or 'afterDefault' are common * @param string $position The position type to use. 'beforeDefault' or 'afterDefault' are common
* @return string a built column with the field parameters added. * @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) { foreach ($this->fieldParameters as $paramName => $value) {
if (isset($columnData[$paramName]) && $value['position'] == $position) { if (isset($columnData[$paramName]) && $value['position'] == $position) {
if (isset($value['options']) && !in_array($columnData[$paramName], $value['options'])) { if (isset($value['options']) && !in_array($columnData[$paramName], $value['options'])) {

View file

@ -29,7 +29,7 @@ class DatabaseSession implements CakeSessionHandlerInterface {
* *
* @return void * @return void
*/ */
function __construct() { public function __construct() {
$modelName = Configure::read('Session.handler.model'); $modelName = Configure::read('Session.handler.model');
$database = Configure::read('Session.handler.database'); $database = Configure::read('Session.handler.database');
$table = Configure::read('Session.handler.table'); $table = Configure::read('Session.handler.table');

View file

@ -412,7 +412,7 @@ class Model extends Object {
* @param string $table Name of database table to use. * @param string $table Name of database table to use.
* @param string $ds DataSource connection name. * @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(); parent::__construct();
if (is_array($id)) { if (is_array($id)) {
@ -569,7 +569,7 @@ class Model extends Object {
* @param string $name variable requested for it's value or reference * @param string $name variable requested for it's value or reference
* @return mixed value of requested variable if it is set * @return mixed value of requested variable if it is set
*/ */
function __get($name) { public function __get($name) {
if ($name === 'displayField') { if ($name === 'displayField') {
return $this->displayField = $this->hasField(array('title', 'name', $this->primaryKey)); return $this->displayField = $this->hasField(array('title', 'name', $this->primaryKey));
} }
@ -598,7 +598,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1045/Creating-and-Destroying-Associations-on-the-Fly * @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) { foreach ($params as $assoc => $model) {
if ($reset === true && !isset($this->__backAssociation[$assoc])) { if ($reset === true && !isset($this->__backAssociation[$assoc])) {
$this->__backAssociation[$assoc] = $this->{$assoc}; $this->__backAssociation[$assoc] = $this->{$assoc};
@ -643,7 +643,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1045/Creating-and-Destroying-Associations-on-the-Fly * @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) { foreach ($params as $assoc => $models) {
if ($reset === true && !isset($this->__backAssociation[$assoc])) { if ($reset === true && !isset($this->__backAssociation[$assoc])) {
$this->__backAssociation[$assoc] = $this->{$assoc}; $this->__backAssociation[$assoc] = $this->{$assoc};
@ -664,7 +664,7 @@ class Model extends Object {
* @return void * @return void
* @access private * @access private
*/ */
function __createLinks() { private function __createLinks() {
foreach ($this->__associations as $type) { foreach ($this->__associations as $type) {
if (!is_array($this->{$type})) { if (!is_array($this->{$type})) {
$this->{$type} = explode(',', $this->{$type}); $this->{$type} = explode(',', $this->{$type});
@ -711,7 +711,7 @@ class Model extends Object {
* @return void * @return void
* @access private * @access private
*/ */
function __constructLinkedModel($assoc, $className = null, $plugin = null) { private function __constructLinkedModel($assoc, $className = null, $plugin = null) {
if (empty($className)) { if (empty($className)) {
$className = $assoc; $className = $assoc;
} }
@ -736,7 +736,7 @@ class Model extends Object {
* @return void * @return void
* @access private * @access private
*/ */
function __generateAssociation($type, $assocKey) { private function __generateAssociation($type, $assocKey) {
$class = $assocKey; $class = $assocKey;
$dynamicWith = false; $dynamicWith = false;
@ -829,7 +829,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1031/Saving-Your-Data * @link http://book.cakephp.org/view/1031/Saving-Your-Data
*/ */
function set($one, $two = null) { public function set($one, $two = null) {
if (!$one) { if (!$one) {
return; return;
} }
@ -1146,7 +1146,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1031/Saving-Your-Data * @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(); $defaults = array();
$this->id = false; $this->id = false;
$this->data = array(); $this->data = array();
@ -1177,7 +1177,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1017/Retrieving-Your-Data#read-1029 * @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(); $this->validationErrors = array();
if ($id != null) { if ($id != null) {
@ -1212,7 +1212,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1017/Retrieving-Your-Data#field-1028 * @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) { if ($conditions === null && $this->id !== false) {
$conditions = array($this->alias . '.' . $this->primaryKey => $this->id); $conditions = array($this->alias . '.' . $this->primaryKey => $this->id);
} }
@ -1253,7 +1253,7 @@ class Model extends Object {
* @see Model::save() * @see Model::save()
* @link http://book.cakephp.org/view/1031/Saving-Your-Data * @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; $id = $this->id;
$this->create(false); $this->create(false);
@ -1278,7 +1278,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1031/Saving-Your-Data * @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); $defaults = array('validate' => true, 'fieldList' => array(), 'callbacks' => true);
$_whitelist = $this->whitelist; $_whitelist = $this->whitelist;
$fields = array(); $fields = array();
@ -1449,7 +1449,7 @@ class Model extends Object {
* @param mixed $id ID of record in this model * @param mixed $id ID of record in this model
* @access private * @access private
*/ */
function __saveMulti($joined, $id, $db) { private function __saveMulti($joined, $id, $db) {
foreach ($joined as $assoc => $data) { foreach ($joined as $assoc => $data) {
if (isset($this->hasAndBelongsToMany[$assoc])) { 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/1032/Saving-Related-Model-Data-hasOne-hasMany-belongsTo
* @link http://book.cakephp.org/view/1031/Saving-Your-Data * @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)) { if (empty($data)) {
$data = $this->data; $data = $this->data;
} }
@ -1833,7 +1833,7 @@ class Model extends Object {
* @access private * @access private
* @see Model::saveAll() * @see Model::saveAll()
*/ */
function __save($data, $options) { private function __save($data, $options) {
if ($options['validate'] === 'first' || $options['validate'] === 'only') { if ($options['validate'] === 'first' || $options['validate'] === 'only') {
if (!($this->create($data) && $this->validates($options))) { if (!($this->create($data) && $this->validates($options))) {
return false; return false;
@ -1854,7 +1854,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1031/Saving-Your-Data * @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); return $this->getDataSource()->update($this, $fields, null, $conditions);
} }
@ -1867,7 +1867,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1036/delete * @link http://book.cakephp.org/view/1036/delete
*/ */
function delete($id = null, $cascade = true) { public function delete($id = null, $cascade = true) {
if (!empty($id)) { if (!empty($id)) {
$this->id = $id; $this->id = $id;
} }
@ -1983,7 +1983,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1038/deleteAll * @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)) { if (empty($conditions)) {
return false; return false;
} }
@ -2031,7 +2031,7 @@ class Model extends Object {
* @return array * @return array
* @access private * @access private
*/ */
function __collectForeignKeys($type = 'belongsTo') { private function __collectForeignKeys($type = 'belongsTo') {
$result = array(); $result = array();
foreach ($this->{$type} as $assoc => $data) { foreach ($this->{$type} as $assoc => $data) {
@ -2499,7 +2499,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1027/query * @link http://book.cakephp.org/view/1027/query
*/ */
function query() { public function query() {
$params = func_get_args(); $params = func_get_args();
$db = $this->getDataSource(); $db = $this->getDataSource();
return call_user_func_array(array(&$db, 'query'), $params); return call_user_func_array(array(&$db, 'query'), $params);
@ -2516,7 +2516,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller * @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); $errors = $this->invalidFields($options);
if (empty($errors) && $errors !== false) { if (empty($errors) && $errors !== false) {
$errors = $this->__validateWithModels($options); $errors = $this->__validateWithModels($options);
@ -2536,7 +2536,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller * @link http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller
*/ */
function invalidFields($options = array()) { public function invalidFields($options = array()) {
if ( if (
!$this->Behaviors->trigger( !$this->Behaviors->trigger(
'beforeValidate', 'beforeValidate',
@ -2688,7 +2688,7 @@ class Model extends Object {
* @access private * @access private
* @see Model::validates() * @see Model::validates()
*/ */
function __validateWithModels($options) { private function __validateWithModels($options) {
$valid = true; $valid = true;
foreach ($this->hasAndBelongsToMany as $assoc => $association) { foreach ($this->hasAndBelongsToMany as $assoc => $association) {
if (empty($association['with']) || !isset($this->data[$assoc])) { if (empty($association['with']) || !isset($this->data[$assoc])) {
@ -2972,7 +2972,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1048/Callback-Methods#beforeFind-1049 * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeFind-1049
*/ */
function beforeFind($queryData) { public function beforeFind($queryData) {
return true; return true;
} }
@ -2986,7 +2986,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1048/Callback-Methods#afterFind-1050 * @link http://book.cakephp.org/view/1048/Callback-Methods#afterFind-1050
*/ */
function afterFind($results, $primary = false) { public function afterFind($results, $primary = false) {
return $results; return $results;
} }
@ -2998,7 +2998,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1048/Callback-Methods#beforeSave-1052 * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeSave-1052
*/ */
function beforeSave($options = array()) { public function beforeSave($options = array()) {
return true; return true;
} }
@ -3009,7 +3009,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1048/Callback-Methods#afterSave-1053 * @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 * @access public
* @link http://book.cakephp.org/view/1048/Callback-Methods#beforeDelete-1054 * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeDelete-1054
*/ */
function beforeDelete($cascade = true) { public function beforeDelete($cascade = true) {
return true; return true;
} }
@ -3030,7 +3030,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1048/Callback-Methods#afterDelete-1055 * @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 * @access public
* @link http://book.cakephp.org/view/1048/Callback-Methods#beforeValidate-1051 * @link http://book.cakephp.org/view/1048/Callback-Methods#beforeValidate-1051
*/ */
function beforeValidate($options = array()) { public function beforeValidate($options = array()) {
return true; return true;
} }
@ -3052,7 +3052,7 @@ class Model extends Object {
* @access public * @access public
* @link http://book.cakephp.org/view/1048/Callback-Methods#onError-1056 * @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 * @access protected
* @todo * @todo
*/ */
function _clearCache($type = null) { protected function _clearCache($type = null) {
if ($type === null) { if ($type === null) {
if (Configure::read('Cache.check') === true) { if (Configure::read('Cache.check') === true) {
$assoc[] = strtolower(Inflector::pluralize($this->alias)); $assoc[] = strtolower(Inflector::pluralize($this->alias));
@ -3092,7 +3092,7 @@ class Model extends Object {
* @return array Set of object variable names this model has * @return array Set of object variable names this model has
* @access private * @access private
*/ */
function __sleep() { private function __sleep() {
$return = array_keys(get_object_vars($this)); $return = array_keys(get_object_vars($this));
return $return; return $return;
} }
@ -3103,7 +3103,6 @@ class Model extends Object {
* @access private * @access private
* @todo * @todo
*/ */
function __wakeup() { private function __wakeup() {
} }
} }

View file

@ -100,7 +100,7 @@ class ModelBehavior extends Object {
* @param object $model Model using this behavior * @param object $model Model using this behavior
* @see BehaviorCollection::detach() * @see BehaviorCollection::detach()
*/ */
function cleanup($model) { public function cleanup($model) {
if (isset($this->settings[$model->alias])) { if (isset($this->settings[$model->alias])) {
unset($this->settings[$model->alias]); unset($this->settings[$model->alias]);
} }
@ -202,7 +202,7 @@ class ModelBehavior extends Object {
* @param string $field Field to be added to $model's whitelist * @param string $field Field to be added to $model's whitelist
* @return void * @return void
*/ */
function _addToWhitelist($model, $field) { protected function _addToWhitelist($model, $field) {
if (is_array($field)) { if (is_array($field)) {
foreach ($field as $f) { foreach ($field as $f) {
$this->_addToWhitelist($model, $f); $this->_addToWhitelist($model, $f);

View file

@ -74,7 +74,7 @@ class Permission extends AppModel {
* Constructor, used to tell this model to use the * Constructor, used to tell this model to use the
* database configured for ACL * database configured for ACL
*/ */
function __construct() { public function __construct() {
$config = Configure::read('Acl.database'); $config = Configure::read('Acl.database');
if (!empty($config)) { if (!empty($config)) {
$this->useDbConfig = $config; $this->useDbConfig = $config;

View file

@ -87,7 +87,7 @@ class CakeSocket {
* @param array $config Socket configuration, which will be merged with the base configuration * @param array $config Socket configuration, which will be merged with the base configuration
* @see CakeSocket::$_baseConfig * @see CakeSocket::$_baseConfig
*/ */
function __construct($config = array()) { public function __construct($config = array()) {
$this->config = array_merge($this->_baseConfig, $config); $this->config = array_merge($this->_baseConfig, $config);
if (!is_numeric($this->config['protocol'])) { if (!is_numeric($this->config['protocol'])) {
$this->config['protocol'] = getprotobyname($this->config['protocol']); $this->config['protocol'] = getprotobyname($this->config['protocol']);
@ -258,7 +258,7 @@ class CakeSocket {
* *
* @access private * @access private
*/ */
function __destruct() { public function __destruct() {
$this->disconnect(); $this->disconnect();
} }

View file

@ -193,7 +193,7 @@ class SmtpTransport extends AbstractTransport {
* @return void * @return void
* @throws SocketException * @throws SocketException
*/ */
function _smtpSend($data, $checkCode = '250') { protected function _smtpSend($data, $checkCode = '250') {
if (!is_null($data)) { if (!is_null($data)) {
$this->_socket->write($data . "\r\n"); $this->_socket->write($data . "\r\n");
} }

View file

@ -429,7 +429,7 @@ class HttpResponse implements ArrayAccess {
* *
* @return string * @return string
*/ */
public function __toString() { function __toString() {
return $this->body(); return $this->body();
} }

View file

@ -107,7 +107,7 @@ class Debugger {
* Constructor. * Constructor.
* *
*/ */
function __construct() { public function __construct() {
$docRef = ini_get('docref_root'); $docRef = ini_get('docref_root');
if (empty($docRef) && function_exists('ini_set')) { if (empty($docRef) && function_exists('ini_set')) {

View file

@ -87,7 +87,7 @@ class File {
* @param boolean $create Create file if it does not exist (if true) * @param boolean $create Create file if it does not exist (if true)
* @param integer $mode Mode to apply to the folder holding the file * @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); $this->Folder = new Folder(dirname($path), $create, $mode);
if (!is_dir($path)) { if (!is_dir($path)) {
$this->name = basename($path); $this->name = basename($path);
@ -100,7 +100,7 @@ class File {
* Closes the current file if it is opened * Closes the current file if it is opened
* *
*/ */
function __destruct() { public function __destruct() {
$this->close(); $this->close();
} }

View file

@ -89,7 +89,7 @@ class Folder {
* @param boolean $create Create folder if not found * @param boolean $create Create folder if not found
* @param mixed $mode Mode (CHMOD) to apply to created folder, false to ignore * @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)) { if (empty($path)) {
$path = TMP; $path = TMP;
} }
@ -215,7 +215,7 @@ class Folder {
* @return array Files matching pattern * @return array Files matching pattern
* @access private * @access private
*/ */
function _findRecursive($pattern, $sort = false) { public function _findRecursive($pattern, $sort = false) {
list($dirs, $files) = $this->read($sort); list($dirs, $files) = $this->read($sort);
$found = array(); $found = array();
@ -428,7 +428,7 @@ class Folder {
* @param mixed $exceptions Array of files to exclude from the read that will be performed. * @param mixed $exceptions Array of files to exclude from the read that will be performed.
* @access private * @access private
*/ */
function __tree($path, $exceptions) { public function __tree($path, $exceptions) {
$this->path = $path; $this->path = $path;
list($dirs, $files) = $this->read(false, $exceptions, true); list($dirs, $files) = $this->read(false, $exceptions, true);
$this->__directories = array_merge($this->__directories, $dirs); $this->__directories = array_merge($this->__directories, $dirs);
@ -702,7 +702,7 @@ class Folder {
* @param string $path Path to resolve * @param string $path Path to resolve
* @return string The resolved path * @return string The resolved path
*/ */
function realpath($path) { public function realpath($path) {
$path = str_replace('/', DS, trim($path)); $path = str_replace('/', DS, trim($path));
if (strpos($path, '..') === false) { if (strpos($path, '..') === false) {
if (!Folder::isAbsolute($path)) { if (!Folder::isAbsolute($path)) {

View file

@ -69,7 +69,7 @@ class Security {
* @return boolean Success * @return boolean Success
* @todo Complete implementation * @todo Complete implementation
*/ */
function validateAuthKey($authKey) { public static function validateAuthKey($authKey) {
return true; return true;
} }

View file

@ -821,7 +821,7 @@ class Helper extends Object {
* @return array * @return array
* @access private * @access private
*/ */
function __selectedArray($data, $key = 'id') { private function __selectedArray($data, $key = 'id') {
if (!is_array($data)) { if (!is_array($data)) {
$model = $data; $model = $data;
if (!empty($this->request->data[$model][$model])) { if (!empty($this->request->data[$model][$model])) {
@ -846,7 +846,7 @@ class Helper extends Object {
* @return void * @return void
* @access private * @access private
*/ */
function __reset() { private function __reset() {
$this->__tainted = null; $this->__tainted = null;
$this->__cleaned = null; $this->__cleaned = null;
} }
@ -857,7 +857,7 @@ class Helper extends Object {
* @return void * @return void
* @access private * @access private
*/ */
function __clean() { private function __clean() {
if (get_magic_quotes_gpc()) { if (get_magic_quotes_gpc()) {
$this->__cleaned = stripslashes($this->__tainted); $this->__cleaned = stripslashes($this->__tainted);
} else { } else {

View file

@ -74,7 +74,7 @@ class MediaView extends View {
* *
* @param object $controller The controller with viewVars * @param object $controller The controller with viewVars
*/ */
function __construct($controller = null) { public function __construct($controller = null) {
parent::__construct($controller); parent::__construct($controller);
if (is_object($controller) && isset($controller->response)) { if (is_object($controller) && isset($controller->response)) {
$this->response = $controller->response; $this->response = $controller->response;
@ -88,7 +88,7 @@ class MediaView extends View {
* *
* @return mixed * @return mixed
*/ */
function render() { public function render() {
$name = $download = $extension = $id = $modified = $path = $cache = $mimeType = $compress = null; $name = $download = $extension = $id = $modified = $path = $cache = $mimeType = $compress = null;
extract($this->viewVars, EXTR_OVERWRITE); extract($this->viewVars, EXTR_OVERWRITE);

View file

@ -36,7 +36,7 @@ class ThemeView extends View {
* *
* @param Controller $controller Controller object to be rendered. * @param Controller $controller Controller object to be rendered.
*/ */
function __construct($controller) { public function __construct($controller) {
parent::__construct($controller); parent::__construct($controller);
$this->theme = $controller->theme; $this->theme = $controller->theme;
} }
@ -50,7 +50,7 @@ class ThemeView extends View {
* @access protected * @access protected
* @todo Make theme path building respect $cached parameter. * @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); $paths = parent::_paths($plugin, $cached);
$themePaths = array(); $themePaths = array();

View file

@ -271,7 +271,7 @@ class View extends Object {
* *
* @param Controller $controller A controller object to pull View::__passedArgs from. * @param Controller $controller A controller object to pull View::__passedArgs from.
*/ */
function __construct($controller) { public function __construct($controller) {
if (is_object($controller)) { if (is_object($controller)) {
$count = count($this->__passedVars); $count = count($this->__passedVars);
for ($j = 0; $j < $count; $j++) { for ($j = 0; $j < $count; $j++) {
@ -764,7 +764,7 @@ class View extends Object {
* @return array Array of extensions view files use. * @return array Array of extensions view files use.
* @access protected * @access protected
*/ */
function _getExtensions() { protected function _getExtensions() {
$exts = array($this->ext); $exts = array($this->ext);
if ($this->ext !== '.ctp') { if ($this->ext !== '.ctp') {
array_push($exts, '.ctp'); array_push($exts, '.ctp');