3838 */
3939
4040namespace FeatherBB \Core ;
41+
4142use ArrayAccess ;
4243use ArrayIterator ;
4344use Countable ;
45+ use InvalidArgumentException ;
4446use IteratorAggregate ;
4547use PDO ;
4648use Serializable ;
4749
48- {
49-
50- class DB implements ArrayAccess
50+ {
51+ class Database implements ArrayAccess
5152 {
5253 // ----------------------- //
5354 // --- CLASS CONSTANTS --- //
@@ -240,7 +241,7 @@ public static function reset_config()
240241 * Despite its slightly odd name, this is actually the factory
241242 * method used to acquire instances of the class. It is named
242243 * this way for the sake of a readable interface, ie
243- * DB ::for_table('table_name')->find_one()-> etc. As such,
244+ * self ::for_table('table_name')->find_one()-> etc. As such,
244245 * this will normally be the first method called in a chain.
245246 * @param string $table_name
246247 * @param string $connection_name Which connection to use
@@ -318,7 +319,7 @@ public static function reset_db()
318319 /**
319320 * Detect and initialise the character used to quote identifiers
320321 * (table names, column names etc). If this has been specified
321- * manually using DB ::configure('identifier_quote_character', 'some-char'),
322+ * manually using self ::configure('identifier_quote_character', 'some-char'),
322323 * this will do nothing.
323324 * @param string $connection_name Which connection to use
324325 */
@@ -333,7 +334,7 @@ protected static function _setup_identifier_quote_character($connection_name)
333334 /**
334335 * Detect and initialise the limit clause style ("SELECT TOP 5" /
335336 * "... LIMIT 5"). If this has been specified manually using
336- * DB ::configure('limit_clause_style', 'top'), this will do nothing.
337+ * self ::configure('limit_clause_style', 'top'), this will do nothing.
337338 * @param string $connection_name Which connection to use
338339 */
339340 public static function _setup_limit_clause_style ($ connection_name )
@@ -381,9 +382,9 @@ protected static function _detect_limit_clause_style($connection_name)
381382 case 'sqlsrv ' :
382383 case 'dblib ' :
383384 case 'mssql ' :
384- return DB ::LIMIT_STYLE_TOP_N ;
385+ return self ::LIMIT_STYLE_TOP_N ;
385386 default :
386- return DB ::LIMIT_STYLE_LIMIT ;
387+ return self ::LIMIT_STYLE_LIMIT ;
387388 }
388389 }
389390
@@ -579,7 +580,7 @@ public static function get_connection_names()
579580
580581 /**
581582 * "Private" constructor; shouldn't be called directly.
582- * Use the DB ::for_table factory method instead.
583+ * Use the self ::for_table factory method instead.
583584 */
584585 protected function __construct ($ table_name , $ data = array (), $ connection_name = self ::DEFAULT_CONNECTION )
585586 {
@@ -1800,7 +1801,7 @@ protected function _build_select_start()
18001801 $ result_columns = join (', ' , $ this ->_result_columns );
18011802
18021803 if (!is_null ($ this ->_limit ) &&
1803- self ::$ _config [$ this ->_connection_name ]['limit_clause_style ' ] === DB ::LIMIT_STYLE_TOP_N
1804+ self ::$ _config [$ this ->_connection_name ]['limit_clause_style ' ] === self ::LIMIT_STYLE_TOP_N
18041805 ) {
18051806 $ fragment .= "TOP {$ this ->_limit } " ;
18061807 }
@@ -1896,7 +1897,7 @@ protected function _build_limit()
18961897 {
18971898 $ fragment = '' ;
18981899 if (!is_null ($ this ->_limit ) &&
1899- self ::$ _config [$ this ->_connection_name ]['limit_clause_style ' ] == DB ::LIMIT_STYLE_LIMIT
1900+ self ::$ _config [$ this ->_connection_name ]['limit_clause_style ' ] == self ::LIMIT_STYLE_LIMIT
19001901 ) {
19011902 if (self ::get_db ($ this ->_connection_name )->getAttribute (PDO ::ATTR_DRIVER_NAME ) == 'firebird ' ) {
19021903 $ fragment = 'ROWS ' ;
@@ -2498,7 +2499,7 @@ public static function __callStatic($name, $arguments)
24982499 {
24992500 $ method = strtolower (preg_replace ('/([a-z])([A-Z])/ ' , '$1_$2 ' , $ name ));
25002501
2501- return call_user_func_array (array ('DB ' , $ method ), $ arguments );
2502+ return call_user_func_array (array ('Database ' , $ method ), $ arguments );
25022503 }
25032504 }
25042505
@@ -2744,7 +2745,7 @@ public function unserialize($serialized)
27442745 * Call a method on all models in a result set. This allows for method
27452746 * chaining such as setting a property on all models in a result set or
27462747 * any other batch operation across models.
2747- * @example DB ::for_table('Widget')->find_many()->set('field', 'value')->save();
2748+ * @example self ::for_table('Widget')->find_many()->set('field', 'value')->save();
27482749 * @param string $method
27492750 * @param array $params
27502751 * @return \IdiormResultSet
0 commit comments