Skip to content

Commit cbccd16

Browse files
committed
Adding visibility and static keywords to connection manager.
1 parent 5d8e27d commit cbccd16

File tree

1 file changed

+10
-29
lines changed

1 file changed

+10
-29
lines changed

cake/libs/model/connection_manager.php

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* @package cake
2929
* @subpackage cake.cake.libs.model
3030
*/
31-
class ConnectionManager extends Object {
31+
class ConnectionManager {
3232

3333
/**
3434
* Holds a loaded instance of the Connections object
@@ -69,10 +69,8 @@ function __construct() {
6969
* Gets a reference to the ConnectionManger object instance
7070
*
7171
* @return object Instance
72-
* @access public
73-
* @static
7472
*/
75-
function &getInstance() {
73+
public static function &getInstance() {
7674
static $instance = array();
7775

7876
if (!$instance) {
@@ -87,10 +85,8 @@ function &getInstance() {
8785
*
8886
* @param string $name The name of the DataSource, as defined in app/config/database.php
8987
* @return object Instance
90-
* @access public
91-
* @static
9288
*/
93-
function &getDataSource($name) {
89+
public static function &getDataSource($name) {
9490
$_this =& ConnectionManager::getInstance();
9591

9692
if (!empty($_this->_dataSources[$name])) {
@@ -122,10 +118,8 @@ function &getDataSource($name) {
122118
* Gets the list of available DataSource connections
123119
*
124120
* @return array List of available connections
125-
* @access public
126-
* @static
127121
*/
128-
function sourceList() {
122+
public static function sourceList() {
129123
$_this =& ConnectionManager::getInstance();
130124
return array_keys($_this->_dataSources);
131125
}
@@ -138,10 +132,8 @@ function sourceList() {
138132
* @param object $source DataSource object
139133
* @return string Datasource name, or null if source is not present
140134
* in the ConnectionManager.
141-
* @access public
142-
* @static
143135
*/
144-
function getSourceName(&$source) {
136+
public static function getSourceName(&$source) {
145137
$_this =& ConnectionManager::getInstance();
146138
foreach ($_this->_dataSources as $name => $ds) {
147139
if ($ds == $source) {
@@ -158,10 +150,8 @@ function getSourceName(&$source) {
158150
* or an array containing the filename (without extension) and class name of the object,
159151
* to be found in app/models/datasources/ or cake/libs/model/datasources/.
160152
* @return boolean True on success, null on failure or false if the class is already loaded
161-
* @access public
162-
* @static
163153
*/
164-
function loadDataSource($connName) {
154+
public static function loadDataSource($connName) {
165155
$_this =& ConnectionManager::getInstance();
166156

167157
if (is_array($connName)) {
@@ -193,12 +183,9 @@ function loadDataSource($connName) {
193183
*
194184
* @return array An associative array of elements where the key is the connection name
195185
* (as defined in Connections), and the value is an array with keys 'filename' and 'classname'.
196-
* @access public
197-
* @static
198186
*/
199-
function enumConnectionObjects() {
187+
public static function enumConnectionObjects() {
200188
$_this =& ConnectionManager::getInstance();
201-
202189
return $_this->_connectionsEnum;
203190
}
204191

@@ -208,10 +195,8 @@ function enumConnectionObjects() {
208195
* @param string $name The DataSource name
209196
* @param array $config The DataSource configuration settings
210197
* @return object A reference to the DataSource object, or null if creation failed
211-
* @access public
212-
* @static
213198
*/
214-
function &create($name = '', $config = array()) {
199+
public static function &create($name = '', $config = array()) {
215200
$_this =& ConnectionManager::getInstance();
216201

217202
if (empty($name) || empty($config) || array_key_exists($name, $_this->_connectionsEnum)) {
@@ -228,10 +213,8 @@ function &create($name = '', $config = array()) {
228213
* Gets a list of class and file names associated with the user-defined DataSource connections
229214
*
230215
* @return void
231-
* @access protected
232-
* @static
233216
*/
234-
function _getConnectionObjects() {
217+
protected function _getConnectionObjects() {
235218
$connections = get_object_vars($this->config);
236219

237220
if ($connections != null) {
@@ -247,9 +230,8 @@ function _getConnectionObjects() {
247230
* Returns the file, class name, and parent for the given driver.
248231
*
249232
* @return array An indexed array with: filename, classname, plugin and parent
250-
* @access private
251233
*/
252-
function __connectionData($config) {
234+
private function __connectionData($config) {
253235
if (!isset($config['datasource'])) {
254236
$config['datasource'] = 'dbo';
255237
}
@@ -285,7 +267,6 @@ function __connectionData($config) {
285267
/**
286268
* Destructor.
287269
*
288-
* @access private
289270
*/
290271
function __destruct() {
291272
if (Configure::read('Session.save') == 'database' && function_exists('session_write_close')) {

0 commit comments

Comments
 (0)