Skip to content

Commit

Permalink
Changing protected methods to specify protected access.
Browse files Browse the repository at this point in the history
  • Loading branch information
predominant committed Apr 5, 2010
1 parent 1497ec3 commit 50a5471
Show file tree
Hide file tree
Showing 49 changed files with 145 additions and 290 deletions.
9 changes: 3 additions & 6 deletions cake/console/cake.php
Expand Up @@ -166,9 +166,8 @@ function __initConstants() {
/**
* Defines current working environment.
*
* @access protected
*/
function _initEnvironment() {
protected function _initEnvironment() {
$this->stdin = fopen('php://stdin', 'r');
$this->stdout = fopen('php://stdout', 'w');
$this->stderr = fopen('php://stderr', 'w');
Expand Down Expand Up @@ -389,9 +388,8 @@ public function dispatch() {
*
* @param string $plugin Optionally the name of a plugin
* @return mixed False if no shell could be found or an object on success
* @access protected
*/
function _getShell($plugin = null) {
protected function _getShell($plugin = null) {
foreach ($this->shellPaths as $path) {
$this->shellPath = $path . $this->shell . '.php';
$pluginShellPath = DS . $plugin . DS . 'vendors' . DS . 'shells' . DS;
Expand Down Expand Up @@ -641,9 +639,8 @@ public function help() {
*
* @param $status see http://php.net/exit for values
* @return void
* @access protected
*/
function _stop($status = 0) {
protected function _stop($status = 0) {
exit($status);
}
}
Expand Down
3 changes: 1 addition & 2 deletions cake/console/libs/acl.php
Expand Up @@ -229,9 +229,8 @@ public function getPath() {
* @param array $node Array of node information.
* @param integer $indent indent level.
* @return void
* @access protected
*/
function _outputNode($class, $node, $indent) {
protected function _outputNode($class, $node, $indent) {
$indent = str_repeat(' ', $indent);
$data = $node[$class];
if ($data['alias']) {
Expand Down
6 changes: 2 additions & 4 deletions cake/console/libs/console.php
Expand Up @@ -323,9 +323,8 @@ public function main($command = null) {
*
* @param string $modelToCheck
* @return boolean true if is an available model, false otherwise
* @access protected
*/
function _isValidModel($modelToCheck) {
protected function _isValidModel($modelToCheck) {
return in_array($modelToCheck, $this->models);
}

Expand All @@ -334,9 +333,8 @@ function _isValidModel($modelToCheck) {
* all routes found
*
* @return boolean True if config reload was a success, otherwise false
* @access protected
*/
function _loadRoutes() {
protected function _loadRoutes() {
$router =& Router::getInstance();

$router->reload();
Expand Down
42 changes: 14 additions & 28 deletions cake/console/libs/shell.php
Expand Up @@ -192,9 +192,8 @@ public function startup() {
/**
* Displays a header for the shell
*
* @access protected
*/
function _welcome() {
protected function _welcome() {
$this->Dispatch->clear();
$this->out();
$this->out('Welcome to CakePHP v' . Configure::version() . ' Console');
Expand All @@ -209,9 +208,8 @@ function _welcome() {
* makes $this->DbConfig available to subclasses
*
* @return bool
* @access protected
*/
function _loadDbConfig() {
protected function _loadDbConfig() {
if (config('database') && class_exists('DATABASE_CONFIG')) {
$this->DbConfig =& new DATABASE_CONFIG();
return true;
Expand All @@ -228,9 +226,8 @@ function _loadDbConfig() {
* if public $uses is an array of models will load those models
*
* @return bool
* @access protected
*/
function _loadModels() {
protected function _loadModels() {
if ($this->uses === null || $this->uses === false) {
return;
}
Expand Down Expand Up @@ -424,9 +421,8 @@ public function error($title, $message = null) {
*
* @param integer $expectedNum Expected number of paramters
* @param string $command Command
* @access protected
*/
function _checkArgs($expectedNum, $command = null) {
protected function _checkArgs($expectedNum, $command = null) {
if (!$command) {
$command = $this->command;
}
Expand Down Expand Up @@ -496,9 +492,8 @@ public function help() {
* Action to create a Unit Test
*
* @return boolean Success
* @access protected
*/
function _checkUnitTest() {
protected function _checkUnitTest() {
if (App::import('vendor', 'simpletest' . DS . 'simpletest')) {
return true;
}
Expand Down Expand Up @@ -530,9 +525,8 @@ public function shortPath($file) {
*
* @param string $name Controller class name
* @return string Path to controller
* @access protected
*/
function _controllerPath($name) {
protected function _controllerPath($name) {
return strtolower(Inflector::underscore($name));
}

Expand All @@ -541,9 +535,8 @@ function _controllerPath($name) {
*
* @param string $name Controller class name
* @return string Controller plural name
* @access protected
*/
function _controllerName($name) {
protected function _controllerName($name) {
return Inflector::pluralize(Inflector::camelize($name));
}

Expand All @@ -552,9 +545,8 @@ function _controllerName($name) {
*
* @param string $name Name
* @return string Camelized and singularized controller name
* @access protected
*/
function _modelName($name) {
protected function _modelName($name) {
return Inflector::camelize(Inflector::singularize($name));
}

Expand All @@ -563,9 +555,8 @@ function _modelName($name) {
*
* @param string $name Controller class name
* @return string Singular model key
* @access protected
*/
function _modelKey($name) {
protected function _modelKey($name) {
return Inflector::underscore(Inflector::singularize($name)) . '_id';
}

Expand All @@ -574,9 +565,8 @@ function _modelKey($name) {
*
* @param string $key Foreign key
* @return string Model name
* @access protected
*/
function _modelNameFromKey($key) {
protected function _modelNameFromKey($key) {
return Inflector::camelize(str_replace('_id', '', $key));
}

Expand All @@ -585,9 +575,8 @@ function _modelNameFromKey($key) {
*
* @param string $name
* @return string $name
* @access protected
*/
function _singularName($name) {
protected function _singularName($name) {
return Inflector::variable(Inflector::singularize($name));
}

Expand All @@ -596,9 +585,8 @@ function _singularName($name) {
*
* @param string $name Name to use
* @return string Plural name for views
* @access protected
*/
function _pluralName($name) {
protected function _pluralName($name) {
return Inflector::variable(Inflector::pluralize($name));
}

Expand All @@ -607,9 +595,8 @@ function _pluralName($name) {
*
* @param string $name Controller name
* @return string Singular human name
* @access protected
*/
function _singularHumanName($name) {
protected function _singularHumanName($name) {
return Inflector::humanize(Inflector::underscore(Inflector::singularize($name)));
}

Expand All @@ -618,9 +605,8 @@ function _singularHumanName($name) {
*
* @param string $name Controller name
* @return string Plural human name
* @access protected
*/
function _pluralHumanName($name) {
protected function _pluralHumanName($name) {
return Inflector::humanize(Inflector::underscore(Inflector::pluralize($name)));
}

Expand Down
12 changes: 4 additions & 8 deletions cake/console/libs/tasks/fixture.php
Expand Up @@ -247,9 +247,8 @@ function getPath() {
*
* @param array $table Table schema array
* @return string fields definitions
* @access protected
*/
function _generateSchema($tableInfo) {
protected function _generateSchema($tableInfo) {
$schema = $this->_Schema->generateTable('f', $tableInfo);
return substr($schema, 10, -2);
}
Expand All @@ -259,9 +258,8 @@ function _generateSchema($tableInfo) {
*
* @param array $table Table schema array
* @return array Array of records to use in the fixture.
* @access protected
*/
function _generateRecords($tableInfo, $recordCount = 1) {
protected function _generateRecords($tableInfo, $recordCount = 1) {
$records = array();
for ($i = 0; $i < $recordCount; $i++) {
$record = array();
Expand Down Expand Up @@ -331,9 +329,8 @@ function _generateRecords($tableInfo, $recordCount = 1) {
*
* @param array $records Array of records to be converted to string
* @return string A string value of the $records array.
* @access protected
*/
function _makeRecordString($records) {
protected function _makeRecordString($records) {
$out = "array(\n";
foreach ($records as $record) {
$values = array();
Expand All @@ -355,9 +352,8 @@ function _makeRecordString($records) {
* @param string $modelName name of the model to take records from.
* @param string $useTable Name of table to use.
* @return array Array of records.
* @access protected
*/
function _getRecordsFromTable($modelName, $useTable = null) {
protected function _getRecordsFromTable($modelName, $useTable = null) {
if ($this->interactive) {
$condition = null;
$prompt = __("Please provide a SQL fragment to use as conditions\nExample: WHERE 1=1 LIMIT 10", true);
Expand Down
9 changes: 3 additions & 6 deletions cake/console/libs/tasks/test.php
Expand Up @@ -294,9 +294,8 @@ public function generateFixtureList(&$subject) {
*
* @param Model $subject A Model class to scan for associations and pull fixtures off of.
* @return void
* @access protected
*/
function _processModel(&$subject) {
protected function _processModel(&$subject) {
$this->_addFixture($subject->name);
$associated = $subject->getAssociated();
foreach ($associated as $alias => $type) {
Expand All @@ -319,9 +318,8 @@ function _processModel(&$subject) {
*
* @param Controller $subject A controller to pull model names off of.
* @return void
* @access protected
*/
function _processController(&$subject) {
protected function _processController(&$subject) {
$subject->constructClasses();
$models = array(Inflector::classify($subject->name));
if (!empty($subject->uses)) {
Expand All @@ -338,9 +336,8 @@ function _processController(&$subject) {
*
* @param string $name Name of the Model class that a fixture might be required for.
* @return void
* @access protected
*/
function _addFixture($name) {
protected function _addFixture($name) {
$parent = get_parent_class($name);
$prefix = 'app.';
if (strtolower($parent) != 'appmodel' && strtolower(substr($parent, -8)) == 'appmodel') {
Expand Down
9 changes: 3 additions & 6 deletions cake/dispatcher.php
Expand Up @@ -179,9 +179,8 @@ public function dispatch($url = null, $additionalParams = array()) {
* @param array $params Parameters with at least the 'action' to invoke
* @param boolean $missingAction Set to true if missing action should be rendered, false otherwise
* @return string Output as sent by controller
* @access protected
*/
function _invoke(&$controller, $params) {
protected function _invoke(&$controller, $params) {
$controller->constructClasses();
$controller->startupProcess();

Expand Down Expand Up @@ -370,9 +369,8 @@ public function baseUrl() {
* @param boolean $reverse If true all the params are shifted one forward, so plugin becomes
* controller, controller becomes action etc. If false, plugin is made equal to controller
* @return array Restructured array
* @access protected
*/
function _restructureParams($params, $reverse = false) {
protected function _restructureParams($params, $reverse = false) {
if ($reverse === true) {
extract(Router::getArgs($params['action']));
$params = array_merge($params, array(
Expand Down Expand Up @@ -648,9 +646,8 @@ public function asset($url) {
* @param string $assetFile Path to the asset file in the file system
* @param string $ext The extension of the file to determine its mime type
* @return void
* @access protected
*/
function _deliverAsset($assetFile, $ext) {
protected function _deliverAsset($assetFile, $ext) {
$ob = @ini_get("zlib.output_compression") !== '1' && extension_loaded("zlib") && (strpos(env('HTTP_ACCEPT_ENCODING'), 'gzip') !== false);
if ($ob && Configure::read('Asset.compress')) {
ob_start();
Expand Down
3 changes: 1 addition & 2 deletions cake/libs/cache.php
Expand Up @@ -136,9 +136,8 @@ function config($name = null, $settings = array()) {
*
* @param string $name Name of the config array that needs an engine instance built
* @return void
* @access protected
*/
function _buildEngine($name) {
protected function _buildEngine($name) {
$config = $this->__config[$name];

list($plugin, $class) = pluginSplit($config['engine']);
Expand Down
6 changes: 2 additions & 4 deletions cake/libs/cake_log.php
Expand Up @@ -117,9 +117,8 @@ function config($key, $config) {
*
* @param string $loggerName the plugin.className of the logger class you want to build.
* @return mixed boolean false on any failures, string of classname to use if search was successful.
* @access protected
*/
function _getLogger($loggerName) {
protected function _getLogger($loggerName) {
list($plugin, $loggerName) = pluginSplit($loggerName);

if ($plugin) {
Expand Down Expand Up @@ -173,9 +172,8 @@ function drop($streamName) {
* Configures the automatic/default stream a FileLog.
*
* @return void
* @access protected
*/
function _autoConfig() {
protected function _autoConfig() {
if (!class_exists('FileLog')) {
App::import('Core', 'log/FileLog');
}
Expand Down
3 changes: 1 addition & 2 deletions cake/libs/cake_session.php
Expand Up @@ -587,9 +587,8 @@ function __startSession() {
* Helper method to create a new session.
*
* @return void
* @access protected
*/
function _checkValid() {
protected function _checkValid() {
if ($this->read('Config')) {
if ((Configure::read('Session.checkAgent') === false || $this->_userAgent == $this->read('Config.userAgent')) && $this->time <= $this->read('Config.time')) {
$time = $this->read('Config.time');
Expand Down
3 changes: 1 addition & 2 deletions cake/libs/controller/component.php
Expand Up @@ -191,9 +191,8 @@ public function triggerCallback($callback, &$controller) {
* @param object $object Object with a Components array
* @param object $parent the parent of the current object
* @return void
* @access protected
*/
function _loadComponents(&$object, $parent = null) {
protected function _loadComponents(&$object, $parent = null) {
$base = $this->__controllerVars['base'];
$normal = Set::normalize($object->components);
foreach ((array)$normal as $component => $config) {
Expand Down

0 comments on commit 50a5471

Please sign in to comment.