28
28
* @package cake
29
29
* @subpackage cake.cake.libs.model
30
30
*/
31
- class ConnectionManager extends Object {
31
+ class ConnectionManager {
32
32
33
33
/**
34
34
* Holds a loaded instance of the Connections object
@@ -69,10 +69,8 @@ function __construct() {
69
69
* Gets a reference to the ConnectionManger object instance
70
70
*
71
71
* @return object Instance
72
- * @access public
73
- * @static
74
72
*/
75
- function &getInstance () {
73
+ public static function &getInstance () {
76
74
static $ instance = array ();
77
75
78
76
if (!$ instance ) {
@@ -87,10 +85,8 @@ function &getInstance() {
87
85
*
88
86
* @param string $name The name of the DataSource, as defined in app/config/database.php
89
87
* @return object Instance
90
- * @access public
91
- * @static
92
88
*/
93
- function &getDataSource ($ name ) {
89
+ public static function &getDataSource ($ name ) {
94
90
$ _this =& ConnectionManager::getInstance ();
95
91
96
92
if (!empty ($ _this ->_dataSources [$ name ])) {
@@ -122,10 +118,8 @@ function &getDataSource($name) {
122
118
* Gets the list of available DataSource connections
123
119
*
124
120
* @return array List of available connections
125
- * @access public
126
- * @static
127
121
*/
128
- function sourceList () {
122
+ public static function sourceList () {
129
123
$ _this =& ConnectionManager::getInstance ();
130
124
return array_keys ($ _this ->_dataSources );
131
125
}
@@ -138,10 +132,8 @@ function sourceList() {
138
132
* @param object $source DataSource object
139
133
* @return string Datasource name, or null if source is not present
140
134
* in the ConnectionManager.
141
- * @access public
142
- * @static
143
135
*/
144
- function getSourceName (&$ source ) {
136
+ public static function getSourceName (&$ source ) {
145
137
$ _this =& ConnectionManager::getInstance ();
146
138
foreach ($ _this ->_dataSources as $ name => $ ds ) {
147
139
if ($ ds == $ source ) {
@@ -158,10 +150,8 @@ function getSourceName(&$source) {
158
150
* or an array containing the filename (without extension) and class name of the object,
159
151
* to be found in app/models/datasources/ or cake/libs/model/datasources/.
160
152
* @return boolean True on success, null on failure or false if the class is already loaded
161
- * @access public
162
- * @static
163
153
*/
164
- function loadDataSource ($ connName ) {
154
+ public static function loadDataSource ($ connName ) {
165
155
$ _this =& ConnectionManager::getInstance ();
166
156
167
157
if (is_array ($ connName )) {
@@ -193,12 +183,9 @@ function loadDataSource($connName) {
193
183
*
194
184
* @return array An associative array of elements where the key is the connection name
195
185
* (as defined in Connections), and the value is an array with keys 'filename' and 'classname'.
196
- * @access public
197
- * @static
198
186
*/
199
- function enumConnectionObjects () {
187
+ public static function enumConnectionObjects () {
200
188
$ _this =& ConnectionManager::getInstance ();
201
-
202
189
return $ _this ->_connectionsEnum ;
203
190
}
204
191
@@ -208,10 +195,8 @@ function enumConnectionObjects() {
208
195
* @param string $name The DataSource name
209
196
* @param array $config The DataSource configuration settings
210
197
* @return object A reference to the DataSource object, or null if creation failed
211
- * @access public
212
- * @static
213
198
*/
214
- function &create ($ name = '' , $ config = array ()) {
199
+ public static function &create ($ name = '' , $ config = array ()) {
215
200
$ _this =& ConnectionManager::getInstance ();
216
201
217
202
if (empty ($ name ) || empty ($ config ) || array_key_exists ($ name , $ _this ->_connectionsEnum )) {
@@ -228,10 +213,8 @@ function &create($name = '', $config = array()) {
228
213
* Gets a list of class and file names associated with the user-defined DataSource connections
229
214
*
230
215
* @return void
231
- * @access protected
232
- * @static
233
216
*/
234
- function _getConnectionObjects () {
217
+ protected function _getConnectionObjects () {
235
218
$ connections = get_object_vars ($ this ->config );
236
219
237
220
if ($ connections != null ) {
@@ -247,9 +230,8 @@ function _getConnectionObjects() {
247
230
* Returns the file, class name, and parent for the given driver.
248
231
*
249
232
* @return array An indexed array with: filename, classname, plugin and parent
250
- * @access private
251
233
*/
252
- function __connectionData ($ config ) {
234
+ private function __connectionData ($ config ) {
253
235
if (!isset ($ config ['datasource ' ])) {
254
236
$ config ['datasource ' ] = 'dbo ' ;
255
237
}
@@ -285,7 +267,6 @@ function __connectionData($config) {
285
267
/**
286
268
* Destructor.
287
269
*
288
- * @access private
289
270
*/
290
271
function __destruct () {
291
272
if (Configure::read ('Session.save ' ) == 'database ' && function_exists ('session_write_close ' )) {
0 commit comments