From 041f0594081a548901cf872c6f664214aba9bab2 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Tue, 11 Dec 2007 07:28:55 +0000 Subject: [PATCH] removed NClass --- dibi/dibi.php | 41 +++++++++++++++++++------------ dibi/drivers/mssql.php | 12 ++++----- dibi/drivers/mysql.php | 12 ++++----- dibi/drivers/mysqli.php | 12 ++++----- dibi/drivers/odbc.php | 12 ++++----- dibi/drivers/oracle.php | 12 ++++----- dibi/drivers/pdo.php | 12 ++++----- dibi/drivers/postgre.php | 14 +++++------ dibi/drivers/sqlite.php | 12 ++++----- dibi/libs/DibiConnection.php | 22 ++++++++--------- dibi/libs/DibiDriverInterface.php | 12 ++++----- dibi/libs/DibiException.php | 2 +- dibi/libs/DibiLogger.php | 8 +++--- dibi/libs/DibiResult.php | 4 +-- dibi/libs/DibiResultIterator.php | 4 +-- dibi/libs/DibiTranslator.php | 2 +- dibi/libs/NClass.php | 39 ----------------------------- dibi/libs/NObject.php | 16 ++++++------ 18 files changed, 109 insertions(+), 139 deletions(-) delete mode 100644 dibi/libs/NClass.php diff --git a/dibi/dibi.php b/dibi/dibi.php index 926c4efb..713f1ac9 100644 --- a/dibi/dibi.php +++ b/dibi/dibi.php @@ -32,7 +32,6 @@ if (version_compare(PHP_VERSION , '5.1.0', '<')) { // nette libraries if (!class_exists('NObject', FALSE)) { require_once __FILE__ . '/../libs/NObject.php'; } -if (!class_exists('NClass', FALSE)) { require_once __FILE__ . '/../libs/NClass.php'; } if (!class_exists('NException', FALSE)) { require_once __FILE__ . '/../libs/NException.php'; } // dibi libraries @@ -60,7 +59,7 @@ require_once __FILE__ . '/../libs/DibiVariable.php'; * @package dibi * @version $Revision$ $Date$ */ -class dibi extends NClass +class dibi { /** * Column type in relation to PHP native type @@ -142,6 +141,16 @@ class dibi extends NClass + /** + * static class + */ + final public function __construct() + { + throw new LogicException("Cannot instantiate static class " . get_class($this)); + } + + + /** * Creates a new DibiConnection object and connects it to specified database * @@ -245,7 +254,7 @@ class dibi extends NClass /** * Executes the SQL query - Monostate for DibiConnection::nativeQuery() * - * @param string SQL statement. + * @param string SQL statement. * @return DibiResult Result set object (if any) */ public static function nativeQuery($sql) @@ -396,7 +405,7 @@ class dibi extends NClass /** * Pseudotype for timestamp representation * - * @param mixed datetime + * @param mixed datetime * @return DibiVariable */ public static function datetime($time = NULL) @@ -416,7 +425,7 @@ class dibi extends NClass /** * Pseudotype for date representation * - * @param mixed date + * @param mixed date * @return DibiVariable */ public static function date($date = NULL) @@ -431,8 +440,8 @@ class dibi extends NClass /** * Create a new substitution pair for indentifiers * - * @param string from - * @param string to + * @param string from + * @param string to * @return void */ public static function addSubst($expr, $subst) @@ -445,7 +454,7 @@ class dibi extends NClass /** * Remove substitution pair * - * @param mixed from or TRUE + * @param mixed from or TRUE * @return void */ public static function removeSubst($expr) @@ -474,7 +483,7 @@ class dibi extends NClass /** * Add new event handler * - * @param callback + * @param callback * @return void * @throws InvalidArgumentException */ @@ -492,9 +501,9 @@ class dibi extends NClass /** * Event notification (events: exception, connected, beforeQuery, afterQuery, begin, commit, rollback) * - * @param DibiConnection - * @param string event name - * @param mixed + * @param DibiConnection + * @param string event name + * @param mixed * @return void */ public static function notify(DibiConnection $connection = NULL, $event, $arg = NULL) @@ -509,8 +518,8 @@ class dibi extends NClass /** * Enable profiler & logger * - * @param string filename - * @param bool log all queries? + * @param string filename + * @param bool log all queries? * @return DibiProfiler */ public static function startLogger($file, $logQueries = FALSE) @@ -526,8 +535,8 @@ class dibi extends NClass /** * Prints out a syntax highlighted version of the SQL command or DibiResult * - * @param string|DibiResult - * @param bool return or print? + * @param string|DibiResult + * @param bool return output instead of printing it? * @return string */ public static function dump($sql = NULL, $return = FALSE) diff --git a/dibi/drivers/mssql.php b/dibi/drivers/mssql.php index 1348406e..b92ca957 100644 --- a/dibi/drivers/mssql.php +++ b/dibi/drivers/mssql.php @@ -108,7 +108,7 @@ class DibiMsSqlDriver extends NObject implements DibiDriverInterface /** * Executes the SQL query * - * @param string SQL statement. + * @param string SQL statement. * @return bool have resultset? * @throws DibiDriverException */ @@ -188,8 +188,8 @@ class DibiMsSqlDriver extends NObject implements DibiDriverInterface /** * Format to SQL command * - * @param string value - * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) + * @param string value + * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @return string formatted value * @throws InvalidArgumentException */ @@ -208,9 +208,9 @@ class DibiMsSqlDriver extends NObject implements DibiDriverInterface /** * Injects LIMIT/OFFSET to the SQL query * - * @param string &$sql The SQL query that will be modified. - * @param int $limit - * @param int $offset + * @param string &$sql The SQL query that will be modified. + * @param int $limit + * @param int $offset * @return void */ public function applyLimit(&$sql, $limit, $offset) diff --git a/dibi/drivers/mysql.php b/dibi/drivers/mysql.php index 24c21b1e..91f23c7a 100644 --- a/dibi/drivers/mysql.php +++ b/dibi/drivers/mysql.php @@ -157,7 +157,7 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface /** * Executes the SQL query * - * @param string SQL statement. + * @param string SQL statement. * @return bool have resultset? * @throws DibiDriverException */ @@ -241,8 +241,8 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface /** * Format to SQL command * - * @param string value - * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) + * @param string value + * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @return string formatted value * @throws InvalidArgumentException */ @@ -261,9 +261,9 @@ class DibiMySqlDriver extends NObject implements DibiDriverInterface /** * Injects LIMIT/OFFSET to the SQL query * - * @param string &$sql The SQL query that will be modified. - * @param int $limit - * @param int $offset + * @param string &$sql The SQL query that will be modified. + * @param int $limit + * @param int $offset * @return void */ public function applyLimit(&$sql, $limit, $offset) diff --git a/dibi/drivers/mysqli.php b/dibi/drivers/mysqli.php index f84c5bfc..65674159 100644 --- a/dibi/drivers/mysqli.php +++ b/dibi/drivers/mysqli.php @@ -140,7 +140,7 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface /** * Executes the SQL query * - * @param string SQL statement. + * @param string SQL statement. * @return bool have resultset? * @throws DibiDriverException */ @@ -220,8 +220,8 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface /** * Format to SQL command * - * @param string value - * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) + * @param string value + * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @return string formatted value * @throws InvalidArgumentException */ @@ -240,9 +240,9 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface /** * Injects LIMIT/OFFSET to the SQL query * - * @param string &$sql The SQL query that will be modified. - * @param int $limit - * @param int $offset + * @param string &$sql The SQL query that will be modified. + * @param int $limit + * @param int $offset * @return void */ public function applyLimit(&$sql, $limit, $offset) diff --git a/dibi/drivers/odbc.php b/dibi/drivers/odbc.php index 99662a33..e49c2b98 100644 --- a/dibi/drivers/odbc.php +++ b/dibi/drivers/odbc.php @@ -114,7 +114,7 @@ class DibiOdbcDriver extends NObject implements DibiDriverInterface /** * Executes the SQL query * - * @param string SQL statement. + * @param string SQL statement. * @return bool have resultset? * @throws DibiDriverException */ @@ -202,8 +202,8 @@ class DibiOdbcDriver extends NObject implements DibiDriverInterface /** * Format to SQL command * - * @param string value - * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) + * @param string value + * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @return string formatted value * @throws InvalidArgumentException */ @@ -222,9 +222,9 @@ class DibiOdbcDriver extends NObject implements DibiDriverInterface /** * Injects LIMIT/OFFSET to the SQL query * - * @param string &$sql The SQL query that will be modified. - * @param int $limit - * @param int $offset + * @param string &$sql The SQL query that will be modified. + * @param int $limit + * @param int $offset * @return void */ public function applyLimit(&$sql, $limit, $offset) diff --git a/dibi/drivers/oracle.php b/dibi/drivers/oracle.php index 8bc796ea..287b373d 100644 --- a/dibi/drivers/oracle.php +++ b/dibi/drivers/oracle.php @@ -107,7 +107,7 @@ class DibiOracleDriver extends NObject implements DibiDriverInterface /** * Executes the SQL query * - * @param string SQL statement. + * @param string SQL statement. * @return bool have resultset? * @throws DibiDriverException */ @@ -199,8 +199,8 @@ class DibiOracleDriver extends NObject implements DibiDriverInterface /** * Format to SQL command * - * @param string value - * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) + * @param string value + * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @return string formatted value * @throws InvalidArgumentException */ @@ -219,9 +219,9 @@ class DibiOracleDriver extends NObject implements DibiDriverInterface /** * Injects LIMIT/OFFSET to the SQL query * - * @param string &$sql The SQL query that will be modified. - * @param int $limit - * @param int $offset + * @param string &$sql The SQL query that will be modified. + * @param int $limit + * @param int $offset * @return void */ public function applyLimit(&$sql, $limit, $offset) diff --git a/dibi/drivers/pdo.php b/dibi/drivers/pdo.php index bef6a453..692b1cf6 100644 --- a/dibi/drivers/pdo.php +++ b/dibi/drivers/pdo.php @@ -110,7 +110,7 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface /** * Executes the SQL query * - * @param string SQL statement. + * @param string SQL statement. * @return bool have resultset? * @throws DibiDriverException */ @@ -213,8 +213,8 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface /** * Format to SQL command * - * @param string value - * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) + * @param string value + * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @return string formatted value * @throws InvalidArgumentException */ @@ -233,9 +233,9 @@ class DibiPdoDriver extends NObject implements DibiDriverInterface /** * Injects LIMIT/OFFSET to the SQL query * - * @param string &$sql The SQL query that will be modified. - * @param int $limit - * @param int $offset + * @param string &$sql The SQL query that will be modified. + * @param int $limit + * @param int $offset * @return void */ public function applyLimit(&$sql, $limit, $offset) diff --git a/dibi/drivers/postgre.php b/dibi/drivers/postgre.php index 19b3c48a..f7886b2c 100644 --- a/dibi/drivers/postgre.php +++ b/dibi/drivers/postgre.php @@ -124,8 +124,8 @@ class DibiPostgreDriver extends NObject implements DibiDriverInterface /** * Executes the SQL query * - * @param string SQL statement. - * @param bool update affected rows? + * @param string SQL statement. + * @param bool update affected rows? * @return bool have resultset? * @throws DibiDriverException */ @@ -216,8 +216,8 @@ class DibiPostgreDriver extends NObject implements DibiDriverInterface /** * Format to SQL command * - * @param string value - * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) + * @param string value + * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @return string formatted value * @throws InvalidArgumentException */ @@ -246,9 +246,9 @@ class DibiPostgreDriver extends NObject implements DibiDriverInterface /** * Injects LIMIT/OFFSET to the SQL query * - * @param string &$sql The SQL query that will be modified. - * @param int $limit - * @param int $offset + * @param string &$sql The SQL query that will be modified. + * @param int $limit + * @param int $offset * @return void */ public function applyLimit(&$sql, $limit, $offset) diff --git a/dibi/drivers/sqlite.php b/dibi/drivers/sqlite.php index 29ceb842..ea57b460 100644 --- a/dibi/drivers/sqlite.php +++ b/dibi/drivers/sqlite.php @@ -120,7 +120,7 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface /** * Executes the SQL query * - * @param string SQL statement. + * @param string SQL statement. * @return bool have resultset? * @throws DibiDriverException */ @@ -202,8 +202,8 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface /** * Format to SQL command * - * @param string value - * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) + * @param string value + * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @return string formatted value * @throws InvalidArgumentException */ @@ -222,9 +222,9 @@ class DibiSqliteDriver extends NObject implements DibiDriverInterface /** * Injects LIMIT/OFFSET to the SQL query * - * @param string &$sql The SQL query that will be modified. - * @param int $limit - * @param int $offset + * @param string &$sql The SQL query that will be modified. + * @param int $limit + * @param int $offset * @return void */ public function applyLimit(&$sql, $limit, $offset) diff --git a/dibi/libs/DibiConnection.php b/dibi/libs/DibiConnection.php index b25d7956..4c60fbfd 100644 --- a/dibi/libs/DibiConnection.php +++ b/dibi/libs/DibiConnection.php @@ -144,8 +144,8 @@ class DibiConnection extends NObject * Returns configuration variable. If no $key is passed, returns the entire array. * * @see self::__construct - * @param string - * @param mixed default value to use if key not found + * @param string + * @param mixed default value to use if key not found * @return mixed */ final public function getConfig($key = NULL, $default = NULL) @@ -166,9 +166,9 @@ class DibiConnection extends NObject /** * Apply configuration alias or default values * - * @param array connect configuration - * @param string key - * @param string alias key + * @param array connect configuration + * @param string key + * @param string alias key * @return void */ public static function alias(&$config, $key, $alias=NULL) @@ -240,7 +240,7 @@ class DibiConnection extends NObject /** * Executes the SQL query * - * @param string SQL statement. + * @param string SQL statement. * @return DibiResult Result set object (if any) * @throws DibiException */ @@ -349,7 +349,7 @@ class DibiConnection extends NObject /** * Escapes the string * - * @param string unescaped string + * @param string unescaped string * @return string escaped and optionally quoted string */ public function escape($value) @@ -363,7 +363,7 @@ class DibiConnection extends NObject /** * Delimites identifier (table's or column's name, etc.) * - * @param string identifier + * @param string identifier * @return string delimited identifier */ public function delimite($value) @@ -376,9 +376,9 @@ class DibiConnection extends NObject /** * Injects LIMIT/OFFSET to the SQL query * - * @param string &$sql The SQL query that will be modified. - * @param int $limit - * @param int $offset + * @param string &$sql The SQL query that will be modified. + * @param int $limit + * @param int $offset * @return void */ public function applyLimit(&$sql, $limit, $offset) diff --git a/dibi/libs/DibiDriverInterface.php b/dibi/libs/DibiDriverInterface.php index ed97fcb7..b64dd1c7 100644 --- a/dibi/libs/DibiDriverInterface.php +++ b/dibi/libs/DibiDriverInterface.php @@ -54,7 +54,7 @@ interface DibiDriverInterface /** * Internal: Executes the SQL query * - * @param string SQL statement. + * @param string SQL statement. * @return bool have resultset? * @throws DibiDriverException */ @@ -110,8 +110,8 @@ interface DibiDriverInterface /** * Format to SQL command * - * @param string value - * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) + * @param string value + * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, dibi::FIELD_DATE, dibi::FIELD_DATETIME, dibi::IDENTIFIER) * @return string formatted value */ function format($value, $type); @@ -120,9 +120,9 @@ interface DibiDriverInterface /** * Injects LIMIT/OFFSET to the SQL query * - * @param string &$sql The SQL query that will be modified. - * @param int $limit - * @param int $offset + * @param string &$sql The SQL query that will be modified. + * @param int $limit + * @param int $offset * @return void */ function applyLimit(&$sql, $limit, $offset); diff --git a/dibi/libs/DibiException.php b/dibi/libs/DibiException.php index 1bb34ce9..7f9b7eeb 100644 --- a/dibi/libs/DibiException.php +++ b/dibi/libs/DibiException.php @@ -53,7 +53,7 @@ class DibiDriverException extends DibiException * * @param string Message describing the exception * @param int Some code - * @param string SQL command + * @param string SQL command */ public function __construct($message = NULL, $code = 0, $sql = NULL) { diff --git a/dibi/libs/DibiLogger.php b/dibi/libs/DibiLogger.php index 97cc2e66..92f26deb 100644 --- a/dibi/libs/DibiLogger.php +++ b/dibi/libs/DibiLogger.php @@ -41,7 +41,7 @@ final class DibiLogger extends NObject /** - * @param string filename + * @param string filename */ public function __construct($file) { @@ -53,9 +53,9 @@ final class DibiLogger extends NObject /** * Event handler (events: exception, connected, beforeQuery, afterQuery, begin, commit, rollback) * - * @param DibiConnection - * @param string event name - * @param mixed + * @param DibiConnection + * @param string event name + * @param mixed * @return void */ public function handler($connection, $event, $arg) diff --git a/dibi/libs/DibiResult.php b/dibi/libs/DibiResult.php index 3880aa6d..28508a4b 100644 --- a/dibi/libs/DibiResult.php +++ b/dibi/libs/DibiResult.php @@ -530,8 +530,8 @@ class DibiResult extends NObject implements IteratorAggregate, Countable /** * Required by the IteratorAggregate interface - * @param int offset - * @param int limit + * @param int offset + * @param int limit * @return ArrayIterator */ final public function getIterator($offset = NULL, $limit = NULL) diff --git a/dibi/libs/DibiResultIterator.php b/dibi/libs/DibiResultIterator.php index 4ad206e5..c16379f0 100644 --- a/dibi/libs/DibiResultIterator.php +++ b/dibi/libs/DibiResultIterator.php @@ -63,8 +63,8 @@ final class DibiResultIterator implements Iterator /** * Required by the Iterator interface - * @param int offset - * @param int limit + * @param int offset + * @param int limit */ public function __construct(DibiResult $result, $offset, $limit) { diff --git a/dibi/libs/DibiTranslator.php b/dibi/libs/DibiTranslator.php index 13eae7f6..c09ad78f 100644 --- a/dibi/libs/DibiTranslator.php +++ b/dibi/libs/DibiTranslator.php @@ -401,7 +401,7 @@ final class DibiTranslator extends NObject /** * Apply substitutions to indentifier and delimites it * - * @param string indentifier + * @param string indentifier * @return string */ private function delimite($value) diff --git a/dibi/libs/NClass.php b/dibi/libs/NClass.php deleted file mode 100644 index 6def7398..00000000 --- a/dibi/libs/NClass.php +++ /dev/null @@ -1,39 +0,0 @@ - - * $val = $obj->Label; // equivalent to $val = $obj->getLabel(); - * $obj->Label = 'Nette'; // equivalent to $obj->setLabel('Nette'); + * $val = $obj->label; // equivalent to $val = $obj->getLabel(); + * $obj->label = 'Nette'; // equivalent to $obj->setLabel('Nette'); * * Property names are case-sensitive, and they are written in the camelCaps * or PascalCaps. @@ -81,8 +81,8 @@ abstract class NObject /** * Call to undefined method * - * @param string method name - * @param array arguments + * @param string method name + * @param array arguments * @return mixed * @throws BadMethodCallException */ @@ -110,8 +110,8 @@ abstract class NObject /** * Returns property value. Do not call directly. * - * @param string property name - * @return mixed property value or the event handler list + * @param string property name + * @return mixed property value or the event handler list * @throws LogicException if the property is not defined. */ protected function &__get($name) @@ -185,7 +185,7 @@ abstract class NObject /** * Access to undeclared property * - * @param string property name + * @param string property name * @return void * @throws LogicException */ @@ -201,7 +201,7 @@ abstract class NObject * Has property accessor? * * @param string class name - * @param string method name + * @param string method name * @return bool */ private static function hasAccessor($c, $m)