1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 13:47:33 +02:00

/*Nette::*/Object

This commit is contained in:
David Grudl
2008-04-16 10:18:02 +00:00
parent 24bf999cd9
commit c8febb8322
21 changed files with 49 additions and 57 deletions

View File

@@ -3,7 +3,7 @@
/**
* Nette Framework
*
* Copyright (c) 2004, 2008 David Grudl (http://www.davidgrudl.com)
* Copyright (c) 2004, 2008 David Grudl (http://davidgrudl.com)
*
* This source file is subject to the "Nette license" that is bundled
* with this package in the file license.txt.
@@ -17,13 +17,14 @@
* @package Nette
*/
// namespace Nette;
/*namespace Nette;*/
/**
* Custom output for Nette::Debug.
*/
interface Nette_IDebuggable
interface IDebuggable
{
/**

View File

@@ -3,7 +3,7 @@
/**
* Nette Framework
*
* Copyright (c) 2004, 2008 David Grudl (http://www.davidgrudl.com)
* Copyright (c) 2004, 2008 David Grudl (http://davidgrudl.com)
*
* This source file is subject to the "Nette license" that is bundled
* with this package in the file license.txt.
@@ -17,7 +17,7 @@
* @package Nette
*/
// namespace Nette;
/*namespace Nette;*/
/**
@@ -61,7 +61,7 @@
* @package Nette
* @version $Revision$ $Date$
*/
abstract class Nette_Object
abstract class Object
{
/**
@@ -94,12 +94,12 @@ abstract class Nette_Object
* @param string method name
* @param array arguments
* @return mixed
* @throws MemberAccessException
* @throws ::MemberAccessException
*/
protected function __call($name, $args)
{
if ($name === '') {
throw new MemberAccessException("Call to method without name.");
throw new /*::*/MemberAccessException("Call to method without name.");
}
$class = get_class($this);
@@ -125,7 +125,7 @@ abstract class Nette_Object
}
} while ($cl = get_parent_class($cl));
throw new MemberAccessException("Call to undefined method $class::$name().");
throw new /*::*/MemberAccessException("Call to undefined method $class::$name().");
}
@@ -136,12 +136,12 @@ abstract class Nette_Object
* @param string method name (in lower case!)
* @param array arguments
* @return mixed
* @throws MemberAccessException
* @throws ::MemberAccessException
*/
protected static function __callStatic($name, $args)
{
$class = get_called_class();
throw new MemberAccessException("Call to undefined static method $class::$name().");
throw new /*::*/MemberAccessException("Call to undefined static method $class::$name().");
}
@@ -151,12 +151,12 @@ abstract class Nette_Object
*
* @param string property name
* @return mixed property value
* @throws MemberAccessException if the property is not defined.
* @throws ::MemberAccessException if the property is not defined.
*/
protected function &__get($name)
{
if ($name === '') {
throw new MemberAccessException("Cannot read an property without name.");
throw new /*::*/MemberAccessException("Cannot read an property without name.");
}
// property getter support
@@ -164,13 +164,13 @@ abstract class Nette_Object
$m = 'get' . $name;
if (self::hasAccessor($class, $m)) {
// ampersands:
// - using &__get() because declaration should be forward compatible (e.g. with Web::Html)
// - using &__get() because declaration should be forward compatible (e.g. with Nette::Web::Html)
// - not using &$this->$m because user could bypass property setter by: $x = & $obj->property; $x = 'new value';
$val = $this->$m();
return $val;
} else {
throw new MemberAccessException("Cannot read an undeclared property $class::\$$name.");
throw new /*::*/MemberAccessException("Cannot read an undeclared property $class::\$$name.");
}
}
@@ -182,12 +182,12 @@ abstract class Nette_Object
* @param string property name
* @param mixed property value
* @return void
* @throws MemberAccessException if the property is not defined or is read-only
* @throws ::MemberAccessException if the property is not defined or is read-only
*/
protected function __set($name, $value)
{
if ($name === '') {
throw new MemberAccessException('Cannot assign to an property without name.');
throw new /*::*/MemberAccessException('Cannot assign to an property without name.');
}
// property setter support
@@ -198,11 +198,11 @@ abstract class Nette_Object
$this->$m($value);
} else {
throw new MemberAccessException("Cannot assign to a read-only property $class::\$$name.");
throw new /*::*/MemberAccessException("Cannot assign to a read-only property $class::\$$name.");
}
} else {
throw new MemberAccessException("Cannot assign to an undeclared property $class::\$$name.");
throw new /*::*/MemberAccessException("Cannot assign to an undeclared property $class::\$$name.");
}
}
@@ -226,12 +226,12 @@ abstract class Nette_Object
*
* @param string property name
* @return void
* @throws MemberAccessException
* @throws ::MemberAccessException
*/
protected function __unset($name)
{
$class = get_class($this);
throw new MemberAccessException("Cannot unset an property $class::\$$name.");
throw new /*::*/MemberAccessException("Cannot unset an property $class::\$$name.");
}

View File

@@ -3,7 +3,7 @@
/**
* Nette Framework
*
* Copyright (c) 2004, 2008 David Grudl (http://www.davidgrudl.com)
* Copyright (c) 2004, 2008 David Grudl (http://davidgrudl.com)
*
* This source file is subject to the "Nette license" that is bundled
* with this package in the file license.txt.
@@ -17,7 +17,7 @@
* @package Nette
*/
// no namespace;
/*no namespace*/
@@ -108,12 +108,3 @@ class FileNotFoundException extends IOException
class DirectoryNotFoundException extends IOException
{
}
/**
* User attempt to terminate the current script.
*/
class AbortException extends RuntimeException
{
}

View File

@@ -32,8 +32,8 @@ if (version_compare(PHP_VERSION, '5.1.0', '<')) {
// nette libraries
if (!class_exists('NotImplementedException', FALSE)) { require_once dirname(__FILE__) . '/Nette/exceptions.php'; }
if (!class_exists('Nette_Object', FALSE)) { require_once dirname(__FILE__) . '/Nette/Object.php'; }
if (!interface_exists('Nette_IDebuggable', FALSE)) { require_once dirname(__FILE__) . '/Nette/IDebuggable.php'; }
if (!class_exists(/*Nette::*/'Object', FALSE)) { require_once dirname(__FILE__) . '/Nette/Object.php'; }
if (!interface_exists(/*Nette::*/'IDebuggable', FALSE)) { require_once dirname(__FILE__) . '/Nette/IDebuggable.php'; }
// dibi libraries
require_once dirname(__FILE__) . '/libs/interfaces.php';
@@ -168,11 +168,11 @@ class dibi
*/
public static function connect($config = array(), $name = 0)
{
if (class_exists('Nette_Debug', FALSE) && Nette_Debug::isEnabled()) {
Nette_Debug::addColophon(array(__CLASS__, 'getColophon'));
if (class_exists(/*Nette::*/'Debug', FALSE) && /*Nette::*/Debug::isEnabled()) {
/*Nette::*/Debug::addColophon(array(__CLASS__, 'getColophon'));
}
if (is_array($config) || $config instanceof Nette_Collections_IMap) {
if (is_array($config) || $config instanceof /*Nette::Collections::*/IMap) {
$config['name'] = $name;
} else {
$config .= '&name=' . urlencode($name);

View File

@@ -34,7 +34,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiMsSqlDriver extends Nette_Object implements IDibiDriver
class DibiMsSqlDriver extends /*Nette::*/Object implements IDibiDriver
{
/**

View File

@@ -40,7 +40,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiMySqlDriver extends Nette_Object implements IDibiDriver
class DibiMySqlDriver extends /*Nette::*/Object implements IDibiDriver
{
/**

View File

@@ -40,7 +40,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiMySqliDriver extends Nette_Object implements IDibiDriver
class DibiMySqliDriver extends /*Nette::*/Object implements IDibiDriver
{
/**

View File

@@ -33,7 +33,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiOdbcDriver extends Nette_Object implements IDibiDriver
class DibiOdbcDriver extends /*Nette::*/Object implements IDibiDriver
{
/**

View File

@@ -33,7 +33,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiOracleDriver extends Nette_Object implements IDibiDriver
class DibiOracleDriver extends /*Nette::*/Object implements IDibiDriver
{
/**

View File

@@ -33,7 +33,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiPdoDriver extends Nette_Object implements IDibiDriver
class DibiPdoDriver extends /*Nette::*/Object implements IDibiDriver
{
/**

View File

@@ -34,7 +34,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiPostgreDriver extends Nette_Object implements IDibiDriver
class DibiPostgreDriver extends /*Nette::*/Object implements IDibiDriver
{
/**

View File

@@ -34,7 +34,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiSqliteDriver extends Nette_Object implements IDibiDriver
class DibiSqliteDriver extends /*Nette::*/Object implements IDibiDriver
{
/**

View File

@@ -27,7 +27,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiConnection extends Nette_Object
class DibiConnection extends /*Nette::*/Object
{
/**
* Current connection configuration.
@@ -58,7 +58,7 @@ class DibiConnection extends Nette_Object
/**
* Creates object and (optionally) connects to a database.
*
* @param array|string|Nette_Collections_IMap connection parameters
* @param array|string|Nette::Collections::IMap connection parameters
* @throws DibiException
*/
public function __construct($config)
@@ -67,7 +67,7 @@ class DibiConnection extends Nette_Object
if (is_string($config)) {
parse_str($config, $config);
} elseif ($config instanceof Nette_Collections_IMap) {
} elseif ($config instanceof /*Nette::Collections::*/IMap) {
$config = $config->toArray();
}

View File

@@ -27,7 +27,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiDataSource extends Nette_Object implements IDataSource
class DibiDataSource extends /*Nette::*/Object implements IDataSource
{
/** @var DibiConnection */
private $connection;

View File

@@ -42,7 +42,7 @@ class DibiException extends Exception
* @package dibi
* @version $Revision$ $Date$
*/
class DibiDriverException extends DibiException implements Nette_IDebuggable
class DibiDriverException extends DibiException implements /*Nette::*/IDebuggable
{
/** @var string */
private static $errorMsg;
@@ -87,7 +87,7 @@ class DibiDriverException extends DibiException implements Nette_IDebuggable
/********************* interface Nette_IDebuggable ****************d*g**/
/********************* interface Nette::IDebuggable ****************d*g**/
/**

View File

@@ -27,7 +27,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
final class DibiLogger extends Nette_Object
final class DibiLogger extends /*Nette::*/Object
{
/** @var string Name of the file where SQL errors should be logged */
private $file;

View File

@@ -41,7 +41,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
class DibiResult extends Nette_Object implements IDataSource
class DibiResult extends /*Nette::*/Object implements IDataSource
{
/**
* IDibiDriver.

View File

@@ -26,7 +26,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
abstract class DibiTable extends Nette_Object
abstract class DibiTable extends /*Nette::*/Object
{
/** @var string primary key mask */
public static $primaryMask = 'id';

View File

@@ -27,7 +27,7 @@
* @package dibi
* @version $Revision$ $Date$
*/
final class DibiTranslator extends Nette_Object
final class DibiTranslator extends /*Nette::*/Object
{
/** @var string */
public $sql;

View File

@@ -23,7 +23,7 @@
* Default implemenation of IDibiVariable.
* @package dibi
*/
class DibiVariable extends Nette_Object implements IDibiVariable
class DibiVariable extends /*Nette::*/Object implements IDibiVariable
{
/** @var mixed */
public $value;

View File

@@ -5,7 +5,7 @@ require_once '../dibi/dibi.php';
require_once 'Nette/Debug.php';
Nette_Debug::enable();
Debug::enable();
dibi::connect(array(