From f3a377a7948175865063667cce59cc433f079ddf Mon Sep 17 00:00:00 2001 From: meus Date: Mon, 3 Sep 2007 14:57:18 +0000 Subject: [PATCH] replace tabs with 4 spaces. and fix other coding style related stuff --- lib/Doctrine.php | 6 +- lib/Doctrine/Adapter/Db2.php | 10 +- lib/Doctrine/Adapter/Mock.php | 16 +- lib/Doctrine/Adapter/Oracle.php | 8 +- lib/Doctrine/Adapter/Statement/Mock.php | 10 +- lib/Doctrine/AuditLog/Listener.php | 12 +- lib/Doctrine/Cache.php | 40 +- lib/Doctrine/Cache/Db.php | 20 +- lib/Doctrine/Cache/Driver.php | 2 +- lib/Doctrine/Collection.php | 8 +- lib/Doctrine/Connection.php | 36 +- lib/Doctrine/Connection/Common.php | 6 +- lib/Doctrine/Connection/Pgsql.php | 12 +- lib/Doctrine/Connection/Profiler.php | 8 +- lib/Doctrine/Connection/Statement.php | 6 +- lib/Doctrine/Connection/UnitOfWork.php | 34 +- lib/Doctrine/DataDict.php | 2 +- lib/Doctrine/DataDict/Firebird.php | 4 +- lib/Doctrine/DataDict/Informix.php | 8 +- lib/Doctrine/DataDict/Mssql.php | 8 +- lib/Doctrine/DataDict/Mysql.php | 10 +- lib/Doctrine/DataDict/Oracle.php | 10 +- lib/Doctrine/DataDict/Pgsql.php | 12 +- lib/Doctrine/DataDict/Sqlite.php | 10 +- lib/Doctrine/DataType.php | 6 +- lib/Doctrine/Export.php | 28 +- lib/Doctrine/Export/Firebird.php | 20 +- lib/Doctrine/Export/Frontbase.php | 16 +- lib/Doctrine/Export/Mysql.php | 12 +- lib/Doctrine/Export/Oracle.php | 2 +- lib/Doctrine/Export/Pgsql.php | 2 +- lib/Doctrine/Export/Sqlite.php | 6 +- lib/Doctrine/Expression.php | 2 +- lib/Doctrine/Expression/Driver.php | 4 +- lib/Doctrine/Expression/Mysql.php | 2 +- lib/Doctrine/Expression/Pgsql.php | 364 ++++++------- lib/Doctrine/Formatter.php | 2 +- lib/Doctrine/Hook.php | 2 +- lib/Doctrine/Hydrate.php | 2 +- lib/Doctrine/Hydrate/Array.php | 6 +- lib/Doctrine/Hydrate/Record.php | 6 +- lib/Doctrine/Import/Builder.php | 16 +- lib/Doctrine/Import/Informix.php | 16 +- lib/Doctrine/Import/Mssql.php | 2 +- lib/Doctrine/Import/Mysql.php | 8 +- lib/Doctrine/Import/Oracle.php | 2 +- lib/Doctrine/Import/Reader/Db.php | 8 +- lib/Doctrine/Import/Schema/Xml.php | 18 +- lib/Doctrine/Import/Schema/Yml.php | 30 +- lib/Doctrine/IntegrityMapper.php | 4 +- lib/Doctrine/Lib.php | 12 +- lib/Doctrine/Locking/Manager/Pessimistic.php | 2 +- lib/Doctrine/Manager.php | 4 +- lib/Doctrine/Node.php | 2 +- lib/Doctrine/Node/NestedSet.php | 6 +- .../Node/NestedSet/PreOrderIterator.php | 2 +- lib/Doctrine/Null.php | 4 +- lib/Doctrine/Query.php | 14 +- lib/Doctrine/Query/Abstract.php | 12 +- lib/Doctrine/Query/JoinCondition.php | 2 +- lib/Doctrine/Query/Where.php | 4 +- lib/Doctrine/RawSql.php | 2 +- lib/Doctrine/Record.php | 22 +- lib/Doctrine/Record/Abstract.php | 8 +- lib/Doctrine/Record/Filter.php | 6 +- lib/Doctrine/Relation.php | 10 +- lib/Doctrine/Relation/Association.php | 4 +- lib/Doctrine/Relation/ForeignKey.php | 14 +- lib/Doctrine/Relation/LocalKey.php | 8 +- lib/Doctrine/Relation/Parser.php | 20 +- lib/Doctrine/Schema.php | 2 +- lib/Doctrine/Schema/Table.php | 4 +- lib/Doctrine/Search.php | 2 +- lib/Doctrine/Search/Analyzer/Standard.php | 2 +- lib/Doctrine/Search/Indexer.php | 6 +- lib/Doctrine/Search/Indexer/Dir.php | 6 +- lib/Doctrine/Search/Query.php | 2 +- lib/Doctrine/Table.php | 22 +- lib/Doctrine/Template/Versionable.php | 2 +- lib/Doctrine/Tokenizer.php | 12 +- lib/Doctrine/Transaction.php | 4 +- lib/Doctrine/Tree.php | 2 +- lib/Doctrine/Tree/NestedSet.php | 4 +- lib/Doctrine/Validator.php | 4 +- lib/Doctrine/Validator/Country.php | 486 +++++++++--------- lib/Doctrine/Validator/Exception.php | 2 +- lib/Doctrine/Validator/Regexp.php | 6 +- lib/Doctrine/Validator/Unique.php | 2 +- lib/Doctrine/Validator/Usstate.php | 6 +- tests/AuditLogTestCase.php | 4 +- tests/CacheTestCase.php | 26 +- tests/Collection/SnapshotTestCase.php | 6 +- tests/ConfigurableTestCase.php | 2 +- tests/CustomResultSetOrderTestCase.php | 2 +- tests/DBTestCase.php | 16 +- tests/DriverTestCase.php | 8 +- tests/ExpressionTestCase.php | 2 +- tests/Import/MssqlTestCase.php | 2 +- tests/Import/Schema/XmlTestCase.php | 6 +- tests/Import/Schema/YmlTestCase.php | 6 +- tests/ImportTestCase.php | 2 +- tests/NestedSet/SingleRootTestCase.php | 10 +- tests/Query/DriverTestCase.php | 10 +- tests/Query/JoinTestCase.php | 6 +- tests/Query/MultiJoin2TestCase.php | 2 +- .../Query/MultipleAggregateValueTestCase.php | 112 ++-- tests/Query/OneToOneFetchingTestCase.php | 6 +- tests/Query/WhereTestCase.php | 6 +- tests/QueryTestCase.php | 2 +- tests/Record/LockTestCase.php | 4 +- tests/Record/SerializeUnserializeTestCase.php | 2 +- tests/Record/StateTestCase.php | 36 +- tests/Relation/AccessTestCase.php | 4 +- tests/Relation/CircularSavingTestCase.php | 4 +- tests/Relation/ManyToMany2TestCase.php | 42 +- tests/RelationTestCase.php | 2 +- tests/SchemaTestCase.php | 26 +- tests/Search/IndexerTestCase.php | 4 +- tests/Search/QueryTestCase.php | 4 +- tests/SearchTestCase.php | 2 +- tests/Sequence/SqliteTestCase.php | 2 +- tests/SequenceTestCase.php | 2 +- tests/TableTestCase.php | 8 +- tests/TemplateTestCase.php | 4 +- tests/Test.php | 8 +- tests/cc.php | 2 +- 126 files changed, 1005 insertions(+), 1005 deletions(-) diff --git a/lib/Doctrine.php b/lib/Doctrine.php index 0355a2c48..51a892d30 100644 --- a/lib/Doctrine.php +++ b/lib/Doctrine.php @@ -108,7 +108,7 @@ final class Doctrine const FETCH_UNIQUE = 196608; const NULL_EMPTY_STRING = 1; const NULL_NATURAL = 0; - const NULL_TO_STRING = NULL; + const NULL_TO_STRING = NULL; const PARAM_BOOL = 5; const PARAM_INPUT_OUTPUT = -2147483648; const PARAM_INT = 1; @@ -480,7 +480,7 @@ final class Doctrine if (class_exists($classname, false)) { return false; } - if (! self::$path) { + if ( ! self::$path) { self::$path = dirname(__FILE__); } $class = self::$path . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR,$classname) . '.php'; @@ -504,7 +504,7 @@ final class Doctrine */ public static function dump($var, $output = true) { - $ret = array(); + $ret = array(); switch (gettype($var)) { case 'array': $ret[] = 'Array('; diff --git a/lib/Doctrine/Adapter/Db2.php b/lib/Doctrine/Adapter/Db2.php index 8ab450cab..9ee156d81 100644 --- a/lib/Doctrine/Adapter/Db2.php +++ b/lib/Doctrine/Adapter/Db2.php @@ -145,12 +145,12 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter $conn_func_name = 'db2_connect'; } - if (!isset($this->_config['options'])) { + if ( ! isset($this->_config['options'])) { // config options were not set, so set it to an empty array $this->_config['options'] = array(); } - if (!isset($this->_config['options']['autocommit'])) { + if ( ! isset($this->_config['options']['autocommit'])) { // set execution mode $this->_config['options']['autocommit'] = &$this->_execute_mode; } @@ -181,7 +181,7 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter } // check the connection - if (!$this->_connection) { + if ( ! $this->_connection) { throw new Doctrine_Adapter_Db2_Exception(db2_conn_errormsg(), db2_conn_error()); } } @@ -286,7 +286,7 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter */ protected function _commit() { - if (!db2_commit($this->_connection)) { + if ( ! db2_commit($this->_connection)) { throw new Doctrine_Adapter_Db2_Exception( db2_conn_errormsg($this->_connection), db2_conn_error($this->_connection)); @@ -302,7 +302,7 @@ class Doctrine_Adapter_Db2 extends Doctrine_Adapter */ protected function _rollBack() { - if (!db2_rollback($this->_connection)) { + if ( ! db2_rollback($this->_connection)) { throw new Doctrine_Adapter_Db2_Exception( db2_conn_errormsg($this->_connection), db2_conn_error($this->_connection)); diff --git a/lib/Doctrine/Adapter/Mock.php b/lib/Doctrine/Adapter/Mock.php index 846af11d9..4e916a051 100644 --- a/lib/Doctrine/Adapter/Mock.php +++ b/lib/Doctrine/Adapter/Mock.php @@ -74,7 +74,7 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable $e = $this->exception; - if( ! empty($e)) { + if ( ! empty($e)) { $name = $e[0]; $this->exception = array(); @@ -101,7 +101,7 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable $e = $this->exception; - if( ! empty($e)) { + if ( ! empty($e)) { $name = $e[0]; $this->exception = array(); @@ -121,16 +121,16 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable } public function lastInsertId() { - $this->queries[] = 'LAST_INSERT_ID()'; - if ($this->lastInsertIdFail) { + $this->queries[] = 'LAST_INSERT_ID()'; + if ($this->lastInsertIdFail) { return null; - } else { + } else { return 1; } } public function count() { - return count($this->queries); + return count($this->queries); } public function beginTransaction() { @@ -150,12 +150,12 @@ class Doctrine_Adapter_Mock implements Doctrine_Adapter_Interface, Countable { } public function getAttribute($attribute) { - if($attribute == Doctrine::ATTR_DRIVER_NAME) + if ($attribute == Doctrine::ATTR_DRIVER_NAME) return strtolower($this->name); } public function setAttribute($attribute, $value) { - + } public function sqliteCreateFunction() { } diff --git a/lib/Doctrine/Adapter/Oracle.php b/lib/Doctrine/Adapter/Oracle.php index 6d19970d7..602591e75 100644 --- a/lib/Doctrine/Adapter/Oracle.php +++ b/lib/Doctrine/Adapter/Oracle.php @@ -110,7 +110,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter return; } - if (!extension_loaded('oci8')) { + if ( ! extension_loaded('oci8')) { throw new Doctrine_Adapter_Oracle_Exception('The OCI8 extension is required for this adapter but not loaded'); } @@ -126,7 +126,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter } // check the connection - if (!$this->_connection) { + if ( ! $this->_connection) { throw new Doctrine_Adapter_Oracle_Exception(oci_error()); } } @@ -199,7 +199,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter */ protected function _commit() { - if (!oci_commit($this->_connection)) { + if ( ! oci_commit($this->_connection)) { throw new Doctrine_Adapter_Oracle_Exception(oci_error($this->_connection)); } $this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS); @@ -212,7 +212,7 @@ class Doctrine_Adapter_Oracle extends Doctrine_Adapter */ protected function _rollBack() { - if (!oci_rollback($this->_connection)) { + if ( ! oci_rollback($this->_connection)) { throw new Doctrine_Adapter_Oracle_Exception(oci_error($this->_connection)); } $this->_setExecuteMode(OCI_COMMIT_ON_SUCCESS); diff --git a/lib/Doctrine/Adapter/Statement/Mock.php b/lib/Doctrine/Adapter/Statement/Mock.php index 449d1b513..d29d0abf6 100644 --- a/lib/Doctrine/Adapter/Statement/Mock.php +++ b/lib/Doctrine/Adapter/Statement/Mock.php @@ -54,7 +54,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte */ public function bindColumn($column, $param, $type = null) { - + } /** * bindValue @@ -72,7 +72,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte */ public function bindValue($param, $value, $type = null) { - + } /** * bindParam @@ -103,7 +103,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte */ public function bindParam($column, $variable, $type = null, $length = null, $driverOptions = array()) { - + } /** * closeCursor @@ -125,7 +125,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte */ public function columnCount() { - return 0; + return 0; } /** * errorCode @@ -216,7 +216,7 @@ class Doctrine_Adapter_Statement_Mock implements Doctrine_Adapter_Statement_Inte */ public function execute($params = null) { - if(is_object($this->mock)) { + if (is_object($this->mock)) { $this->mock->addQuery($this->queryString); } return true; diff --git a/lib/Doctrine/AuditLog/Listener.php b/lib/Doctrine/AuditLog/Listener.php index 0405393ab..d22935228 100644 --- a/lib/Doctrine/AuditLog/Listener.php +++ b/lib/Doctrine/AuditLog/Listener.php @@ -40,7 +40,7 @@ class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener } public function preInsert(Doctrine_Event $event) { - $versionColumn = $this->_auditLog->getOption('versionColumn'); + $versionColumn = $this->_auditLog->getOption('versionColumn'); $event->getInvoker()->set($versionColumn, 1); } @@ -54,23 +54,23 @@ class Doctrine_AuditLog_Listener extends Doctrine_Record_Listener $version->merge($record->toArray()); $version->save(); - $versionColumn = $this->_auditLog->getOption('versionColumn'); - $version = $record->get($versionColumn); + $versionColumn = $this->_auditLog->getOption('versionColumn'); + $version = $record->get($versionColumn); $record->set($versionColumn, ++$version); } public function preUpdate(Doctrine_Event $event) { - $class = $this->_auditLog->getOption('className'); + $class = $this->_auditLog->getOption('className'); $record = $event->getInvoker(); $version = new $class(); $version->merge($record->toArray()); $version->save(); - $versionColumn = $this->_auditLog->getOption('versionColumn'); + $versionColumn = $this->_auditLog->getOption('versionColumn'); - $version = $record->get($versionColumn); + $version = $record->get($versionColumn); $record->set($versionColumn, ++$version); } diff --git a/lib/Doctrine/Cache.php b/lib/Doctrine/Cache.php index 60853b54e..da40c4fa7 100644 --- a/lib/Doctrine/Cache.php +++ b/lib/Doctrine/Cache.php @@ -67,13 +67,13 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat */ public function __construct($driver, $options = array()) { - if (is_object($driver)) { - if ( ! ($driver instanceof Doctrine_Cache_Interface)) { - throw new Doctrine_Cache_Exception('Driver should implement Doctrine_Cache_Interface.'); - } - - $this->_driver = $driver; - $this->_driver->setOptions($options); + if (is_object($driver)) { + if ( ! ($driver instanceof Doctrine_Cache_Interface)) { + throw new Doctrine_Cache_Exception('Driver should implement Doctrine_Cache_Interface.'); + } + + $this->_driver = $driver; + $this->_driver->setOptions($options); } else { $class = 'Doctrine_Cache_' . ucwords(strtolower($driver)); @@ -103,12 +103,12 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat */ public function setOption($option, $value) { - // sanity check (we need this since we are using isset() instead of array_key_exists()) - if ($value === null) { + // sanity check (we need this since we are using isset() instead of array_key_exists()) + if ($value === null) { throw new Doctrine_Cache_Exception('Null values not accepted for options.'); - } + } - if (isset($this->_options[$option])) { + if (isset($this->_options[$option])) { $this->_options[$option] = $value; return true; } @@ -138,7 +138,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat */ public function add($query, $namespace = null) { - if (isset($namespace)) { + if (isset($namespace)) { $this->_queries[$namespace][] = $query; } else { $this->_queries[] = $query; @@ -153,7 +153,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat public function getAll($namespace = null) { if (isset($namespace)) { - if( ! isset($this->_queries[$namespace])) { + if ( ! isset($this->_queries[$namespace])) { return array(); } @@ -216,7 +216,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat { $rand = (mt_rand() / mt_getrandmax()); - if ($rand <= $this->_options['cleanPropability']) { + if ($rand <= $this->_options['cleanPropability']) { $queries = $this->readStats(); $stats = array(); @@ -249,14 +249,14 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat */ public function readStats() { - if ($this->_options['statsFile'] !== false) { - $content = file_get_contents($this->_options['statsFile']); + if ($this->_options['statsFile'] !== false) { + $content = file_get_contents($this->_options['statsFile']); $e = explode("\n", $content); return array_map('unserialize', $e); - } - return array(); + } + return array(); } /** * appendStats @@ -266,7 +266,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat */ public function appendStats() { - if ($this->_options['statsFile'] !== false) { + if ($this->_options['statsFile'] !== false) { if ( ! file_exists($this->_options['statsFile'])) { throw new Doctrine_Cache_Exception("Couldn't save cache statistics. Cache statistics file doesn't exists!"); @@ -335,7 +335,7 @@ class Doctrine_Cache extends Doctrine_EventListener implements Countable, Iterat public function preFetch(Doctrine_Event $event) { $ret = current($this->_data); - next($this->_data); + next($this->_data); return $ret; } /** diff --git a/lib/Doctrine/Cache/Db.php b/lib/Doctrine/Cache/Db.php index 7b98c7692..485e30c31 100644 --- a/lib/Doctrine/Cache/Db.php +++ b/lib/Doctrine/Cache/Db.php @@ -40,18 +40,18 @@ class Doctrine_Cache_Db extends Doctrine_Cache_Driver implements Countable */ public function __construct($options) { - if ( ! isset($options['connection']) || + if ( ! isset($options['connection']) || ! ($options['connection'] instanceof Doctrine_Connection)) { - throw new Doctrine_Cache_Exception('Connection option not set.'); - } - - if ( ! isset($options['tableName']) || - ! is_string($options['tableName'])) { - - throw new Doctrine_Cache_Exception('Table name option not set.'); - } - + throw new Doctrine_Cache_Exception('Connection option not set.'); + } + + if ( ! isset($options['tableName']) || + ! is_string($options['tableName'])) { + + throw new Doctrine_Cache_Exception('Table name option not set.'); + } + $this->_options = $options; } diff --git a/lib/Doctrine/Cache/Driver.php b/lib/Doctrine/Cache/Driver.php index c587ebf9b..b7f6d72cc 100644 --- a/lib/Doctrine/Cache/Driver.php +++ b/lib/Doctrine/Cache/Driver.php @@ -56,7 +56,7 @@ abstract class Doctrine_Cache_Driver implements Doctrine_Cache_Interface */ public function setOption($option, $value) { - if (isset($this->_options[$option])) { + if (isset($this->_options[$option])) { $this->_options[$option] = $value; return true; } diff --git a/lib/Doctrine/Collection.php b/lib/Doctrine/Collection.php index f702b39c9..d9303b559 100644 --- a/lib/Doctrine/Collection.php +++ b/lib/Doctrine/Collection.php @@ -113,7 +113,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator */ public function setData(array $data) { - $this->data = $data; + $this->data = $data; } /** * this method is automatically called when this Doctrine_Collection is serialized @@ -300,8 +300,8 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator */ public function get($key) { - if ($key === null || ! isset($this->data[$key])) { - $record = $this->_table->create(); + if ($key === null || ! isset($this->data[$key])) { + $record = $this->_table->create(); if (isset($this->referenceField)) { $value = $this->reference->get($this->relation->getLocal()); @@ -316,7 +316,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator $this->data[] = $record; return $record; - } + } return $this->data[$key]; } diff --git a/lib/Doctrine/Connection.php b/lib/Doctrine/Connection.php index de4c47e5a..ec9129b5e 100644 --- a/lib/Doctrine/Connection.php +++ b/lib/Doctrine/Connection.php @@ -163,7 +163,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ public function __construct(Doctrine_Manager $manager, $adapter, $user = null, $pass = null) { - if (is_object($adapter)) { + if (is_object($adapter)) { if ( ! ($adapter instanceof PDO) && ! in_array('Doctrine_Adapter_Interface', class_implements($adapter))) { throw new Doctrine_Connection_Exception('First argument should be an instance of PDO or implement Doctrine_Adapter_Interface'); } @@ -171,7 +171,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun $this->isConnected = true; - } elseif(is_array($adapter)) { + } elseif (is_array($adapter)) { $this->pendingAttributes[Doctrine::ATTR_DRIVER_NAME] = $adapter['scheme']; $this->options['dsn'] = $adapter['dsn']; @@ -196,12 +196,12 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun public function getAttribute($attribute) { - if ($attribute >= 100) { + if ($attribute >= 100) { if ( ! isset($this->attributes[$attribute])) { return $this->parent->getAttribute($attribute); } return $this->attributes[$attribute]; - } + } if ($this->isConnected) { try { @@ -235,9 +235,9 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ public function setAttribute($attribute, $value) { - if ($attribute >= 100) { + if ($attribute >= 100) { parent::setAttribute($attribute, $value); - } else { + } else { if ($this->isConnected) { $this->dbh->setAttribute($attribute, $value); } else { @@ -310,8 +310,8 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ public function getDbh() { - $this->connect(); - + $this->connect(); + return $this->dbh; } /** @@ -348,14 +348,14 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun if (class_exists($class)) { $this->dbh = new $class($this->options['dsn'], $this->options['username'], $this->options['password']); } else { - throw new Doctrine_Connection_Exception("Couldn't locate driver named " . $e[0]); + throw new Doctrine_Connection_Exception("Couldn't locate driver named " . $e[0]); } } // attach the pending attributes to adapter foreach($this->pendingAttributes as $attr => $value) { // some drivers don't support setting this so we just skip it - if($attr == Doctrine::ATTR_DRIVER_NAME) { + if ($attr == Doctrine::ATTR_DRIVER_NAME) { continue; } $this->dbh->setAttribute($attr, $value); @@ -540,7 +540,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ public function quoteIdentifier($str, $checkOption = true) { - // quick fix for the identifiers that contain a dot + // quick fix for the identifiers that contain a dot if (strpos($str, '.')) { $e = explode('.', $str); @@ -781,7 +781,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ public function execute($query, array $params = array()) { - $this->connect(); + $this->connect(); try { if ( ! empty($params)) { @@ -815,7 +815,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun * @return PDOStatement|Doctrine_Adapter_Statement */ public function exec($query, array $params = array()) { - $this->connect(); + $this->connect(); try { if ( ! empty($params)) { @@ -849,9 +849,9 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ public function rethrowException(Exception $e, $invoker) { - $event = new Doctrine_Event($this, Doctrine_Event::CONN_ERROR); + $event = new Doctrine_Event($this, Doctrine_Event::CONN_ERROR); - $this->getListener()->preError($event); + $this->getListener()->preError($event); $name = 'Doctrine_Connection_' . $this->driverName . '_Exception'; @@ -1011,7 +1011,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ public function close() { - $event = new Doctrine_Event($this, Doctrine_Event::CONN_CLOSE); + $event = new Doctrine_Event($this, Doctrine_Event::CONN_CLOSE); $this->getAttribute(Doctrine::ATTR_LISTENER)->preClose($event); @@ -1039,7 +1039,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ public function errorCode() { - $this->connect(); + $this->connect(); return $this->dbh->errorCode(); } @@ -1051,7 +1051,7 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun */ public function errorInfo() { - $this->connect(); + $this->connect(); return $this->dbh->errorInfo(); } diff --git a/lib/Doctrine/Connection/Common.php b/lib/Doctrine/Connection/Common.php index b5da453ff..8e3c64d6e 100644 --- a/lib/Doctrine/Connection/Common.php +++ b/lib/Doctrine/Connection/Common.php @@ -41,9 +41,9 @@ class Doctrine_Connection_Common extends Doctrine_Connection */ public function modifyLimitQuery($query, $limit = false,$offset = false,$isManip=false) { - $limit = (int) $limit; - $offset = (int) $offset; - + $limit = (int) $limit; + $offset = (int) $offset; + if ($limit && $offset) { $query .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; } elseif ($limit && ! $offset) { diff --git a/lib/Doctrine/Connection/Pgsql.php b/lib/Doctrine/Connection/Pgsql.php index 71a2930fe..8776f35a5 100644 --- a/lib/Doctrine/Connection/Pgsql.php +++ b/lib/Doctrine/Connection/Pgsql.php @@ -101,17 +101,17 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common */ public function convertBooleans($item) { - if (is_array($item)) { + if (is_array($item)) { foreach ($item as $key => $value) { if (is_bool($value)) { $item[$key] = ($value) ? 'true' : 'false'; } } - } else { - if (is_bool($item)) { - $item = ($item) ? 'true' : 'false'; - } - } + } else { + if (is_bool($item)) { + $item = ($item) ? 'true' : 'false'; + } + } return $item; } /** diff --git a/lib/Doctrine/Connection/Profiler.php b/lib/Doctrine/Connection/Profiler.php index 7e147df1a..c62868327 100644 --- a/lib/Doctrine/Connection/Profiler.php +++ b/lib/Doctrine/Connection/Profiler.php @@ -61,8 +61,8 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg * @return boolean */ public function setFilterQueryType() { - - } + + } /** * method overloader * this method is used for invoking different listeners, for the full @@ -85,7 +85,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg // pre-event listener found $a[0]->start(); - if( ! in_array($a[0], $this->events, true)) { + if ( ! in_array($a[0], $this->events, true)) { $this->events[] = $a[0]; } } else { @@ -126,7 +126,7 @@ class Doctrine_Connection_Profiler implements Doctrine_Overloadable, IteratorAgg */ public function getAll() { - return $this->events; + return $this->events; } /** * getIterator diff --git a/lib/Doctrine/Connection/Statement.php b/lib/Doctrine/Connection/Statement.php index 4528d980a..74c867527 100644 --- a/lib/Doctrine/Connection/Statement.php +++ b/lib/Doctrine/Connection/Statement.php @@ -89,7 +89,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf */ public function bindColumn($column, $param, $type = null) { - if($type === null) { + if ($type === null) { return $this->_stmt->bindColumn($column, $param); } else { return $this->_stmt->bindColumn($column, $param, $type); @@ -111,7 +111,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf */ public function bindValue($param, $value, $type = null) { - if($type === null) { + if ($type === null) { return $this->_stmt->bindValue($param, $value); } else { return $this->_stmt->bindValue($param, $value, $type); @@ -146,7 +146,7 @@ class Doctrine_Connection_Statement implements Doctrine_Adapter_Statement_Interf */ public function bindParam($column, $variable, $type = null, $length = null, $driverOptions = array()) { - if($type === null) { + if ($type === null) { return $this->_stmt->bindParam($column, $variable); } else { return $this->_stmt->bindParam($column, $variable, $type, $length, $driverOptions); diff --git a/lib/Doctrine/Connection/UnitOfWork.php b/lib/Doctrine/Connection/UnitOfWork.php index 2becf5ff3..c5762ca7e 100644 --- a/lib/Doctrine/Connection/UnitOfWork.php +++ b/lib/Doctrine/Connection/UnitOfWork.php @@ -139,7 +139,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module */ public function saveGraph(Doctrine_Record $record) { - $conn = $this->getConnection(); + $conn = $this->getConnection(); $state = $record->state(); if ($state === Doctrine_Record::STATE_LOCKED) { @@ -319,7 +319,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module $record = false; $ids = array(); - if (is_array($deletes[count($deletes)-1]->getTable()->getIdentifier())) { + if (is_array($deletes[count($deletes)-1]->getTable()->getIdentifier())) { if (count($deletes) > 0) { $query = 'DELETE FROM ' . $this->conn->quoteIdentifier($deletes[0]->getTable()->getTableName()) @@ -330,7 +330,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module foreach ($deletes as $k => $record) { $ids = $record->identifier(); $tmp = array(); - foreach (array_keys($ids) as $id){ + foreach (array_keys($ids) as $id) { $tmp[] = $id . ' = ? '; } $params = array_merge($params, array_values($ids)); @@ -340,22 +340,22 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module $this->conn->execute($query, $params); } - } else { - foreach ($deletes as $k => $record) { + } else { + foreach ($deletes as $k => $record) { $ids[] = $record->getIncremented(); - } - if ($record instanceof Doctrine_Record) { - $params = substr(str_repeat('?, ', count($ids)), 0, -2); + } + if ($record instanceof Doctrine_Record) { + $params = substr(str_repeat('?, ', count($ids)), 0, -2); - $query = 'DELETE FROM ' - . $this->conn->quoteIdentifier($record->getTable()->getTableName()) - . ' WHERE ' - . $record->getTable()->getIdentifier() - . ' IN(' . $params . ')'; + $query = 'DELETE FROM ' + . $this->conn->quoteIdentifier($record->getTable()->getTableName()) + . ' WHERE ' + . $record->getTable()->getIdentifier() + . ' IN(' . $params . ')'; - $this->conn->execute($query, $ids); - } - } + $this->conn->execute($query, $ids); + } + } } } /** @@ -450,7 +450,7 @@ class Doctrine_Connection_UnitOfWork extends Doctrine_Connection_Module $obj->state() != Doctrine_Record::STATE_LOCKED) { $obj->delete($this->conn); - + } break; } diff --git a/lib/Doctrine/DataDict.php b/lib/Doctrine/DataDict.php index 0875db928..21173910f 100644 --- a/lib/Doctrine/DataDict.php +++ b/lib/Doctrine/DataDict.php @@ -43,7 +43,7 @@ class Doctrine_DataDict extends Doctrine_Connection_Module { $type = !empty($current['type']) ? $current['type'] : null; - if (!method_exists($this, "_compare{$type}Definition")) { + if ( ! method_exists($this, "_compare{$type}Definition")) { throw new Doctrine_DataDict_Exception('type "'.$current['type'].'" is not yet supported'); } diff --git a/lib/Doctrine/DataDict/Firebird.php b/lib/Doctrine/DataDict/Firebird.php index 64d17ead3..5ab726bde 100644 --- a/lib/Doctrine/DataDict/Firebird.php +++ b/lib/Doctrine/DataDict/Firebird.php @@ -57,9 +57,9 @@ class Doctrine_DataDict_Firebird extends Doctrine_DataDict */ public function getNativeDeclaration($field) { - if ( ! isset($field['type'])) { + if ( ! isset($field['type'])) { throw new Doctrine_DataDict_Exception('Missing column type.'); - } + } switch ($field['type']) { case 'varchar': case 'string': diff --git a/lib/Doctrine/DataDict/Informix.php b/lib/Doctrine/DataDict/Informix.php index d5e086132..29b6faff6 100644 --- a/lib/Doctrine/DataDict/Informix.php +++ b/lib/Doctrine/DataDict/Informix.php @@ -56,9 +56,9 @@ class Doctrine_DataDict_Informix extends Doctrine_DataDict */ public function getNativeDeclaration($field) { - if ( ! isset($field['type'])) { + if ( ! isset($field['type'])) { throw new Doctrine_DataDict_Exception('Missing column type.'); - } + } switch ($field['type']) { case 'char': case 'varchar': @@ -69,7 +69,7 @@ class Doctrine_DataDict_Informix extends Doctrine_DataDict $field['length'] = $this->conn->varchar_max_length; } - $length = (! empty($field['length'])) ? $field['length'] : false; + $length = ( ! empty($field['length'])) ? $field['length'] : false; $fixed = ((isset($field['fixed']) && $field['fixed']) || $field['type'] == 'char') ? true : false; return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR(255)') @@ -79,7 +79,7 @@ class Doctrine_DataDict_Informix extends Doctrine_DataDict case 'blob': return 'BLOB'; case 'integer': - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { $length = $field['length']; if ($length <= 1) { return 'SMALLINT'; diff --git a/lib/Doctrine/DataDict/Mssql.php b/lib/Doctrine/DataDict/Mssql.php index bbdc37e26..542785f40 100644 --- a/lib/Doctrine/DataDict/Mssql.php +++ b/lib/Doctrine/DataDict/Mssql.php @@ -59,9 +59,9 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict */ public function getNativeDeclaration($field) { - if ( ! isset($field['type'])) { + if ( ! isset($field['type'])) { throw new Doctrine_DataDict_Exception('Missing column type.'); - } + } switch ($field['type']) { case 'array': case 'object': @@ -78,7 +78,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$this->conn->options['default_text_field_length'].')') : ($length ? 'VARCHAR('.$length.')' : 'TEXT'); case 'clob': - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { $length = $field['length']; if ($length <= 8000) { return 'VARCHAR('.$length.')'; @@ -86,7 +86,7 @@ class Doctrine_DataDict_Mssql extends Doctrine_DataDict } return 'TEXT'; case 'blob': - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { $length = $field['length']; if ($length <= 8000) { return "VARBINARY($length)"; diff --git a/lib/Doctrine/DataDict/Mysql.php b/lib/Doctrine/DataDict/Mysql.php index 7ca6f6f23..7123f3998 100644 --- a/lib/Doctrine/DataDict/Mysql.php +++ b/lib/Doctrine/DataDict/Mysql.php @@ -140,7 +140,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict switch ($field['type']) { case 'char': - $length = (! empty($field['length'])) ? $field['length'] : false; + $length = ( ! empty($field['length'])) ? $field['length'] : false; return $length ? 'CHAR('.$length.')' : 'CHAR(255)'; case 'varchar': @@ -162,7 +162,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)') : ($length ? 'VARCHAR(' . $length . ')' : 'TEXT'); case 'clob': - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { $length = $field['length']; if ($length <= 255) { return 'TINYTEXT'; @@ -174,7 +174,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict } return 'LONGTEXT'; case 'blob': - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { $length = $field['length']; if ($length <= 255) { return 'TINYBLOB'; @@ -196,7 +196,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict // fall back to integer case 'integer': case 'int': - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { $length = $field['length']; if ($length <= 1) { return 'TINYINT'; @@ -439,7 +439,7 @@ class Doctrine_DataDict_Mysql extends Doctrine_DataDict public function getIntegerDeclaration($name, $field) { $default = $autoinc = ''; - if (!empty($field['autoincrement'])) { + if ( ! empty($field['autoincrement'])) { $autoinc = ' AUTO_INCREMENT'; } elseif (array_key_exists('default', $field)) { if ($field['default'] === '') { diff --git a/lib/Doctrine/DataDict/Oracle.php b/lib/Doctrine/DataDict/Oracle.php index dc01fede1..cbc68f15c 100644 --- a/lib/Doctrine/DataDict/Oracle.php +++ b/lib/Doctrine/DataDict/Oracle.php @@ -55,9 +55,9 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict */ public function getNativeDeclaration(array $field) { - if ( ! isset($field['type'])) { + if ( ! isset($field['type'])) { throw new Doctrine_DataDict_Exception('Missing column type.'); - } + } switch ($field['type']) { case 'string': case 'array': @@ -78,7 +78,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict case 'integer': case 'enum': case 'int': - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { return 'NUMBER('.$field['length'].')'; } return 'INT'; @@ -110,7 +110,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict $dbType = strtolower($field['type']); $type = array(); $length = $unsigned = $fixed = null; - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { $length = $field['length']; } @@ -156,7 +156,7 @@ class Doctrine_DataDict_Oracle extends Doctrine_DataDict $type[] = 'float'; break; case 'number': - if (!empty($field['scale'])) { + if ( ! empty($field['scale'])) { $type[] = 'decimal'; } else { $type[] = 'integer'; diff --git a/lib/Doctrine/DataDict/Pgsql.php b/lib/Doctrine/DataDict/Pgsql.php index 3f1aaf492..e5420b52f 100644 --- a/lib/Doctrine/DataDict/Pgsql.php +++ b/lib/Doctrine/DataDict/Pgsql.php @@ -360,9 +360,9 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict */ public function getNativeDeclaration(array $field) { - if ( ! isset($field['type'])) { + if ( ! isset($field['type'])) { throw new Doctrine_DataDict_Exception('Missing column type.'); - } + } switch ($field['type']) { case 'char': case 'string': @@ -385,8 +385,8 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict case 'enum': case 'integer': case 'int': - if (!empty($field['autoincrement'])) { - if (!empty($field['length'])) { + if ( ! empty($field['autoincrement'])) { + if ( ! empty($field['length'])) { $length = $field['length']; if ($length > 4) { return 'BIGSERIAL'; @@ -394,7 +394,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict } return 'SERIAL'; } - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { $length = $field['length']; if ($length <= 2) { return 'SMALLINT'; @@ -578,7 +578,7 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict public function getIntegerDeclaration($name, $field) { /** - if (!empty($field['unsigned'])) { + if ( ! empty($field['unsigned'])) { $this->conn->warnings[] = "unsigned integer field \"$name\" is being declared as signed integer"; } */ diff --git a/lib/Doctrine/DataDict/Sqlite.php b/lib/Doctrine/DataDict/Sqlite.php index 1f774313b..81af656fe 100644 --- a/lib/Doctrine/DataDict/Sqlite.php +++ b/lib/Doctrine/DataDict/Sqlite.php @@ -57,9 +57,9 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict */ public function getNativeDeclaration(array $field) { - if ( ! isset($field['type'])) { + if ( ! isset($field['type'])) { throw new Doctrine_DataDict_Exception('Missing column type.'); - } + } switch ($field['type']) { case 'text': case 'object': @@ -75,7 +75,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict return $fixed ? ($length ? 'CHAR('.$length.')' : 'CHAR('.$this->conn->getAttribute(Doctrine::ATTR_DEFAULT_TEXTFLD_LENGTH).')') : ($length ? 'VARCHAR('.$length.')' : 'TEXT'); case 'clob': - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { $length = $field['length']; if ($length <= 255) { return 'TINYTEXT'; @@ -87,7 +87,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict } return 'LONGTEXT'; case 'blob': - if (!empty($field['length'])) { + if ( ! empty($field['length'])) { $length = $field['length']; if ($length <= 255) { return 'TINYBLOB'; @@ -274,7 +274,7 @@ class Doctrine_DataDict_Sqlite extends Doctrine_DataDict $autoincrement = isset($field['autoincrement']) && $field['autoincrement']; - if ($autoincrement){ + if ($autoincrement) { $autoinc = ' PRIMARY KEY AUTOINCREMENT'; $type = 'INTEGER'; } elseif (array_key_exists('default', $field)) { diff --git a/lib/Doctrine/DataType.php b/lib/Doctrine/DataType.php index 4ae0e96e2..8d6a081fe 100644 --- a/lib/Doctrine/DataType.php +++ b/lib/Doctrine/DataType.php @@ -34,16 +34,16 @@ class Doctrine_DataType { public function __construct() { - + } public function getName() { - + } public function getDefaultLength() { - + } } diff --git a/lib/Doctrine/Export.php b/lib/Doctrine/Export.php index dc6dbd764..84ecdc91d 100644 --- a/lib/Doctrine/Export.php +++ b/lib/Doctrine/Export.php @@ -264,7 +264,7 @@ class Doctrine_Export extends Doctrine_Connection_Module */ public function createTable($name, array $fields, array $options = array()) { - $sql = (array) $this->createTableSql($name, $fields, $options); + $sql = (array) $this->createTableSql($name, $fields, $options); foreach ($sql as $query) { $this->conn->execute($query); @@ -423,7 +423,7 @@ class Doctrine_Export extends Doctrine_Connection_Module $name = $this->conn->quoteIdentifier($name); $type = ''; - if(isset($definition['type'])) { + if (isset($definition['type'])) { switch (strtolower($definition['type'])) { case 'unique': $type = strtoupper($definition['type']) . ' '; @@ -760,9 +760,9 @@ class Doctrine_Export extends Doctrine_Connection_Module */ public function getIndexFieldDeclarationList(array $fields) { - $ret = array(); + $ret = array(); foreach ($fields as $field => $definition) { - if(is_array($definition)) { + if (is_array($definition)) { $ret[] = $this->conn->quoteIdentifier($field); } else { $ret[] = $this->conn->quoteIdentifier($definition); @@ -868,7 +868,7 @@ class Doctrine_Export extends Doctrine_Connection_Module */ public function getForeignKeyReferentialAction($action) { - $upper = strtoupper($action); + $upper = strtoupper($action); switch ($upper) { case 'CASCADE': case 'SET NULL': @@ -891,7 +891,7 @@ class Doctrine_Export extends Doctrine_Connection_Module */ public function getForeignKeyBaseDeclaration(array $definition) { - $sql = ''; + $sql = ''; if (isset($definition['name'])) { $sql .= 'CONSTRAINT ' . $this->conn->quoteIdentifier($definition['name']) . ' '; } @@ -982,7 +982,7 @@ class Doctrine_Export extends Doctrine_Connection_Module $this->conn->exec($query); } catch (Doctrine_Connection_Exception $e) { // we only want to silence table already exists errors - if($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { + if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { $this->conn->rollback(); throw $e; } @@ -1010,7 +1010,7 @@ class Doctrine_Export extends Doctrine_Connection_Module $this->conn->exec($query); } catch (Doctrine_Connection_Exception $e) { // we only want to silence table already exists errors - if($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { + if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { $this->conn->rollback(); throw $e; } @@ -1093,10 +1093,10 @@ class Doctrine_Export extends Doctrine_Connection_Module */ public function exportSql($directory = null) { - $declared = get_declared_classes(); + $declared = get_declared_classes(); - if ($directory !== null) { - foreach ((array) $directory as $dir) { + if ($directory !== null) { + foreach ((array) $directory as $dir) { $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY); @@ -1123,8 +1123,8 @@ class Doctrine_Export extends Doctrine_Connection_Module */ public function exportTable(Doctrine_Table $table) { - /** - TODO: maybe there should be portability option for the following check + /** + TODO: maybe there should be portability option for the following check if ( ! Doctrine::isValidClassname($table->getOption('declaringClass')->getName())) { throw new Doctrine_Export_Exception('Class name not valid.'); } @@ -1136,7 +1136,7 @@ class Doctrine_Export extends Doctrine_Connection_Module $this->conn->export->createTable($data['tableName'], $data['columns'], $data['options']); } catch(Doctrine_Connection_Exception $e) { // we only want to silence table already exists errors - if($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { + if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) { throw $e; } } diff --git a/lib/Doctrine/Export/Firebird.php b/lib/Doctrine/Export/Firebird.php index 78bc8de17..d69f5d602 100644 --- a/lib/Doctrine/Export/Firebird.php +++ b/lib/Doctrine/Export/Firebird.php @@ -321,7 +321,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export return true; } $query = ''; - if (!empty($changes['add']) && is_array($changes['add'])) { + if ( ! empty($changes['add']) && is_array($changes['add'])) { foreach ($changes['add'] as $fieldName => $field) { if ($query) { $query.= ', '; @@ -330,7 +330,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export } } - if (!empty($changes['remove']) && is_array($changes['remove'])) { + if ( ! empty($changes['remove']) && is_array($changes['remove'])) { foreach ($changes['remove'] as $field_name => $field) { if ($query) { $query.= ', '; @@ -340,7 +340,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export } } - if (!empty($changes['rename']) && is_array($changes['rename'])) { + if ( ! empty($changes['rename']) && is_array($changes['rename'])) { foreach ($changes['rename'] as $field_name => $field) { if ($query) { $query.= ', '; @@ -350,7 +350,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export } } - if (!empty($changes['change']) && is_array($changes['change'])) { + if ( ! empty($changes['change']) && is_array($changes['change'])) { // missing support to change DEFAULT and NULLability foreach ($changes['change'] as $fieldName => $field) { $this->checkSupportedChanges($field); @@ -363,7 +363,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export } } - if (!strlen($query)) { + if ( ! strlen($query)) { return false; } @@ -409,7 +409,7 @@ class Doctrine_Export_Firebird extends Doctrine_Export $query_sort = ''; foreach ($definition['fields'] as $field) { - if (!strcmp($query_sort, '') && isset($field['sorting'])) { + if ( ! strcmp($query_sort, '') && isset($field['sorting'])) { switch ($field['sorting']) { case 'ascending': $query_sort = ' ASC'; @@ -456,18 +456,18 @@ class Doctrine_Export_Firebird extends Doctrine_Export { $table = $this->conn->quoteIdentifier($table, true); - if (!empty($name)) { + if ( ! empty($name)) { $name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name), true); } $query = "ALTER TABLE $table ADD"; - if (!empty($definition['primary'])) { - if (!empty($name)) { + if ( ! empty($definition['primary'])) { + if ( ! empty($name)) { $query.= ' CONSTRAINT '.$name; } $query.= ' PRIMARY KEY'; } else { $query.= ' CONSTRAINT '. $name; - if (!empty($definition['unique'])) { + if ( ! empty($definition['unique'])) { $query.= ' UNIQUE'; } } diff --git a/lib/Doctrine/Export/Frontbase.php b/lib/Doctrine/Export/Frontbase.php index 166208d53..1c54b7bc9 100644 --- a/lib/Doctrine/Export/Frontbase.php +++ b/lib/Doctrine/Export/Frontbase.php @@ -159,7 +159,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export */ public function alterTable($name, array $changes, $check) { - foreach ($changes as $changeName => $change){ + foreach ($changes as $changeName => $change) { switch ($changeName) { case 'add': case 'remove': @@ -177,12 +177,12 @@ class Doctrine_Export_Frontbase extends Doctrine_Export } $query = ''; - if (!empty($changes['name'])) { + if ( ! empty($changes['name'])) { $changeName = $this->conn->quoteIdentifier($changes['name'], true); $query .= 'RENAME TO ' . $changeName; } - if (!empty($changes['add']) && is_array($changes['add'])) { + if ( ! empty($changes['add']) && is_array($changes['add'])) { foreach ($changes['add'] as $fieldName => $field) { if ($query) { $query.= ', '; @@ -191,7 +191,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export } } - if (!empty($changes['remove']) && is_array($changes['remove'])) { + if ( ! empty($changes['remove']) && is_array($changes['remove'])) { foreach ($changes['remove'] as $fieldName => $field) { if ($query) { $query.= ', '; @@ -202,13 +202,13 @@ class Doctrine_Export_Frontbase extends Doctrine_Export } $rename = array(); - if (!empty($changes['rename']) && is_array($changes['rename'])) { + if ( ! empty($changes['rename']) && is_array($changes['rename'])) { foreach ($changes['rename'] as $fieldName => $field) { $rename[$field['name']] = $fieldName; } } - if (!empty($changes['change']) && is_array($changes['change'])) { + if ( ! empty($changes['change']) && is_array($changes['change'])) { foreach ($changes['change'] as $fieldName => $field) { if ($query) { $query.= ', '; @@ -224,7 +224,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export } } - if (!empty($rename) && is_array($rename)) { + if ( ! empty($rename) && is_array($rename)) { foreach ($rename as $renamedFieldName => $renamed_field) { if ($query) { $query.= ', '; @@ -235,7 +235,7 @@ class Doctrine_Export_Frontbase extends Doctrine_Export } } - if (!$query) { + if ( ! $query) { return true; } diff --git a/lib/Doctrine/Export/Mysql.php b/lib/Doctrine/Export/Mysql.php index 610fa5712..bd2d84f4d 100644 --- a/lib/Doctrine/Export/Mysql.php +++ b/lib/Doctrine/Export/Mysql.php @@ -164,7 +164,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export $optionStrings[] = 'ENGINE = ' . $type; } - if (!empty($optionStrings)) { + if ( ! empty($optionStrings)) { $query.= ' '.implode(' ', $optionStrings); } $sql[] = $query; @@ -524,7 +524,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export { $name = $this->conn->quoteIdentifier($name); $type = ''; - if(isset($definition['type'])) { + if (isset($definition['type'])) { switch (strtolower($definition['type'])) { case 'fulltext': case 'unique': @@ -557,7 +557,7 @@ class Doctrine_Export_Mysql extends Doctrine_Export */ public function getIndexFieldDeclarationList(array $fields) { - $declFields = array(); + $declFields = array(); foreach ($fields as $fieldName => $field) { $fieldString = $fieldName; @@ -596,13 +596,13 @@ class Doctrine_Export_Mysql extends Doctrine_Export public function getAdvancedForeignKeyOptions(array $definition) { $query = ''; - if (!empty($definition['match'])) { + if ( ! empty($definition['match'])) { $query .= ' MATCH ' . $definition['match']; } - if (!empty($definition['onUpdate'])) { + if ( ! empty($definition['onUpdate'])) { $query .= ' ON UPDATE ' . $this->getForeignKeyReferentialAction($definition['onUpdate']); } - if (!empty($definition['onDelete'])) { + if ( ! empty($definition['onDelete'])) { $query .= ' ON DELETE ' . $this->getForeignKeyReferentialAction($definition['onDelete']); } return $query; diff --git a/lib/Doctrine/Export/Oracle.php b/lib/Doctrine/Export/Oracle.php index 8b596484c..673fea461 100644 --- a/lib/Doctrine/Export/Oracle.php +++ b/lib/Doctrine/Export/Oracle.php @@ -93,7 +93,7 @@ class Doctrine_Export_Oracle extends Doctrine_Export */ public function _makeAutoincrement($name, $table, $start = 1) { - $sql = array(); + $sql = array(); $table = strtoupper($table); $indexName = $table . '_AI_PK'; $definition = array( diff --git a/lib/Doctrine/Export/Pgsql.php b/lib/Doctrine/Export/Pgsql.php index 2ebfbf552..29d332e7d 100644 --- a/lib/Doctrine/Export/Pgsql.php +++ b/lib/Doctrine/Export/Pgsql.php @@ -232,7 +232,7 @@ class Doctrine_Export_Pgsql extends Doctrine_Export $query = 'ALTER ' . $fieldName . ' SET DEFAULT ' . $this->conn->quote($field['definition']['default'], $field['definition']['type']); $this->conn->exec('ALTER TABLE ' . $name . ' ' . $query); } - if (!empty($field['notnull'])) { + if ( ! empty($field['notnull'])) { $query = 'ALTER ' . $fieldName . ' ' . ($field['definition']['notnull'] ? 'SET' : 'DROP') . ' NOT NULL'; $this->conn->exec('ALTER TABLE ' . $name . ' ' . $query); } diff --git a/lib/Doctrine/Export/Sqlite.php b/lib/Doctrine/Export/Sqlite.php index dedeab085..e67bafba8 100644 --- a/lib/Doctrine/Export/Sqlite.php +++ b/lib/Doctrine/Export/Sqlite.php @@ -44,7 +44,7 @@ class Doctrine_Export_Sqlite extends Doctrine_Export public function dropDatabase($name) { $databaseFile = $this->conn->getDatabaseFile($name); - if (!@file_exists($databaseFile)) { + if ( ! @file_exists($databaseFile)) { throw new Doctrine_Export_Exception('database does not exist'); } $result = @unlink($databaseFile); @@ -103,7 +103,7 @@ class Doctrine_Export_Sqlite extends Doctrine_Export */ public function getIndexFieldDeclarationList(array $fields) { - $declFields = array(); + $declFields = array(); foreach ($fields as $fieldName => $field) { $fieldString = $fieldName; @@ -168,7 +168,7 @@ class Doctrine_Export_Sqlite extends Doctrine_Export $autoinc = false; foreach($fields as $field) { - if(isset($field['autoincrement']) && $field['autoincrement'] || + if (isset($field['autoincrement']) && $field['autoincrement'] || (isset($field['autoinc']) && $field['autoinc'])) { $autoinc = true; break; diff --git a/lib/Doctrine/Expression.php b/lib/Doctrine/Expression.php index 2f429b219..d3c72b725 100644 --- a/lib/Doctrine/Expression.php +++ b/lib/Doctrine/Expression.php @@ -80,7 +80,7 @@ class Doctrine_Expression public function parseClause($clause) { - $e = Doctrine_Tokenizer::bracketExplode($clause, ' '); + $e = Doctrine_Tokenizer::bracketExplode($clause, ' '); foreach ($e as $k => $expr) { $e[$k] = $this->parseExpression($expr); diff --git a/lib/Doctrine/Expression/Driver.php b/lib/Doctrine/Expression/Driver.php index 4bc9de46c..dd35438ba 100644 --- a/lib/Doctrine/Expression/Driver.php +++ b/lib/Doctrine/Expression/Driver.php @@ -296,7 +296,7 @@ class Doctrine_Expression_Driver extends Doctrine_Connection_Module */ public function concat() { - $args = func_get_args(); + $args = func_get_args(); return 'CONCAT(' . join(', ', (array) $args) . ')'; } @@ -703,7 +703,7 @@ class Doctrine_Expression_Driver extends Doctrine_Connection_Module */ public function __call($m, $a) { - if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_EXPR) { + if ($this->conn->getAttribute(Doctrine::ATTR_PORTABILITY) & Doctrine::PORTABILITY_EXPR) { throw new Doctrine_Expression_Exception('Unknown expression ' . $m); } return $m . '(' . implode(', ', $a) . ')'; diff --git a/lib/Doctrine/Expression/Mysql.php b/lib/Doctrine/Expression/Mysql.php index 136ac0986..332612069 100644 --- a/lib/Doctrine/Expression/Mysql.php +++ b/lib/Doctrine/Expression/Mysql.php @@ -70,7 +70,7 @@ class Doctrine_Expression_Mysql extends Doctrine_Expression_Driver public function matchPattern($pattern, $operator = null, $field = null) { $match = ''; - if (!is_null($operator)) { + if ( ! is_null($operator)) { $field = is_null($field) ? '' : $field.' '; $operator = strtoupper($operator); switch ($operator) { diff --git a/lib/Doctrine/Expression/Pgsql.php b/lib/Doctrine/Expression/Pgsql.php index 0642120d3..c794df45f 100644 --- a/lib/Doctrine/Expression/Pgsql.php +++ b/lib/Doctrine/Expression/Pgsql.php @@ -1,97 +1,97 @@ -. - */ -Doctrine::autoload('Doctrine_Expression_Driver'); -/** - * Doctrine_Expression_Pgsql - * - * @package Doctrine - * @license http://www.opensource.org/licenses/lgpl-license.php LGPL - * @category Object Relational Mapping - * @link www.phpdoctrine.com - * @since 1.0 - * @version $Revision$ - * @author Konsta Vesterinen - */ -class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver -{ - /** - * Returns the md5 sum of a field. - * - * Note: Not SQL92, but common functionality - * - * md5() works with the default PostgreSQL 8 versions. - * - * If you are using PostgreSQL 7.x or older you need - * to make sure that the digest procedure is installed. - * If you use RPMS (Redhat and Mandrake) install the postgresql-contrib - * package. You must then install the procedure by running this shell command: - * - * psql [dbname] < /usr/share/pgsql/contrib/pgcrypto.sql - * - * You should make sure you run this as the postgres user. - * - * @return string - */ - public function md5($column) - { - $column = $this->getIdentifier($column); - - if ($this->version > 7) { - return 'MD5(' . $column . ')'; - } else { - return 'encode(digest(' . $column .', md5), hex)'; - } - } - - /** - * Returns part of a string. - * - * Note: Not SQL92, but common functionality. - * - * @param string $value the target $value the string or the string column. - * @param int $from extract from this characeter. - * @param int $len extract this amount of characters. - * @return string sql that extracts part of a string. - */ - public function substring($value, $from, $len = null) - { - $value = $this->getIdentifier($value); - - if ($len === null) { - $len = $this->getIdentifier($len); - return 'SUBSTR(' . $value . ', ' . $from . ')'; - } else { - return 'SUBSTR(' . $value . ', ' . $from . ', ' . $len . ')'; - } - } - - /** - * Returns a series of strings concatinated - * - * concat() accepts an arbitrary number of parameters. Each parameter - * must contain an expression or an array with expressions. - * - * @param string|array(string) strings that will be concatinated. - * @return string - */ +. + */ +Doctrine::autoload('Doctrine_Expression_Driver'); +/** + * Doctrine_Expression_Pgsql + * + * @package Doctrine + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + * @author Konsta Vesterinen + */ +class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver +{ + /** + * Returns the md5 sum of a field. + * + * Note: Not SQL92, but common functionality + * + * md5() works with the default PostgreSQL 8 versions. + * + * If you are using PostgreSQL 7.x or older you need + * to make sure that the digest procedure is installed. + * If you use RPMS (Redhat and Mandrake) install the postgresql-contrib + * package. You must then install the procedure by running this shell command: + * + * psql [dbname] < /usr/share/pgsql/contrib/pgcrypto.sql + * + * You should make sure you run this as the postgres user. + * + * @return string + */ + public function md5($column) + { + $column = $this->getIdentifier($column); + + if ($this->version > 7) { + return 'MD5(' . $column . ')'; + } else { + return 'encode(digest(' . $column .', md5), hex)'; + } + } + + /** + * Returns part of a string. + * + * Note: Not SQL92, but common functionality. + * + * @param string $value the target $value the string or the string column. + * @param int $from extract from this characeter. + * @param int $len extract this amount of characters. + * @return string sql that extracts part of a string. + */ + public function substring($value, $from, $len = null) + { + $value = $this->getIdentifier($value); + + if ($len === null) { + $len = $this->getIdentifier($len); + return 'SUBSTR(' . $value . ', ' . $from . ')'; + } else { + return 'SUBSTR(' . $value . ', ' . $from . ', ' . $len . ')'; + } + } + + /** + * Returns a series of strings concatinated + * + * concat() accepts an arbitrary number of parameters. Each parameter + * must contain an expression or an array with expressions. + * + * @param string|array(string) strings that will be concatinated. + * @return string + */ /** @@ -102,10 +102,10 @@ class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver * @return string */ public function age($timestamp1, $timestamp2 = null) { - if( $timestamp2 == null ) { - return 'AGE(' . $timestamp1 . ')'; - } - return 'AGE(' . $timestamp1 . ', ' . $timestamp2 . ')'; + if ( $timestamp2 == null ) { + return 'AGE(' . $timestamp1 . ')'; + } + return 'AGE(' . $timestamp1 . ', ' . $timestamp2 . ')'; } /** @@ -116,90 +116,90 @@ class Doctrine_Expression_Pgsql extends Doctrine_Expression_Driver * @return string */ public function date_part($text, $time) { - return 'DATE_PART(' . $text . ', ' . $time . ')'; + return 'DATE_PART(' . $text . ', ' . $time . ')'; } - public function concat() - { - $args = func_get_args(); - - return join(' || ' , $args); - } - /** - * Returns the SQL string to return the current system date and time. - * - * @return string - */ - public function now() - { - return 'LOCALTIMESTAMP(0)'; - } - /** - * regexp - * - * @return string the regular expression operator - */ - public function regexp() - { - return 'SIMILAR TO'; - } - /** - * return string to call a function to get random value inside an SQL statement - * - * @return return string to generate float between 0 and 1 - * @access public - */ - public function random() - { - return 'RANDOM()'; - } - /** - * build a pattern matching string - * - * EXPERIMENTAL - * - * WARNING: this function is experimental and may change signature at - * any time until labelled as non-experimental - * - * @access public - * - * @param array $pattern even keys are strings, odd are patterns (% and _) - * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future) - * @param string $field optional field name that is being matched against - * (might be required when emulating ILIKE) - * - * @return string SQL pattern - */ - public function matchPattern($pattern, $operator = null, $field = null) - { - $match = ''; - if (!is_null($operator)) { - $field = is_null($field) ? '' : $field.' '; - $operator = strtoupper($operator); - switch ($operator) { - // case insensitive - case 'ILIKE': - $match = $field.'ILIKE '; - break; - // case sensitive - case 'LIKE': - $match = $field.'LIKE '; - break; - default: - throw new Doctrine_Expression_Pgsql_Exception('not a supported operator type:'. $operator); - } - } - $match.= "'"; - foreach ($pattern as $key => $value) { - if ($key % 2) { - $match.= $value; - } else { - $match.= $this->conn->escapePattern($this->conn->escape($value)); - } - } - $match.= "'"; - $match.= $this->patternEscapeString(); - return $match; - } -} + public function concat() + { + $args = func_get_args(); + + return join(' || ' , $args); + } + /** + * Returns the SQL string to return the current system date and time. + * + * @return string + */ + public function now() + { + return 'LOCALTIMESTAMP(0)'; + } + /** + * regexp + * + * @return string the regular expression operator + */ + public function regexp() + { + return 'SIMILAR TO'; + } + /** + * return string to call a function to get random value inside an SQL statement + * + * @return return string to generate float between 0 and 1 + * @access public + */ + public function random() + { + return 'RANDOM()'; + } + /** + * build a pattern matching string + * + * EXPERIMENTAL + * + * WARNING: this function is experimental and may change signature at + * any time until labelled as non-experimental + * + * @access public + * + * @param array $pattern even keys are strings, odd are patterns (% and _) + * @param string $operator optional pattern operator (LIKE, ILIKE and maybe others in the future) + * @param string $field optional field name that is being matched against + * (might be required when emulating ILIKE) + * + * @return string SQL pattern + */ + public function matchPattern($pattern, $operator = null, $field = null) + { + $match = ''; + if ( ! is_null($operator)) { + $field = is_null($field) ? '' : $field.' '; + $operator = strtoupper($operator); + switch ($operator) { + // case insensitive + case 'ILIKE': + $match = $field.'ILIKE '; + break; + // case sensitive + case 'LIKE': + $match = $field.'LIKE '; + break; + default: + throw new Doctrine_Expression_Pgsql_Exception('not a supported operator type:'. $operator); + } + } + $match.= "'"; + foreach ($pattern as $key => $value) { + if ($key % 2) { + $match.= $value; + } else { + $match.= $this->conn->escapePattern($this->conn->escape($value)); + } + } + $match.= "'"; + $match.= $this->patternEscapeString(); + return $match; + } +} diff --git a/lib/Doctrine/Formatter.php b/lib/Doctrine/Formatter.php index 3225eb950..78d1b60a3 100644 --- a/lib/Doctrine/Formatter.php +++ b/lib/Doctrine/Formatter.php @@ -71,7 +71,7 @@ class Doctrine_Formatter extends Doctrine_Connection_Module */ public function convertBooleans($item) { - if (is_array($item)) { + if (is_array($item)) { foreach ($item as $k => $value) { if (is_bool($value)) { $item[$k] = (int) $value; diff --git a/lib/Doctrine/Hook.php b/lib/Doctrine/Hook.php index b1c89ebe7..21bb1f89e 100644 --- a/lib/Doctrine/Hook.php +++ b/lib/Doctrine/Hook.php @@ -81,7 +81,7 @@ class Doctrine_Hook } elseif ($query instanceof Doctrine_Query) { $this->query = $query; } else { - throw new Doctrine_Exception('Constructor argument should be either Doctrine_Query object or valid DQL query'); + throw new Doctrine_Exception('Constructor argument should be either Doctrine_Query object or valid DQL query'); } $this->query->getQuery(); diff --git a/lib/Doctrine/Hydrate.php b/lib/Doctrine/Hydrate.php index b1686fd01..8fb7165d5 100644 --- a/lib/Doctrine/Hydrate.php +++ b/lib/Doctrine/Hydrate.php @@ -184,7 +184,7 @@ class Doctrine_Hydrate extends Doctrine_Object implements Serializable */ public function getRootAlias() { - if (!$this->_aliasMap) { + if ( ! $this->_aliasMap) { $this->getSql(); } diff --git a/lib/Doctrine/Hydrate/Array.php b/lib/Doctrine/Hydrate/Array.php index 729da107e..02b8eb50a 100644 --- a/lib/Doctrine/Hydrate/Array.php +++ b/lib/Doctrine/Hydrate/Array.php @@ -51,14 +51,14 @@ class Doctrine_Hydrate_Array } public function initRelated(array &$data, $name) { - if ( ! isset($data[$name])) { + if ( ! isset($data[$name])) { $data[$name] = array(); } return true; } public function getNullPointer() { - return null; + return null; } public function search(array $element, array $data) { @@ -77,6 +77,6 @@ class Doctrine_Hydrate_Array } public function flush() { - + } } diff --git a/lib/Doctrine/Hydrate/Record.php b/lib/Doctrine/Hydrate/Record.php index 40377efac..5403d9c3d 100644 --- a/lib/Doctrine/Hydrate/Record.php +++ b/lib/Doctrine/Hydrate/Record.php @@ -52,7 +52,7 @@ class Doctrine_Hydrate_Record extends Doctrine_Object } public function initRelated($record, $name) { - if ( ! is_array($record)) { + if ( ! is_array($record)) { $record[$name]; return true; @@ -74,7 +74,7 @@ class Doctrine_Hydrate_Record extends Doctrine_Object */ public function isIdentifiable(array $row, Doctrine_Table $table) { - $primaryKeys = $table->getIdentifier(); + $primaryKeys = $table->getIdentifier(); if (is_array($primaryKeys)) { foreach ($primaryKeys as $id) { @@ -95,7 +95,7 @@ class Doctrine_Hydrate_Record extends Doctrine_Object } public function getElement(array $data, $component) { - if ( ! isset($this->_tables[$component])) { + if ( ! isset($this->_tables[$component])) { $this->_tables[$component] = Doctrine_Manager::getInstance()->getTable($component); $this->_tables[$component]->setAttribute(Doctrine::ATTR_LOAD_REFERENCES, false); } diff --git a/lib/Doctrine/Import/Builder.php b/lib/Doctrine/Import/Builder.php index 294d49795..a3c395698 100644 --- a/lib/Doctrine/Import/Builder.php +++ b/lib/Doctrine/Import/Builder.php @@ -165,8 +165,8 @@ END; } public function buildRelationDefinition(array $relations) { - $ret = array(); - $i = 0; + $ret = array(); + $i = 0; foreach ($relations as $name => $relation) { $alias = (isset($relation['alias']) && $relation['alias'] !== $name) ? ' as ' . $relation['alias'] : ''; @@ -211,9 +211,9 @@ END; public function buildDefinition(array $options, array $columns, array $relations = array()) { - if ( ! isset($options['className'])) { - throw new Doctrine_Import_Builder_Exception('Missing class name.'); - } + if ( ! isset($options['className'])) { + throw new Doctrine_Import_Builder_Exception('Missing class name.'); + } //$opt = array(0 => str_repeat(' ', 8) . '$this->setTableName(\''. $table .'\');'); @@ -226,9 +226,9 @@ END; public function buildRecord($options, $columns, $relations) { - if ( ! isset($options['className'])) { - throw new Doctrine_Import_Builder_Exception('Missing class name.'); - } + if ( ! isset($options['className'])) { + throw new Doctrine_Import_Builder_Exception('Missing class name.'); + } if ( ! isset($options['fileName'])) { if (empty($this->path)) { diff --git a/lib/Doctrine/Import/Informix.php b/lib/Doctrine/Import/Informix.php index 0ccf348fa..60056554b 100644 --- a/lib/Doctrine/Import/Informix.php +++ b/lib/Doctrine/Import/Informix.php @@ -31,16 +31,16 @@ Doctrine::autoload('Doctrine_Import'); */ class Doctrine_Import_Informix extends Doctrine_Import { - protected $sql = array( + protected $sql = array( 'listTables' => "SELECT tabname,tabtype FROM systables WHERE tabtype IN ('T','V') AND owner != 'informix'", 'listColumns' => "SELECT c.colname, c.coltype, c.collength, d.default, c.colno - FROM syscolumns c, systables t,outer sysdefaults d - WHERE c.tabid = t.tabid AND d.tabid = t.tabid AND d.colno = c.colno - AND tabname='%s' ORDER BY c.colno", - 'listPk' => "SELECT part1, part2, part3, part4, part5, part6, part7, part8 FROM - systables t, sysconstraints s, sysindexes i WHERE t.tabname='%s' - AND s.tabid=t.tabid AND s.constrtype='P' - AND i.idxname=s.idxname", + FROM syscolumns c, systables t,outer sysdefaults d + WHERE c.tabid = t.tabid AND d.tabid = t.tabid AND d.colno = c.colno + AND tabname='%s' ORDER BY c.colno", + 'listPk' => "SELECT part1, part2, part3, part4, part5, part6, part7, part8 FROM + systables t, sysconstraints s, sysindexes i WHERE t.tabname='%s' + AND s.tabid=t.tabid AND s.constrtype='P' + AND i.idxname=s.idxname", 'listForeignKeys' => "SELECT tr.tabname,updrule,delrule, i.part1 o1,i2.part1 d1,i.part2 o2,i2.part2 d2,i.part3 o3,i2.part3 d3,i.part4 o4,i2.part4 d4, i.part5 o5,i2.part5 d5,i.part6 o6,i2.part6 d6,i.part7 o7,i2.part7 d7,i.part8 o8,i2.part8 d8 diff --git a/lib/Doctrine/Import/Mssql.php b/lib/Doctrine/Import/Mssql.php index 06c6c33db..c6e38884c 100644 --- a/lib/Doctrine/Import/Mssql.php +++ b/lib/Doctrine/Import/Mssql.php @@ -170,7 +170,7 @@ class Doctrine_Import_Mssql extends Doctrine_Import $result = array(); foreach ($indexes as $index) { - if (!in_array($index, $pkAll) && $index != null) { + if ( ! in_array($index, $pkAll) && $index != null) { $result[] = $this->conn->formatter->fixIndexName($index); } } diff --git a/lib/Doctrine/Import/Mysql.php b/lib/Doctrine/Import/Mysql.php index 20bc75524..932086254 100644 --- a/lib/Doctrine/Import/Mysql.php +++ b/lib/Doctrine/Import/Mysql.php @@ -48,7 +48,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import public function listSequences($database = null) { $query = 'SHOW TABLES'; - if (!is_null($database)) { + if ( ! is_null($database)) { $query .= ' FROM ' . $database; } $tableNames = $this->conn->fetchColumn($query); @@ -81,7 +81,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import $result = array(); foreach ($indexes as $indexData) { - if (!$indexData[$nonUnique]) { + if ( ! $indexData[$nonUnique]) { if ($indexData[$keyName] !== 'PRIMARY') { $index = $this->conn->fixIndexName($indexData[$keyName]); } else { @@ -102,7 +102,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import */ public function listTableForeignKeys($table) { - $sql = 'SHOW CREATE TABLE ' . $this->conn->quoteIdentifier($table, true); + $sql = 'SHOW CREATE TABLE ' . $this->conn->quoteIdentifier($table, true); } /** * lists table constraints @@ -195,7 +195,7 @@ class Doctrine_Import_Mysql extends Doctrine_Import */ public function listViews($database = null) { - if (!is_null($database)) { + if ( ! is_null($database)) { $query = sprintf($this->sql['listViews'], ' FROM ' . $database); } diff --git a/lib/Doctrine/Import/Oracle.php b/lib/Doctrine/Import/Oracle.php index 5073c4366..f3991c0ea 100644 --- a/lib/Doctrine/Import/Oracle.php +++ b/lib/Doctrine/Import/Oracle.php @@ -197,7 +197,7 @@ class Doctrine_Import_Oracle extends Doctrine_Import */ public function listUsers() { - /** + /** if ($this->conn->options['emulate_database'] && $this->conn->options['database_name_prefix']) { $query = 'SELECT SUBSTR(username, '; $query.= (strlen($this->conn->options['database_name_prefix'])+1); diff --git a/lib/Doctrine/Import/Reader/Db.php b/lib/Doctrine/Import/Reader/Db.php index f15d27670..df613660e 100644 --- a/lib/Doctrine/Import/Reader/Db.php +++ b/lib/Doctrine/Import/Reader/Db.php @@ -79,16 +79,16 @@ class Doctrine_Import_Reader_Db extends Doctrine_Import_Reader $this->conn->set("name",$dbName); $tableNames = $dataDict->listTables(); - foreach ($tableNames as $tableName){ + foreach ($tableNames as $tableName) { $table = new Doctrine_Schema_Table(); $table->set("name",$tableName); $tableColumns = $dataDict->listTableColumns($tableName); - foreach ($tableColumns as $tableColumn){ + foreach ($tableColumns as $tableColumn) { $table->addColumn($tableColumn); } $this->conn->addTable($table); - if ($fks = $dataDict->listTableConstraints($tableName)){ - foreach ($fks as $fk){ + if ($fks = $dataDict->listTableConstraints($tableName)) { + foreach ($fks as $fk) { $relation = new Doctrine_Schema_Relation(); $relation->setRelationBetween($fk['referencingColumn'],$fk['referencedTable'],$fk['referencedColumn']); $table->setRelation($relation); diff --git a/lib/Doctrine/Import/Schema/Xml.php b/lib/Doctrine/Import/Schema/Xml.php index 4e72c7c7e..5fd6848c8 100644 --- a/lib/Doctrine/Import/Schema/Xml.php +++ b/lib/Doctrine/Import/Schema/Xml.php @@ -39,19 +39,19 @@ */ class Doctrine_Import_Schema_Xml extends Doctrine_Import_Schema { - /** - * parse - * - * @param string $schema - * @return void - */ + /** + * parse + * + * @param string $schema + * @return void + */ public function parse($schema) { - if (!is_readable($schema)) { + if ( ! is_readable($schema)) { throw new Doctrine_Import_Exception('Could not read schema file '. $schema); } - if (!($xmlString = file_get_contents($schema))) { + if ( ! ($xmlString = file_get_contents($schema))) { throw new Doctrine_Import_Exception('Schema file '. $schema . ' is empty'); } @@ -101,4 +101,4 @@ class Doctrine_Import_Schema_Xml extends Doctrine_Import_Schema return $tables; } -} \ No newline at end of file +} diff --git a/lib/Doctrine/Import/Schema/Yml.php b/lib/Doctrine/Import/Schema/Yml.php index 9d86e7273..f9c422633 100644 --- a/lib/Doctrine/Import/Schema/Yml.php +++ b/lib/Doctrine/Import/Schema/Yml.php @@ -39,19 +39,19 @@ */ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema { - /** - * parse - * - * @param string $schema - * @return void - */ + /** + * parse + * + * @param string $schema + * @return void + */ public function parse($schema) { - if (!is_readable($schema)) { + if ( ! is_readable($schema)) { throw new Doctrine_Import_Exception('Could not read schema file '. $schema); } - return array(); + return array(); } /** @@ -66,11 +66,11 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema public function parseSchema($schema) { $array = $this->parse($schema); - - $tables = array(); - - // Not working yet - /* + + $tables = array(); + + // Not working yet + /* // Go through all tables... foreach ($array['table'] as $table) { // Go through all columns... @@ -93,8 +93,8 @@ class Doctrine_Import_Schema_Yml extends Doctrine_Import_Schema $tables[(string) $table['name']] = $columns; } - */ + */ return $tables; } -} \ No newline at end of file +} diff --git a/lib/Doctrine/IntegrityMapper.php b/lib/Doctrine/IntegrityMapper.php index 5d1b86ff3..db647707e 100644 --- a/lib/Doctrine/IntegrityMapper.php +++ b/lib/Doctrine/IntegrityMapper.php @@ -40,7 +40,7 @@ class Doctrine_IntegrityMapper } public function invokeIntegrityActions(Doctrine_Record $record) { - $deleteActions = Doctrine_Manager::getInstance() + $deleteActions = Doctrine_Manager::getInstance() ->getDeleteActions($record->getTable()->getComponentName()); foreach ($record->getTable()->getRelations() as $relation) { @@ -97,7 +97,7 @@ class Doctrine_IntegrityMapper } public function buildIntegrityRelations(Doctrine_Table $table, &$aliases, &$fields, &$indexes, &$components) { - $deleteActions = Doctrine_Manager::getInstance() + $deleteActions = Doctrine_Manager::getInstance() ->getDeleteActions($table->getComponentName()); foreach ($table->getRelations() as $relation) { diff --git a/lib/Doctrine/Lib.php b/lib/Doctrine/Lib.php index 2ea7147f0..d7ec0f4d4 100644 --- a/lib/Doctrine/Lib.php +++ b/lib/Doctrine/Lib.php @@ -83,7 +83,7 @@ class Doctrine_Lib * @return string Xml as string */ - public static function getCollectionAsXml(Doctrine_Collection $collection, SimpleXMLElement $incomming_xml = null){ + public static function getCollectionAsXml(Doctrine_Collection $collection, SimpleXMLElement $incomming_xml = null) { $collectionName = Doctrine_Lib::plurelize($collection->getTable()->tableName); if ( $collection->count != 0) { @@ -106,7 +106,7 @@ class Doctrine_Lib return $xml->asXML(); } - public static function plurelize($string){ + public static function plurelize($string) { return $string . "s"; } @@ -131,10 +131,10 @@ class Doctrine_Lib if ( !isset($incomming_xml)) { $new_xml_string = "<" . $recordname . ">"; $xml = new SimpleXMLElement($new_xml_string); - }else{ + } else { $xml = $incomming_xml->addChild($recordname); } - foreach($record->obtainIdentifier() as $pk_field => $pk_value){ + foreach($record->obtainIdentifier() as $pk_field => $pk_value) { $xml->addChild($pk_field,$pk_value); } $xml_options = $record->option("xml"); @@ -145,12 +145,12 @@ class Doctrine_Lib if ((isset($xml_options["ignore_fields"]) && !in_array($field, $xml_options["ignore_fields"])) || !isset($xml_options["ignore_fields"])) { if ($value instanceOf Doctrine_Null) { $xml->addChild($field); - } else { + } else { $xml->addChild($field, $value); } } } - if (!isset($xml_options["include_relations"])) { + if ( ! isset($xml_options["include_relations"])) { return $xml->asXML(); } $relations = $record->getTable()->getRelations(); diff --git a/lib/Doctrine/Locking/Manager/Pessimistic.php b/lib/Doctrine/Locking/Manager/Pessimistic.php index bbbb20a65..4dc7dbfba 100644 --- a/lib/Doctrine/Locking/Manager/Pessimistic.php +++ b/lib/Doctrine/Locking/Manager/Pessimistic.php @@ -217,7 +217,7 @@ class Doctrine_Locking_Manager_Pessimistic $stmt->bindParam(':object_key', $key); $success = $stmt->execute(); - if (!$success) { + if ( ! $success) { throw new Doctrine_Locking_Exception("Failed to determine locking user"); } diff --git a/lib/Doctrine/Manager.php b/lib/Doctrine/Manager.php index 733914063..a1c950213 100644 --- a/lib/Doctrine/Manager.php +++ b/lib/Doctrine/Manager.php @@ -190,7 +190,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera */ public function openConnection($adapter, $name = null, $setCurrent = true) { - if (is_object($adapter)) { + if (is_object($adapter)) { if ( ! ($adapter instanceof PDO) && ! in_array('Doctrine_Adapter_Interface', class_implements($adapter))) { throw new Doctrine_Manager_Exception("First argument should be an instance of PDO or implement Doctrine_Adapter_Interface"); } @@ -202,7 +202,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera } $e = explode(':', $adapter[0]); - if($e[0] == 'uri') { + if ($e[0] == 'uri') { $e[0] = 'odbc'; } diff --git a/lib/Doctrine/Node.php b/lib/Doctrine/Node.php index 3f22640ed..930777197 100644 --- a/lib/Doctrine/Node.php +++ b/lib/Doctrine/Node.php @@ -83,7 +83,7 @@ class Doctrine_Node implements IteratorAggregate { $class = 'Doctrine_Node_' . $implName; - if (!class_exists($class)) { + if ( ! class_exists($class)) { throw new Doctrine_Node_Exception("The class $class must exist and extend Doctrine_Node"); } diff --git a/lib/Doctrine/Node/NestedSet.php b/lib/Doctrine/Node/NestedSet.php index 9cbe48332..08c941c44 100644 --- a/lib/Doctrine/Node/NestedSet.php +++ b/lib/Doctrine/Node/NestedSet.php @@ -750,7 +750,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int { if ($record === null) { return ($this->getRightValue() > $this->getLeftValue()); - } else if( $record instanceof Doctrine_Record ) { + } else if ( $record instanceof Doctrine_Record ) { return ($record->getNode()->getRightValue() > $record->getNode()->getLeftValue()); } else { return false; @@ -817,7 +817,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int // Make room in the new branch $this->shiftRLValues($destLeft, $treeSize, $rootId); - if ($left >= $destLeft){ // src was shifted too? + if ($left >= $destLeft) { // src was shifted too? $left += $treeSize; $right += $treeSize; } @@ -952,7 +952,7 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int */ public function getLevel() { - if (!isset($this->record['level'])) { + if ( ! isset($this->record['level'])) { $baseAlias = $this->_tree->getBaseAlias(); $componentName = $this->_tree->getBaseComponent(); $q = $this->_tree->getBaseQuery(); diff --git a/lib/Doctrine/Node/NestedSet/PreOrderIterator.php b/lib/Doctrine/Node/NestedSet/PreOrderIterator.php index 96fcf14cd..09f7f641d 100644 --- a/lib/Doctrine/Node/NestedSet/PreOrderIterator.php +++ b/lib/Doctrine/Node/NestedSet/PreOrderIterator.php @@ -154,7 +154,7 @@ class Doctrine_Node_NestedSet_PreOrderIterator implements Iterator private function updateLevel() { - if (!(isset($this->options['include_record']) && $this->options['include_record'] && $this->index == 0)) { + if ( ! (isset($this->options['include_record']) && $this->options['include_record'] && $this->index == 0)) { $left = $this->collection->get($this->key)->getNode()->getLeftValue(); $this->level += $this->prevLeft - $left + 2; $this->prevLeft = $left; diff --git a/lib/Doctrine/Null.php b/lib/Doctrine/Null.php index 0f6827a6d..94461b7b1 100644 --- a/lib/Doctrine/Null.php +++ b/lib/Doctrine/Null.php @@ -36,10 +36,10 @@ final class Doctrine_Null { public function exists() { - return false; + return false; } public function __toString() { - return ''; + return ''; } } diff --git a/lib/Doctrine/Query.php b/lib/Doctrine/Query.php index e12a22c60..bf1e14581 100644 --- a/lib/Doctrine/Query.php +++ b/lib/Doctrine/Query.php @@ -322,9 +322,9 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable */ public function getDqlPart($queryPart) { - if ( ! isset($this->_dqlParts[$queryPart])) { - throw new Doctrine_Query_Exception('Unknown query part ' . $queryPart); - } + if ( ! isset($this->_dqlParts[$queryPart])) { + throw new Doctrine_Query_Exception('Unknown query part ' . $queryPart); + } return $this->_dqlParts[$queryPart]; } @@ -757,7 +757,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable $aliases = array_merge($this->subqueryAliases, array_keys($this->neededTables)); - if( ! in_array($e[3], $aliases) && + if ( ! in_array($e[3], $aliases) && ! in_array($e[2], $aliases) && ! empty($this->pendingFields)) { @@ -1217,7 +1217,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable public function load($path, $loadFields = true) { - $e = Doctrine_Tokenizer::quoteExplode($path, ' INDEXBY '); + $e = Doctrine_Tokenizer::quoteExplode($path, ' INDEXBY '); $mapWith = null; if (count($e) > 1) { @@ -1322,7 +1322,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable $assocTableName = $asf->getTableName(); - if( ! $loadFields || ! empty($map) || $joinCondition) { + if ( ! $loadFields || ! empty($map) || $joinCondition) { $this->subqueryAliases[] = $assocTableName; } @@ -1404,7 +1404,7 @@ class Doctrine_Query extends Doctrine_Query_Abstract implements Countable $restoreState = true; } - if(isset($this->pendingFields[$componentAlias])) { + if (isset($this->pendingFields[$componentAlias])) { $this->processPendingFields($componentAlias); } diff --git a/lib/Doctrine/Query/Abstract.php b/lib/Doctrine/Query/Abstract.php index b96b5e149..10595152d 100644 --- a/lib/Doctrine/Query/Abstract.php +++ b/lib/Doctrine/Query/Abstract.php @@ -88,7 +88,7 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate $value = $value->getSql(); unset($values[$k]); } else { - $value = '?'; + $value = '?'; } $a[] = $value; } @@ -184,7 +184,7 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate */ public function delete() { - $this->type = self::DELETE; + $this->type = self::DELETE; return $this; } @@ -197,7 +197,7 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate */ public function update($update) { - $this->type = self::UPDATE; + $this->type = self::UPDATE; return $this->parseQueryPart('from', $update); } @@ -210,11 +210,11 @@ abstract class Doctrine_Query_Abstract extends Doctrine_Hydrate */ public function set($key, $value, $params = null) { - if (is_array($key)) { + if (is_array($key)) { foreach ($key as $k => $v) { - $this->set($k, '?', array($v)); + $this->set($k, '?', array($v)); } - } else { + } else { if ($params !== null) { if (is_array($params)) { $this->_params['set'] = array_merge($this->_params['set'], $params); diff --git a/lib/Doctrine/Query/JoinCondition.php b/lib/Doctrine/Query/JoinCondition.php index 1add247c6..896f95d09 100644 --- a/lib/Doctrine/Query/JoinCondition.php +++ b/lib/Doctrine/Query/JoinCondition.php @@ -38,7 +38,7 @@ class Doctrine_Query_JoinCondition extends Doctrine_Query_Condition $e = Doctrine_Tokenizer::sqlExplode($condition); - if(count($e) > 2) { + if (count($e) > 2) { $a = explode('.', $e[0]); $field = array_pop($a); $reference = implode('.', $a); diff --git a/lib/Doctrine/Query/Where.php b/lib/Doctrine/Query/Where.php index fe9ca7f94..cd8a94636 100644 --- a/lib/Doctrine/Query/Where.php +++ b/lib/Doctrine/Query/Where.php @@ -68,7 +68,7 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition $map = $this->query->getRootDeclaration(); $alias = $this->query->getTableAlias($this->query->getRootAlias()); - $table = $map['table']; + $table = $map['table']; } else { $map = $this->query->load($reference, false); @@ -129,7 +129,7 @@ class Doctrine_Query_Where extends Doctrine_Query_Condition } $value = '(' . implode(', ', $value) . ')'; } - } elseif(substr($value, 0, 1) == ':' || $value === '?') { + } elseif (substr($value, 0, 1) == ':' || $value === '?') { // placeholder found if (isset($table) && isset($field) && $table->getTypeOf($field) == 'enum') { $this->query->addEnumParam($value, $table, $field); diff --git a/lib/Doctrine/RawSql.php b/lib/Doctrine/RawSql.php index 994420c90..8303b61f2 100644 --- a/lib/Doctrine/RawSql.php +++ b/lib/Doctrine/RawSql.php @@ -129,7 +129,7 @@ class Doctrine_RawSql extends Doctrine_Query_Abstract */ public function getQuery() { - $select = array(); + $select = array(); foreach ($this->fields as $field) { $e = explode('.', $field); diff --git a/lib/Doctrine/Record.php b/lib/Doctrine/Record.php index 7c9f4932d..81440485b 100644 --- a/lib/Doctrine/Record.php +++ b/lib/Doctrine/Record.php @@ -370,8 +370,8 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count */ public function errorStack($stack = null) { - if($stack !== null) { - if( ! ($stack instanceof Doctrine_Validator_ErrorStack)) { + if ($stack !== null) { + if ( ! ($stack instanceof Doctrine_Validator_ErrorStack)) { throw new Doctrine_Record_Exception('Argument should be an instance of Doctrine_Validator_ErrorStack.'); } $this->_errorStack = $stack; @@ -413,7 +413,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count */ public function cleanData(&$data) { - $tmp = $data; + $tmp = $data; $data = array(); foreach ($this->getTable()->getColumnNames() as $name) { @@ -483,7 +483,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count */ public function serialize() { - $event = new Doctrine_Event($this, Doctrine_Event::RECORD_SERIALIZE); + $event = new Doctrine_Event($this, Doctrine_Event::RECORD_SERIALIZE); $this->preSerialize($event); @@ -536,9 +536,9 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count */ public function unserialize($serialized) { - $event = new Doctrine_Event($this, Doctrine_Event::RECORD_UNSERIALIZE); + $event = new Doctrine_Event($this, Doctrine_Event::RECORD_UNSERIALIZE); - $this->preUnserialize($event); + $this->preUnserialize($event); $manager = Doctrine_Manager::getInstance(); $connection = $manager->getConnectionForComponent(get_class($this)); @@ -674,7 +674,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count { if (is_null($name)) { foreach ($this->_table->getRelations() as $rel) { - $this->_references[$rel->getAlias()] = $rel->fetchRelatedFor($this); + $this->_references[$rel->getAlias()] = $rel->fetchRelatedFor($this); } } else { $rel = $this->_table->getRelation($name); @@ -897,7 +897,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count } if ($rel instanceof Doctrine_Relation_LocalKey) { $foreign = $rel->getForeign(); - if (!empty($foreign) && $foreign != $value->getTable()->getIdentifier()) + if ( ! empty($foreign) && $foreign != $value->getTable()->getIdentifier()) $this->set($rel->getLocal(), $value->rawGet($foreign), false); else $this->set($rel->getLocal(), $value, false); @@ -933,7 +933,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count return true; } if (isset($this->_values[$lower])) { - return true; + return true; } if (isset($this->_references[$name]) && $this->_references[$name] !== self::$_null) { @@ -1202,7 +1202,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count */ public function copy() { - $data = $this->_data; + $data = $this->_data; if ($this->_table->getIdentifierType() === Doctrine::IDENTIFIER_AUTOINC) { $id = $this->_table->getIdentifier(); @@ -1228,7 +1228,7 @@ abstract class Doctrine_Record extends Doctrine_Record_Abstract implements Count * * @return Doctrine_Record */ - public function copyDeep(){ + public function copyDeep() { $copy = $this->copy(); foreach ($this->_references as $key => $value) { diff --git a/lib/Doctrine/Record/Abstract.php b/lib/Doctrine/Record/Abstract.php index b610c6d3d..9414a9321 100644 --- a/lib/Doctrine/Record/Abstract.php +++ b/lib/Doctrine/Record/Abstract.php @@ -102,7 +102,7 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access public function setSubclasses($map) { - if (isset($map[get_class($this)])){ + if (isset($map[get_class($this)])) { $this->_table->setOption('inheritanceMap', $map[get_class($this)]); return; } @@ -246,8 +246,8 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access */ public function loadTemplate($template, array $options = array()) { - $tpl = new $template($options); - $tpl->setTable($this->_table); + $tpl = new $template($options); + $tpl->setTable($this->_table); $tpl->setUp(); @@ -302,7 +302,7 @@ abstract class Doctrine_Record_Abstract extends Doctrine_Access */ public function check($constraint, $name = null) { - if (is_array($constraint)) { + if (is_array($constraint)) { foreach ($constraint as $name => $def) { $this->_table->addCheckConstraint($def, $name); } diff --git a/lib/Doctrine/Record/Filter.php b/lib/Doctrine/Record/Filter.php index 5a0f98533..290862be1 100644 --- a/lib/Doctrine/Record/Filter.php +++ b/lib/Doctrine/Record/Filter.php @@ -64,7 +64,7 @@ class Doctrine_Record_Filter extends Doctrine_Object */ public function assignDefaultValues($data, $overwrite = false) { - $table = $this->_record->getTable(); + $table = $this->_record->getTable(); if ( ! $table->hasDefaultValues()) { return false; @@ -95,7 +95,7 @@ class Doctrine_Record_Filter extends Doctrine_Object private function prepareIdentifiers($exists = true) { $id = $this->_table->getIdentifier(); - $this->_id = array(); + $this->_id = array(); if (count($id) > 1) { foreach ($id as $name) { if ($this->_data[$name] === self::$_null) { @@ -104,7 +104,7 @@ class Doctrine_Record_Filter extends Doctrine_Object $this->_id[$name] = $this->_data[$name]; } } - } else { + } else { if (isset($this->_data[$id]) && $this->_data[$id] !== self::$_null) { $this->_id[$id] = $this->_data[$id]; } diff --git a/lib/Doctrine/Relation.php b/lib/Doctrine/Relation.php index 6c582f8ec..95bd495b6 100644 --- a/lib/Doctrine/Relation.php +++ b/lib/Doctrine/Relation.php @@ -118,15 +118,15 @@ abstract class Doctrine_Relation implements ArrayAccess */ public function __construct(array $definition) { - $def = array(); - foreach ($this->definition as $key => $val) { + $def = array(); + foreach ($this->definition as $key => $val) { if ( ! isset($definition[$key]) && $val) { throw new Doctrine_Exception($key . ' is required!'); } if (isset($definition[$key])) { $def[$key] = $definition[$key]; } else { - $def[$key] = null; + $def[$key] = null; } } @@ -276,7 +276,7 @@ abstract class Doctrine_Relation implements ArrayAccess */ public function getRelationDql($count) { - $component = $this->getTable()->getComponentName(); + $component = $this->getTable()->getComponentName(); $dql = 'FROM ' . $component . ' WHERE ' . $component . '.' . $this->definition['foreign'] @@ -302,7 +302,7 @@ abstract class Doctrine_Relation implements ArrayAccess { $r[] = "
";
         foreach ($this->definition as $k => $v) {
-            if(is_object($v)) {
+            if (is_object($v)) {
                 $v = 'Object(' . get_class($v) . ')';
             }
             $r[] = $k . ' : ' . $v;
diff --git a/lib/Doctrine/Relation/Association.php b/lib/Doctrine/Relation/Association.php
index d2e46a5c8..35aa947f3 100644
--- a/lib/Doctrine/Relation/Association.php
+++ b/lib/Doctrine/Relation/Association.php
@@ -44,7 +44,7 @@ class Doctrine_Relation_Association extends Doctrine_Relation
     }
     public function getAssociationTable()
     {
-    	return $this->definition['refTable'];
+        return $this->definition['refTable'];
     }
     /**
      * getRelationDql
@@ -54,7 +54,7 @@ class Doctrine_Relation_Association extends Doctrine_Relation
      */
     public function getRelationDql($count, $context = 'record')
     {
-    	$component = $this->definition['refTable']->getComponentName();
+        $component = $this->definition['refTable']->getComponentName();
         switch ($context) {
             case "record":
                 $sub  = substr(str_repeat("?, ", $count),0,-2);
diff --git a/lib/Doctrine/Relation/ForeignKey.php b/lib/Doctrine/Relation/ForeignKey.php
index bfdde5aba..57d210e99 100644
--- a/lib/Doctrine/Relation/ForeignKey.php
+++ b/lib/Doctrine/Relation/ForeignKey.php
@@ -43,9 +43,9 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
      */
     public function fetchRelatedFor(Doctrine_Record $record)
     {
-    	$id = array();
-    	foreach ((array) $this->definition['local'] as $local) {
-    	   $value = $record->get($local);
+        $id = array();
+        foreach ((array) $this->definition['local'] as $local) {
+           $value = $record->get($local);
            if (isset($value)) {
                $id[] = $value;
            }
@@ -86,10 +86,10 @@ class Doctrine_Relation_ForeignKey extends Doctrine_Relation
      */
     public function getCondition($alias = null)
     {
-    	if ( ! $alias) {
-    	   $alias = $this->getTable()->getComponentName();
-    	}
-    	$conditions = array();
+        if ( ! $alias) {
+           $alias = $this->getTable()->getComponentName();
+        }
+        $conditions = array();
         foreach ((array) $this->definition['foreign'] as $foreign) {
             $conditions[] = $alias . '.' . $foreign . ' = ?';
         }
diff --git a/lib/Doctrine/Relation/LocalKey.php b/lib/Doctrine/Relation/LocalKey.php
index 9a89153dd..72e5e5eec 100644
--- a/lib/Doctrine/Relation/LocalKey.php
+++ b/lib/Doctrine/Relation/LocalKey.php
@@ -73,10 +73,10 @@ class Doctrine_Relation_LocalKey extends Doctrine_Relation
      */
     public function getCondition($alias = null)
     {
-    	if ( ! $alias) {
-    	   $alias = $this->getTable()->getComponentName();
-    	}
-    	return $alias . '.' . $this->definition['foreign'] . ' = ?';
+        if ( ! $alias) {
+           $alias = $this->getTable()->getComponentName();
+        }
+        return $alias . '.' . $this->definition['foreign'] . ' = ?';
     }
 
 }
diff --git a/lib/Doctrine/Relation/Parser.php b/lib/Doctrine/Relation/Parser.php
index 7a217fe49..4449ff2fc 100644
--- a/lib/Doctrine/Relation/Parser.php
+++ b/lib/Doctrine/Relation/Parser.php
@@ -68,11 +68,11 @@ class Doctrine_Relation_Parser
      */
     public function getPendingRelation($name) 
     {
-    	if ( ! isset($this->_pending[$name])) {
+        if ( ! isset($this->_pending[$name])) {
             throw new Doctrine_Relation_Exception('Unknown pending relation ' . $name);
-    	}
-    	
-    	return $this->_pending[$name];
+        }
+        
+        return $this->_pending[$name];
     }
     
     public function hasRelation($name)
@@ -218,7 +218,7 @@ class Doctrine_Relation_Parser
      */
     public function getImpl($template)
     {
-    	$conn = $this->_table->getConnection();
+        $conn = $this->_table->getConnection();
 
         if (in_array('Doctrine_Template', class_parents($template))) {
             $impl = $this->_table->getImpl($template);
@@ -240,7 +240,7 @@ class Doctrine_Relation_Parser
      */
     public function completeAssocDefinition($def) 
     {
-    	$conn = $this->_table->getConnection();
+        $conn = $this->_table->getConnection();
         $def['table'] = $this->getImpl($def['class']);
         $def['class'] = $def['table']->getComponentName();
         $def['refTable'] = $this->getImpl($def['refClass']);
@@ -291,16 +291,16 @@ class Doctrine_Relation_Parser
      */
     public function getIdentifiers(Doctrine_Table $table)
     {
-    	if (is_array($table->getIdentifier())) {
+        if (is_array($table->getIdentifier())) {
             $columns = array();
             foreach((array) $table->getIdentifier() as $identifier) {
                 $columns[] = strtolower($table->getComponentName())
                            . '_' . $table->getIdentifier();
             }
-    	} else {
+        } else {
             $columns = strtolower($table->getComponentName())
                            . '_' . $table->getIdentifier();
-    	}
+        }
 
         return $columns;
     }
@@ -349,7 +349,7 @@ class Doctrine_Relation_Parser
      */
     public function completeDefinition($def)
     {
-    	$conn = $this->_table->getConnection();
+        $conn = $this->_table->getConnection();
         $def['table'] = $this->getImpl($def['class']);
         $def['class'] = $def['table']->getComponentName();
 
diff --git a/lib/Doctrine/Schema.php b/lib/Doctrine/Schema.php
index f75cfeca7..ae086f7ee 100644
--- a/lib/Doctrine/Schema.php
+++ b/lib/Doctrine/Schema.php
@@ -60,7 +60,7 @@ class Doctrine_Schema extends Doctrine_Schema_Object implements Countable, Itera
      * @return array of Doctrine_Schema_Database
      *
      */
-    public function getDatabases(){
+    public function getDatabases() {
          return $this->childs;
     }
     /**
diff --git a/lib/Doctrine/Schema/Table.php b/lib/Doctrine/Schema/Table.php
index 0ea636ac5..60f341a5d 100644
--- a/lib/Doctrine/Schema/Table.php
+++ b/lib/Doctrine/Schema/Table.php
@@ -96,7 +96,7 @@ class Doctrine_Schema_Table extends Doctrine_Schema_Object implements Countable,
      * @param Doctrine_Schema_Relation Relation
      *
     */
-    public function setRelation(Doctrine_Schema_Relation $relation){
+    public function setRelation(Doctrine_Schema_Relation $relation) {
          $this->relations[] = $relation;
     }
     /**
@@ -104,7 +104,7 @@ class Doctrine_Schema_Table extends Doctrine_Schema_Object implements Countable,
      *
      * @return array Array of Doctrine_Schema_Relation
     */
-    public function getRelations(){
+    public function getRelations() {
         return $this->relations;
     }
 
diff --git a/lib/Doctrine/Search.php b/lib/Doctrine/Search.php
index 01531c4d8..813f58320 100644
--- a/lib/Doctrine/Search.php
+++ b/lib/Doctrine/Search.php
@@ -74,7 +74,7 @@ class Doctrine_Search
      */
     public function updateIndex(Doctrine_Record $record) 
     {
-    	$fields = $this->getOption('fields');
+        $fields = $this->getOption('fields');
         $class  = $this->getOption('className');
         $name   = $record->getTable()->getComponentName();
 
diff --git a/lib/Doctrine/Search/Analyzer/Standard.php b/lib/Doctrine/Search/Analyzer/Standard.php
index 8e2cdda1a..cad02d8a9 100644
--- a/lib/Doctrine/Search/Analyzer/Standard.php
+++ b/lib/Doctrine/Search/Analyzer/Standard.php
@@ -266,7 +266,7 @@ class Doctrine_Search_Analyzer_Standard implements Doctrine_Search_Analyzer_Inte
 
     public function analyze($text)
     {
-    	$text = preg_replace('/[.()&#!,?^£@%&{}+]/', ' ', $text);
+        $text = preg_replace('/[.()&#!,?^£@%&{}+]/', ' ', $text);
         $text = str_replace('  ', ' ', $text);
 
         $terms = explode(' ', $text);
diff --git a/lib/Doctrine/Search/Indexer.php b/lib/Doctrine/Search/Indexer.php
index 298a5a3f0..d413041d2 100644
--- a/lib/Doctrine/Search/Indexer.php
+++ b/lib/Doctrine/Search/Indexer.php
@@ -34,9 +34,9 @@ class Doctrine_Search_Indexer
 {
     public function indexDirectory($dir)
     {
-    	if ( ! file_exists($dir)) {
-    	   throw new Doctrine_Search_Indexer_Exception('Unknown directory ' . $dir);
-    	}
+        if ( ! file_exists($dir)) {
+           throw new Doctrine_Search_Indexer_Exception('Unknown directory ' . $dir);
+        }
 
         $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY);
 
diff --git a/lib/Doctrine/Search/Indexer/Dir.php b/lib/Doctrine/Search/Indexer/Dir.php
index bebacedfc..98c03fd7b 100644
--- a/lib/Doctrine/Search/Indexer/Dir.php
+++ b/lib/Doctrine/Search/Indexer/Dir.php
@@ -34,9 +34,9 @@ class Doctrine_Search_Indexer_Dir
 {
     public function add($dir)
     {
-    	if ( ! file_exists($dir)) {
-    	   throw new Doctrine_Search_Indexer_Exception('Unknown directory ' . $dir);
-    	}
+        if ( ! file_exists($dir)) {
+           throw new Doctrine_Search_Indexer_Exception('Unknown directory ' . $dir);
+        }
 
         $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir), RecursiveIteratorIterator::LEAVES_ONLY);
         
diff --git a/lib/Doctrine/Search/Query.php b/lib/Doctrine/Search/Query.php
index 734c9106f..1b70c8cc6 100644
--- a/lib/Doctrine/Search/Query.php
+++ b/lib/Doctrine/Search/Query.php
@@ -183,7 +183,7 @@ class Doctrine_Search_Query
 
     public function parseTerm($term)
     {
-    	$negation = false;
+        $negation = false;
 
         if (strpos($term, "'") === false) {
             $where = $this->parseWord($term);
diff --git a/lib/Doctrine/Table.php b/lib/Doctrine/Table.php
index 4349de2ae..6d5c67395 100644
--- a/lib/Doctrine/Table.php
+++ b/lib/Doctrine/Table.php
@@ -345,7 +345,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
             }
             $columns[$name] = $definition;
 
-            if(isset($definition['primary']) && $definition['primary']) {
+            if (isset($definition['primary']) && $definition['primary']) {
                 $primary[] = $name;
             }
         }
@@ -487,7 +487,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
      */
     public function addCheckConstraint($definition, $name)
     {
-    	if (is_string($name)) {
+        if (is_string($name)) {
             $this->options['checks'][$name] = $definition;
         } else {
             $this->options['checks'][] = $definition;
@@ -521,7 +521,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
     }
     public function bind($args, $type)
     {
-    	$options = array();
+        $options = array();
         $options['type'] = $type;
 
         if ( ! isset($args[1])) {
@@ -668,7 +668,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
     public function getColumnName($alias)
     {
         $alias = strtolower($alias);
-        if(isset($this->columnAliases[$alias])) {
+        if (isset($this->columnAliases[$alias])) {
             return $this->columnAliases[$alias];
         }
 
@@ -883,7 +883,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
                         return $records->getFirst();
                     }
                 case Doctrine::FETCH_ARRAY:
-                    if (!empty($records[0])) {
+                    if ( ! empty($records[0])) {
                         return $records[0];
                     }
             }
@@ -977,7 +977,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
      */
     public function getRecord()
     {
-    	if ( ! empty($this->data)) {
+        if ( ! empty($this->data)) {
             $this->data = array_change_key_case($this->data, CASE_LOWER);
 
             $key = $this->getIdentifier();
@@ -1041,7 +1041,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
      */
     public function getClassnameToReturn()
     {
-        if (!isset($this->options['subclasses'])) {
+        if ( ! isset($this->options['subclasses'])) {
             return $this->options['name'];
         }
         foreach ($this->options['subclasses'] as $subclass) {
@@ -1126,7 +1126,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
             return $index;
         }
 
-        if (!$this->conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)
+        if ( ! $this->conn->getAttribute(Doctrine::ATTR_USE_NATIVE_ENUM)
             && isset($this->columns[$field]['values'][$index])
         ) {
             return $this->columns[$field]['values'][$index];
@@ -1330,11 +1330,11 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable
 
     public function getTemplate($template)
     {
-    	if ( ! isset($this->_templates[$template])) {
+        if ( ! isset($this->_templates[$template])) {
             throw new Doctrine_Table_Exception('Template ' . $template . ' not loaded');
-    	}
+        }
 
-    	return $this->_templates[$template];
+        return $this->_templates[$template];
     }
 
     public function addTemplate($template, Doctrine_Template $impl)
diff --git a/lib/Doctrine/Template/Versionable.php b/lib/Doctrine/Template/Versionable.php
index 8a94582be..46bf84f72 100644
--- a/lib/Doctrine/Template/Versionable.php
+++ b/lib/Doctrine/Template/Versionable.php
@@ -39,7 +39,7 @@ class Doctrine_Template_Versionable extends Doctrine_Template
     }
     public function setUp()
     {
-    	$this->_auditLog->setOption('table', $this->_table);
+        $this->_auditLog->setOption('table', $this->_table);
         $this->_auditLog->buildDefinition($this->_table);
 
         $this->addListener(new Doctrine_AuditLog_Listener($this->_auditLog));
diff --git a/lib/Doctrine/Tokenizer.php b/lib/Doctrine/Tokenizer.php
index 7e1773aa6..a48e6c8bd 100644
--- a/lib/Doctrine/Tokenizer.php
+++ b/lib/Doctrine/Tokenizer.php
@@ -78,7 +78,7 @@ class Doctrine_Tokenizer
      */
     public static function bracketExplode($str, $d = ' ', $e1 = '(', $e2 = ')')
     {
-        if(is_array($d)) {
+        if (is_array($d)) {
             $a = preg_split('/('.implode('|', $d).')/', $str);
             $d = stripslashes($d[0]);
         } else {
@@ -93,7 +93,7 @@ class Doctrine_Tokenizer
                 $s1 = substr_count($term[$i], $e1);
                 $s2 = substr_count($term[$i], $e2);
                 
-                if($s1 == $s2) {
+                if ($s1 == $s2) {
                     $i++;
                 }
             } else {
@@ -101,7 +101,7 @@ class Doctrine_Tokenizer
                 $c1 = substr_count($term[$i], $e1);
                 $c2 = substr_count($term[$i], $e2);
                 
-                if($c1 == $c2) { 
+                if ($c1 == $c2) { 
                     $i++;
                 }
             }
@@ -210,7 +210,7 @@ class Doctrine_Tokenizer
                 $s2 = substr_count($term[$i], $e2);
 
                 if (strpos($term[$i], '(') !== false) {
-                    if($s1 == $s2) {
+                    if ($s1 == $s2) {
                         $i++;
                     }
                 } else {
@@ -225,7 +225,7 @@ class Doctrine_Tokenizer
                 $c2 = substr_count($term[$i], $e2);
 
                 if (strpos($term[$i], '(') !== false) {
-                    if($c1 == $c2) {
+                    if ($c1 == $c2) {
                         $i++;
                     }
                 } else {
@@ -300,7 +300,7 @@ class Doctrine_Tokenizer
             $c2 = substr_count($term[$i], $e2);
 
             if (strpos($term[$i], '(') !== false) {
-                if($c1 == $c2) {
+                if ($c1 == $c2) {
                     $i++;
                 }
             } else {
diff --git a/lib/Doctrine/Transaction.php b/lib/Doctrine/Transaction.php
index 8a72f82ee..4c82f107a 100644
--- a/lib/Doctrine/Transaction.php
+++ b/lib/Doctrine/Transaction.php
@@ -207,7 +207,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
      */
     public function commit($savepoint = null)
     {
-    	$this->conn->connect();
+        $this->conn->connect();
 
         if ($this->transactionLevel == 0) {
             return false;
@@ -363,7 +363,7 @@ class Doctrine_Transaction extends Doctrine_Connection_Module
      */
     private function removeSavePoints($savepoint)
     {
-    	$this->savePoints = array_values($this->savePoints);
+        $this->savePoints = array_values($this->savePoints);
 
         $found = false;
         $i = 0;
diff --git a/lib/Doctrine/Tree.php b/lib/Doctrine/Tree.php
index 482c2d059..46db570c6 100644
--- a/lib/Doctrine/Tree.php
+++ b/lib/Doctrine/Tree.php
@@ -95,7 +95,7 @@ class Doctrine_Tree
     public static function factory(Doctrine_Table $table, $implName, $options = array())
     {
         $class = 'Doctrine_Tree_' . $implName;
-        if (!class_exists($class)) {
+        if ( ! class_exists($class)) {
             throw new Doctrine_Exception('The chosen class must extend Doctrine_Tree');
         }
         return new $class($table, $options);
diff --git a/lib/Doctrine/Tree/NestedSet.php b/lib/Doctrine/Tree/NestedSet.php
index b3131d331..ef62b1118 100644
--- a/lib/Doctrine/Tree/NestedSet.php
+++ b/lib/Doctrine/Tree/NestedSet.php
@@ -44,7 +44,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
     {
         // set default many root attributes
         $options['hasManyRoots'] = isset($options['hasManyRoots']) ? $options['hasManyRoots'] : false;
-        if($options['hasManyRoots'])
+        if ($options['hasManyRoots'])
             $options['rootColumnName'] = isset($options['rootColumnName']) ? $options['rootColumnName'] : 'root_id';
   
         parent::__construct($table, $options);
@@ -266,7 +266,7 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
      */
     public function getBaseQuery()
     {
-        if (!isset($this->_baseQuery)) {
+        if ( ! isset($this->_baseQuery)) {
             $this->_baseQuery = $this->_createBaseQuery();
         }
         return $this->_baseQuery->copy();
diff --git a/lib/Doctrine/Validator.php b/lib/Doctrine/Validator.php
index ef71939e6..ea59776bb 100644
--- a/lib/Doctrine/Validator.php
+++ b/lib/Doctrine/Validator.php
@@ -93,7 +93,7 @@ class Doctrine_Validator extends Doctrine_Object
             }
 
             if ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_LENGTHS) {
-                if (!$this->validateLength($column, $key, $value)) {
+                if ( ! $this->validateLength($column, $key, $value)) {
                     $errorStack->add($key, 'length');
 
                     continue;
@@ -119,7 +119,7 @@ class Doctrine_Validator extends Doctrine_Object
 
                 if (strtolower($name) == 'length') {
                     if ( ! ($record->getTable()->getAttribute(Doctrine::ATTR_VALIDATE) & Doctrine::VALIDATE_LENGTHS)) {
-                        if (!$this->validateLength($column, $key, $value)) {
+                        if ( ! $this->validateLength($column, $key, $value)) {
                             $errorStack->add($key, 'length');
                         }
                     }
diff --git a/lib/Doctrine/Validator/Country.php b/lib/Doctrine/Validator/Country.php
index 8cef1570d..22c901cf9 100644
--- a/lib/Doctrine/Validator/Country.php
+++ b/lib/Doctrine/Validator/Country.php
@@ -33,249 +33,249 @@
 class Doctrine_Validator_Country
 {
     private static $countries = array(
-        'ad' =>	'Andorra',
-        'ae' =>	'United Arab Emirates',
-        'af' =>	'Afghanistan',
-        'ag' =>	'Antigua and Barbuda',
-        'ai' =>	'Anguilla',
-        'al' =>	'Albania',
-        'am' =>	'Armenia',
-        'an' =>	'Netherlands Antilles',
-        'ao' =>	'Angola',
-        'aq' =>	'Antarctica',
-        'ar' =>	'Argentina',
-        'as' =>	'American Samoa',
-        'at' =>	'Austria',
-        'au' =>	'Australia',
-        'aw' =>	'Aruba',
-        'az' =>	'Azerbaijan',
-        'ba' =>	'Bosnia Hercegovina',
-        'bb' =>	'Barbados',
-        'bd' =>	'Bangladesh',
-        'be' =>	'Belgium',
-        'bf' =>	'Burkina Faso',
-        'bg' =>	'Bulgaria',
-        'bh' =>	'Bahrain',
-        'bi' =>	'Burundi',
-        'bj' =>	'Benin',
-        'bm' =>	'Bermuda',
-        'bn' =>	'Brunei Darussalam',
-        'bo' =>	'Bolivia',
-        'br' =>	'Brazil',
-        'bs' =>	'Bahamas',
-        'bt' =>	'Bhutan',
-        'bv' =>	'Bouvet Island',
-        'bw' =>	'Botswana',
-        'by' =>	'Belarus (Byelorussia)',
-        'bz' =>	'Belize',
-        'ca' =>	'Canada',
-        'cc' =>	'Cocos Islands',
-        'cd' =>	'Congo, The Democratic Republic of the',
-        'cf' =>	'Central African Republic',
-        'cg' =>	'Congo',
-        'ch' =>	'Switzerland',
-        'ci' =>	'Ivory Coast',
-        'ck' =>	'Cook Islands',
-        'cl' =>	'Chile',
-        'cm' =>	'Cameroon',
-        'cn' =>	'China',
-        'co' =>	'Colombia',
-        'cr' =>	'Costa Rica',
-        'cs' =>	'Czechoslovakia',
-        'cu' =>	'Cuba',
-        'cv' =>	'Cape Verde',
-        'cx' =>	'Christmas Island',
-        'cy' =>	'Cyprus',
-        'cz' =>	'Czech Republic',
-        'de' =>	'Germany',
-        'dj' =>	'Djibouti',
-        'dk' =>	'Denmark',
-        'dm' =>	'Dominica',
-        'do' =>	'Dominican Republic',
-        'dz' =>	'Algeria',
-        'ec' =>	'Ecuador',
-        'ee' =>	'Estonia',
-        'eg' =>	'Egypt',
-        'eh' =>	'Western Sahara',
-        'er' =>	'Eritrea',
-        'es' =>	'Spain',
-        'et' =>	'Ethiopia',
-        'fi' =>	'Finland',
-        'fj' =>	'Fiji',
-        'fk' =>	'Falkland Islands',
-        'fm' =>	'Micronesia',
-        'fo' =>	'Faroe Islands',
-        'fr' =>	'France',
-        'fx' =>	'France, Metropolitan FX',
-        'ga' =>	'Gabon',
-        'gb' =>	'United Kingdom (Great Britain)',
-        'gd' =>	'Grenada',
-        'ge' =>	'Georgia',
-        'gf' =>	'French Guiana',
-        'gh' =>	'Ghana',
-        'gi' =>	'Gibraltar',
-        'gl' =>	'Greenland',
-        'gm' =>	'Gambia',
-        'gn' =>	'Guinea',
-        'gp' =>	'Guadeloupe',
-        'gq' =>	'Equatorial Guinea',
-        'gr' =>	'Greece',
-        'gs' =>	'South Georgia and the South Sandwich Islands',
-        'gt' =>	'Guatemala',
-        'gu' =>	'Guam',
-        'gw' =>	'Guinea-bissau',
-        'gy' =>	'Guyana',
-        'hk' =>	'Hong Kong',
-        'hm' =>	'Heard and McDonald Islands',
-        'hn' =>	'Honduras',
-        'hr' =>	'Croatia',
-        'ht' =>	'Haiti',
-        'hu' =>	'Hungary',
-        'id' =>	'Indonesia',
-        'ie' =>	'Ireland',
-        'il' =>	'Israel',
-        'in' =>	'India',
-        'io' =>	'British Indian Ocean Territory',
-        'iq' =>	'Iraq',
-        'ir' =>	'Iran',
-        'is' =>	'Iceland',
-        'it' =>	'Italy',
-        'jm' =>	'Jamaica',
-        'jo' =>	'Jordan',
-        'jp' =>	'Japan',
-        'ke' =>	'Kenya',
-        'kg' =>	'Kyrgyzstan',
-        'kh' =>	'Cambodia',
-        'ki' =>	'Kiribati',
-        'km' =>	'Comoros',
-        'kn' =>	'Saint Kitts and Nevis',
-        'kp' =>	'North Korea',
-        'kr' =>	'South Korea',
-        'kw' =>	'Kuwait',
-        'ky' =>	'Cayman Islands',
-        'kz' =>	'Kazakhstan',
-        'la' =>	'Laos',
-        'lb' =>	'Lebanon',
-        'lc' =>	'Saint Lucia',
-        'li' =>	'Lichtenstein',
-        'lk' =>	'Sri Lanka',
-        'lr' =>	'Liberia',
-        'ls' =>	'Lesotho',
-        'lt' =>	'Lithuania',
-        'lu' =>	'Luxembourg',
-        'lv' =>	'Latvia',
-        'ly' =>	'Libya',
-        'ma' =>	'Morocco',
-        'mc' =>	'Monaco',
-        'md' =>	'Moldova Republic',
-        'mg' =>	'Madagascar',
-        'mh' =>	'Marshall Islands',
-        'mk' =>	'Macedonia, The Former Yugoslav Republic of',
-        'ml' =>	'Mali',
-        'mm' =>	'Myanmar',
-        'mn' =>	'Mongolia',
-        'mo' =>	'Macau',
-        'mp' =>	'Northern Mariana Islands',
-        'mq' =>	'Martinique',
-        'mr' =>	'Mauritania',
-        'ms' =>	'Montserrat',
-        'mt' =>	'Malta',
-        'mu' =>	'Mauritius',
-        'mv' =>	'Maldives',
-        'mw' =>	'Malawi',
-        'mx' =>	'Mexico',
-        'my' =>	'Malaysia',
-        'mz' =>	'Mozambique',
-        'na' =>	'Namibia',
-        'nc' =>	'New Caledonia',
-        'ne' =>	'Niger',
-        'nf' =>	'Norfolk Island',
-        'ng' =>	'Nigeria',
-        'ni' =>	'Nicaragua',
-        'nl' =>	'Netherlands',
-        'no' =>	'Norway',
-        'np' =>	'Nepal',
-        'nr' =>	'Nauru',
-        'nt' =>	'Neutral Zone',
-        'nu' =>	'Niue',
-        'nz' =>	'New Zealand',
-        'om' =>	'Oman',
-        'pa' =>	'Panama',
-        'pe' =>	'Peru',
-        'pf' =>	'French Polynesia',
-        'pg' =>	'Papua New Guinea',
-        'ph' =>	'Philippines',
-        'pk' =>	'Pakistan',
-        'pl' =>	'Poland',
-        'pm' =>	'St. Pierre and Miquelon',
-        'pn' =>	'Pitcairn',
-        'pr' =>	'Puerto Rico',
-        'pt' =>	'Portugal',
-        'pw' =>	'Palau',
-        'py' =>	'Paraguay',
-        'qa' =>	'Qatar',
-        're' =>	'Reunion',
-        'ro' =>	'Romania',
-        'ru' =>	'Russia',
-        'rw' =>	'Rwanda',
-        'sa' =>	'Saudi Arabia',
-        'sb' =>	'Solomon Islands',
-        'sc' =>	'Seychelles',
-        'sd' =>	'Sudan',
-        'se' =>	'Sweden',
-        'sg' =>	'Singapore',
-        'sh' =>	'St. Helena',
-        'si' =>	'Slovenia',
-        'sj' =>	'Svalbard and Jan Mayen Islands',
-        'sk' =>	'Slovakia (Slovak Republic)',
-        'sl' =>	'Sierra Leone',
-        'sm' =>	'San Marino',
-        'sn' =>	'Senegal',
-        'so' =>	'Somalia',
-        'sr' =>	'Suriname',
-        'st' =>	'Sao Tome and Principe',
-        'sv' =>	'El Salvador',
-        'sy' =>	'Syria',
-        'sz' =>	'Swaziland',
-        'tc' =>	'Turks and Caicos Islands',
-        'td' =>	'Chad',
-        'tf' =>	'French Southern Territories',
-        'tg' =>	'Togo',
-        'th' =>	'Thailand',
-        'tj' =>	'Tajikistan',
-        'tk' =>	'Tokelau',
-        'tm' =>	'Turkmenistan',
-        'tn' =>	'Tunisia',
-        'to' =>	'Tonga',
-        'tp' =>	'East Timor',
-        'tr' =>	'Turkey',
-        'tt' =>	'Trinidad, Tobago',
-        'tv' =>	'Tuvalu',
-        'tw' =>	'Taiwan',
-        'tz' =>	'Tanzania',
-        'ua' =>	'Ukraine',
-        'ug' =>	'Uganda',
-        'uk' =>	'United Kingdom',
-        'um' =>	'United States Minor Islands',
-        'us' =>	'United States of America',
-        'uy' =>	'Uruguay',
-        'uz' =>	'Uzbekistan',
-        'va' =>	'Vatican City',
-        'vc' =>	'Saint Vincent, Grenadines',
-        've' =>	'Venezuela',
-        'vg' =>	'Virgin Islands (British)',
-        'vi' =>	'Virgin Islands (USA)',
-        'vn' =>	'Viet Nam',
-        'vu' =>	'Vanuatu',
-        'wf' =>	'Wallis and Futuna Islands',
-        'ws' =>	'Samoa',
-        'ye' =>	'Yemen',
-        'yt' =>	'Mayotte',
-        'yu' =>	'Yugoslavia',
-        'za' =>	'South Africa',
-        'zm' =>	'Zambia',
-        'zr' =>	'Zaire',
-        'zw' =>	'Zimbabwe');
+        'ad' =>    'Andorra',
+        'ae' =>    'United Arab Emirates',
+        'af' =>    'Afghanistan',
+        'ag' =>    'Antigua and Barbuda',
+        'ai' =>    'Anguilla',
+        'al' =>    'Albania',
+        'am' =>    'Armenia',
+        'an' =>    'Netherlands Antilles',
+        'ao' =>    'Angola',
+        'aq' =>    'Antarctica',
+        'ar' =>    'Argentina',
+        'as' =>    'American Samoa',
+        'at' =>    'Austria',
+        'au' =>    'Australia',
+        'aw' =>    'Aruba',
+        'az' =>    'Azerbaijan',
+        'ba' =>    'Bosnia Hercegovina',
+        'bb' =>    'Barbados',
+        'bd' =>    'Bangladesh',
+        'be' =>    'Belgium',
+        'bf' =>    'Burkina Faso',
+        'bg' =>    'Bulgaria',
+        'bh' =>    'Bahrain',
+        'bi' =>    'Burundi',
+        'bj' =>    'Benin',
+        'bm' =>    'Bermuda',
+        'bn' =>    'Brunei Darussalam',
+        'bo' =>    'Bolivia',
+        'br' =>    'Brazil',
+        'bs' =>    'Bahamas',
+        'bt' =>    'Bhutan',
+        'bv' =>    'Bouvet Island',
+        'bw' =>    'Botswana',
+        'by' =>    'Belarus (Byelorussia)',
+        'bz' =>    'Belize',
+        'ca' =>    'Canada',
+        'cc' =>    'Cocos Islands',
+        'cd' =>    'Congo, The Democratic Republic of the',
+        'cf' =>    'Central African Republic',
+        'cg' =>    'Congo',
+        'ch' =>    'Switzerland',
+        'ci' =>    'Ivory Coast',
+        'ck' =>    'Cook Islands',
+        'cl' =>    'Chile',
+        'cm' =>    'Cameroon',
+        'cn' =>    'China',
+        'co' =>    'Colombia',
+        'cr' =>    'Costa Rica',
+        'cs' =>    'Czechoslovakia',
+        'cu' =>    'Cuba',
+        'cv' =>    'Cape Verde',
+        'cx' =>    'Christmas Island',
+        'cy' =>    'Cyprus',
+        'cz' =>    'Czech Republic',
+        'de' =>    'Germany',
+        'dj' =>    'Djibouti',
+        'dk' =>    'Denmark',
+        'dm' =>    'Dominica',
+        'do' =>    'Dominican Republic',
+        'dz' =>    'Algeria',
+        'ec' =>    'Ecuador',
+        'ee' =>    'Estonia',
+        'eg' =>    'Egypt',
+        'eh' =>    'Western Sahara',
+        'er' =>    'Eritrea',
+        'es' =>    'Spain',
+        'et' =>    'Ethiopia',
+        'fi' =>    'Finland',
+        'fj' =>    'Fiji',
+        'fk' =>    'Falkland Islands',
+        'fm' =>    'Micronesia',
+        'fo' =>    'Faroe Islands',
+        'fr' =>    'France',
+        'fx' =>    'France, Metropolitan FX',
+        'ga' =>    'Gabon',
+        'gb' =>    'United Kingdom (Great Britain)',
+        'gd' =>    'Grenada',
+        'ge' =>    'Georgia',
+        'gf' =>    'French Guiana',
+        'gh' =>    'Ghana',
+        'gi' =>    'Gibraltar',
+        'gl' =>    'Greenland',
+        'gm' =>    'Gambia',
+        'gn' =>    'Guinea',
+        'gp' =>    'Guadeloupe',
+        'gq' =>    'Equatorial Guinea',
+        'gr' =>    'Greece',
+        'gs' =>    'South Georgia and the South Sandwich Islands',
+        'gt' =>    'Guatemala',
+        'gu' =>    'Guam',
+        'gw' =>    'Guinea-bissau',
+        'gy' =>    'Guyana',
+        'hk' =>    'Hong Kong',
+        'hm' =>    'Heard and McDonald Islands',
+        'hn' =>    'Honduras',
+        'hr' =>    'Croatia',
+        'ht' =>    'Haiti',
+        'hu' =>    'Hungary',
+        'id' =>    'Indonesia',
+        'ie' =>    'Ireland',
+        'il' =>    'Israel',
+        'in' =>    'India',
+        'io' =>    'British Indian Ocean Territory',
+        'iq' =>    'Iraq',
+        'ir' =>    'Iran',
+        'is' =>    'Iceland',
+        'it' =>    'Italy',
+        'jm' =>    'Jamaica',
+        'jo' =>    'Jordan',
+        'jp' =>    'Japan',
+        'ke' =>    'Kenya',
+        'kg' =>    'Kyrgyzstan',
+        'kh' =>    'Cambodia',
+        'ki' =>    'Kiribati',
+        'km' =>    'Comoros',
+        'kn' =>    'Saint Kitts and Nevis',
+        'kp' =>    'North Korea',
+        'kr' =>    'South Korea',
+        'kw' =>    'Kuwait',
+        'ky' =>    'Cayman Islands',
+        'kz' =>    'Kazakhstan',
+        'la' =>    'Laos',
+        'lb' =>    'Lebanon',
+        'lc' =>    'Saint Lucia',
+        'li' =>    'Lichtenstein',
+        'lk' =>    'Sri Lanka',
+        'lr' =>    'Liberia',
+        'ls' =>    'Lesotho',
+        'lt' =>    'Lithuania',
+        'lu' =>    'Luxembourg',
+        'lv' =>    'Latvia',
+        'ly' =>    'Libya',
+        'ma' =>    'Morocco',
+        'mc' =>    'Monaco',
+        'md' =>    'Moldova Republic',
+        'mg' =>    'Madagascar',
+        'mh' =>    'Marshall Islands',
+        'mk' =>    'Macedonia, The Former Yugoslav Republic of',
+        'ml' =>    'Mali',
+        'mm' =>    'Myanmar',
+        'mn' =>    'Mongolia',
+        'mo' =>    'Macau',
+        'mp' =>    'Northern Mariana Islands',
+        'mq' =>    'Martinique',
+        'mr' =>    'Mauritania',
+        'ms' =>    'Montserrat',
+        'mt' =>    'Malta',
+        'mu' =>    'Mauritius',
+        'mv' =>    'Maldives',
+        'mw' =>    'Malawi',
+        'mx' =>    'Mexico',
+        'my' =>    'Malaysia',
+        'mz' =>    'Mozambique',
+        'na' =>    'Namibia',
+        'nc' =>    'New Caledonia',
+        'ne' =>    'Niger',
+        'nf' =>    'Norfolk Island',
+        'ng' =>    'Nigeria',
+        'ni' =>    'Nicaragua',
+        'nl' =>    'Netherlands',
+        'no' =>    'Norway',
+        'np' =>    'Nepal',
+        'nr' =>    'Nauru',
+        'nt' =>    'Neutral Zone',
+        'nu' =>    'Niue',
+        'nz' =>    'New Zealand',
+        'om' =>    'Oman',
+        'pa' =>    'Panama',
+        'pe' =>    'Peru',
+        'pf' =>    'French Polynesia',
+        'pg' =>    'Papua New Guinea',
+        'ph' =>    'Philippines',
+        'pk' =>    'Pakistan',
+        'pl' =>    'Poland',
+        'pm' =>    'St. Pierre and Miquelon',
+        'pn' =>    'Pitcairn',
+        'pr' =>    'Puerto Rico',
+        'pt' =>    'Portugal',
+        'pw' =>    'Palau',
+        'py' =>    'Paraguay',
+        'qa' =>    'Qatar',
+        're' =>    'Reunion',
+        'ro' =>    'Romania',
+        'ru' =>    'Russia',
+        'rw' =>    'Rwanda',
+        'sa' =>    'Saudi Arabia',
+        'sb' =>    'Solomon Islands',
+        'sc' =>    'Seychelles',
+        'sd' =>    'Sudan',
+        'se' =>    'Sweden',
+        'sg' =>    'Singapore',
+        'sh' =>    'St. Helena',
+        'si' =>    'Slovenia',
+        'sj' =>    'Svalbard and Jan Mayen Islands',
+        'sk' =>    'Slovakia (Slovak Republic)',
+        'sl' =>    'Sierra Leone',
+        'sm' =>    'San Marino',
+        'sn' =>    'Senegal',
+        'so' =>    'Somalia',
+        'sr' =>    'Suriname',
+        'st' =>    'Sao Tome and Principe',
+        'sv' =>    'El Salvador',
+        'sy' =>    'Syria',
+        'sz' =>    'Swaziland',
+        'tc' =>    'Turks and Caicos Islands',
+        'td' =>    'Chad',
+        'tf' =>    'French Southern Territories',
+        'tg' =>    'Togo',
+        'th' =>    'Thailand',
+        'tj' =>    'Tajikistan',
+        'tk' =>    'Tokelau',
+        'tm' =>    'Turkmenistan',
+        'tn' =>    'Tunisia',
+        'to' =>    'Tonga',
+        'tp' =>    'East Timor',
+        'tr' =>    'Turkey',
+        'tt' =>    'Trinidad, Tobago',
+        'tv' =>    'Tuvalu',
+        'tw' =>    'Taiwan',
+        'tz' =>    'Tanzania',
+        'ua' =>    'Ukraine',
+        'ug' =>    'Uganda',
+        'uk' =>    'United Kingdom',
+        'um' =>    'United States Minor Islands',
+        'us' =>    'United States of America',
+        'uy' =>    'Uruguay',
+        'uz' =>    'Uzbekistan',
+        'va' =>    'Vatican City',
+        'vc' =>    'Saint Vincent, Grenadines',
+        've' =>    'Venezuela',
+        'vg' =>    'Virgin Islands (British)',
+        'vi' =>    'Virgin Islands (USA)',
+        'vn' =>    'Viet Nam',
+        'vu' =>    'Vanuatu',
+        'wf' =>    'Wallis and Futuna Islands',
+        'ws' =>    'Samoa',
+        'ye' =>    'Yemen',
+        'yt' =>    'Mayotte',
+        'yu' =>    'Yugoslavia',
+        'za' =>    'South Africa',
+        'zm' =>    'Zambia',
+        'zr' =>    'Zaire',
+        'zw' =>    'Zimbabwe');
     /**
      * returns all available country codes
      *
diff --git a/lib/Doctrine/Validator/Exception.php b/lib/Doctrine/Validator/Exception.php
index 54dc0fd42..9dc7ebd0c 100644
--- a/lib/Doctrine/Validator/Exception.php
+++ b/lib/Doctrine/Validator/Exception.php
@@ -73,7 +73,7 @@ class Doctrine_Validator_Exception extends Doctrine_Exception implements Countab
     private function generateMessage()
     {
         $message = "";
-        foreach ($this->invalid as $record){
+        foreach ($this->invalid as $record) {
            $message .= "Validaton error in class " . get_class($record) . " ";
         }
         return $message;
diff --git a/lib/Doctrine/Validator/Regexp.php b/lib/Doctrine/Validator/Regexp.php
index 0aca2d195..742440099 100644
--- a/lib/Doctrine/Validator/Regexp.php
+++ b/lib/Doctrine/Validator/Regexp.php
@@ -41,9 +41,9 @@ class Doctrine_Validator_Regexp
      */
     public function validate($value)
     {
-    	if ( ! isset($this->args)) {
-    	   return true;
-    	}
+        if ( ! isset($this->args)) {
+           return true;
+        }
         if (is_array($this->args)) {
             foreach ($this->args as $regexp) {
                 if ( ! preg_match($regexp, $value)) {
diff --git a/lib/Doctrine/Validator/Unique.php b/lib/Doctrine/Validator/Unique.php
index 5e92f1eb5..4e58de10b 100644
--- a/lib/Doctrine/Validator/Unique.php
+++ b/lib/Doctrine/Validator/Unique.php
@@ -56,7 +56,7 @@ class Doctrine_Validator_Unique
         // unique value already exists in the database IF the record in the database is the same
         // as the one that is validated here.
         $state = $this->invoker->state();
-        if (! ($state == Doctrine_Record::STATE_TDIRTY || $state == Doctrine_Record::STATE_TCLEAN)) {
+        if ( ! ($state == Doctrine_Record::STATE_TDIRTY || $state == Doctrine_Record::STATE_TCLEAN)) {
             foreach ($table->getPrimaryKeys() as $pk) {
                 $sql .= " AND {$pk} != ?";
                 $values[] = $this->invoker->$pk;
diff --git a/lib/Doctrine/Validator/Usstate.php b/lib/Doctrine/Validator/Usstate.php
index 13874d04b..a9397fbce 100644
--- a/lib/Doctrine/Validator/Usstate.php
+++ b/lib/Doctrine/Validator/Usstate.php
@@ -33,7 +33,7 @@
 class Doctrine_Validator_Usstate
 {
     private static $states = array (
-                'AK' =>	true,
+                'AK' =>    true,
                 'AL' => true,
                 'AR' => true,
                 'AZ' => true,
@@ -84,8 +84,8 @@ class Doctrine_Validator_Usstate
                 'VT' => true,
                 'WA' => true,
                 'WI' => true,
-                'WV' =>	true,
-                'WY' =>	true
+                'WV' =>    true,
+                'WY' =>    true
             );
     public function getStates()
     {
diff --git a/tests/AuditLogTestCase.php b/tests/AuditLogTestCase.php
index 866b14755..03f6bf826 100644
--- a/tests/AuditLogTestCase.php
+++ b/tests/AuditLogTestCase.php
@@ -38,8 +38,8 @@ class Doctrine_AuditLog_TestCase extends Doctrine_UnitTestCase
 
     public function prepareTables()
     { 
-    	$this->profiler = new Doctrine_Connection_Profiler();
-    	$this->conn->addListener($this->profiler);
+        $this->profiler = new Doctrine_Connection_Profiler();
+        $this->conn->addListener($this->profiler);
         $this->tables = array('VersioningTest', 'VersioningTestVersion');
         
         parent::prepareTables();
diff --git a/tests/CacheTestCase.php b/tests/CacheTestCase.php
index 389a56e1d..a436abcb1 100644
--- a/tests/CacheTestCase.php
+++ b/tests/CacheTestCase.php
@@ -49,11 +49,11 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
     */
     public function testAdapterQueryChecksCache()
     {
-    	$query = 'SELECT * FROM user';
+        $query = 'SELECT * FROM user';
 
         $resultSet = array(array('name' => 'John'), array('name' => 'Arnold'));
 
-    	$this->cache->getDriver()->save(md5(serialize($query)), $resultSet);
+        $this->cache->getDriver()->save(md5(serialize($query)), $resultSet);
 
         $count = $this->dbh->getAdapter()->count();
 
@@ -65,11 +65,11 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
     }
     public function testAdapterStatementExecuteChecksCache()
     {
-    	$query  = 'SELECT * FROM user WHERE id = ?';
+        $query  = 'SELECT * FROM user WHERE id = ?';
         $params = array(1);
         $resultSet = array(array('name' => 'John'), array('name' => 'Arnold'));
 
-    	$this->cache->getDriver()->save(md5(serialize(array($query, $params))), $resultSet);
+        $this->cache->getDriver()->save(md5(serialize(array($query, $params))), $resultSet);
 
         $count = $this->dbh->getAdapter()->count();
 
@@ -115,13 +115,13 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
     }
     public function testAdapterStatementExecuteAddsQueriesToCache()
     {
-    	$this->cache->setOption('savePropability', 1);
+        $this->cache->setOption('savePropability', 1);
 
-    	$driver = $this->cache->getDriver();
+        $driver = $this->cache->getDriver();
 
-    	$driver->deleteAll();
+        $driver->deleteAll();
 
-    	$this->assertEqual($driver->count(), 0);
+        $this->assertEqual($driver->count(), 0);
 
         $stmt = $this->dbh->prepare('SELECT * FROM user WHERE id = ?');
 
@@ -131,9 +131,9 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
     }
     public function testAppendStatsWritesQueriesToStatsFile()
     {
-    	$this->cache->setOption('addStatsPropability', 1);
-    	
-    	$data = array(1,2,3);
+        $this->cache->setOption('addStatsPropability', 1);
+        
+        $data = array(1,2,3);
 
         $this->cache->add('SELECT * FROM user');
         $this->cache->add(array('SELECT * FROM user WHERE id = ?', array(1)));
@@ -147,7 +147,7 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
     }
     public function testCleanRemovesDriver()
     {
-    	$this->cache->setOption('cleanPropability', 1);
+        $this->cache->setOption('cleanPropability', 1);
 
         $this->cache->add('SELECT * FROM user');
         $this->cache->add(array('SELECT * FROM user WHERE id = ?', array(1)));
@@ -164,7 +164,7 @@ class Doctrine_Cache_TestCase extends Doctrine_UnitTestCase
     {
         parent::setUp();
 
-    	if ( ! isset($this->cache)) {
+        if ( ! isset($this->cache)) {
             $this->cache = new Doctrine_Cache('Array');
             $this->cache->setOption('cacheFile', false);
             $this->cache->setOption('savePropability', 0);
diff --git a/tests/Collection/SnapshotTestCase.php b/tests/Collection/SnapshotTestCase.php
index 2a7bf8ca2..3daa954fc 100644
--- a/tests/Collection/SnapshotTestCase.php
+++ b/tests/Collection/SnapshotTestCase.php
@@ -40,9 +40,9 @@ class Doctrine_Collection_Snapshot_TestCase extends Doctrine_UnitTestCase
 {
     public function prepareTables()
     {
-    	$this->tables = array('Entity', 'User', 'Group', 'GroupUser', 'Account', 'Album', 'Phonenumber', 'Email', 'Book');
-    	
-    	parent::prepareTables();
+        $this->tables = array('Entity', 'User', 'Group', 'GroupUser', 'Account', 'Album', 'Phonenumber', 'Email', 'Book');
+        
+        parent::prepareTables();
     }
 
     public function testDiffForSimpleCollection()
diff --git a/tests/ConfigurableTestCase.php b/tests/ConfigurableTestCase.php
index efd8c4a3d..0d2333159 100644
--- a/tests/ConfigurableTestCase.php
+++ b/tests/ConfigurableTestCase.php
@@ -121,7 +121,7 @@ class Doctrine_Configurable_TestCase extends Doctrine_UnitTestCase {
                            Doctrine::PORTABILITY_RTRIM | Doctrine::PORTABILITY_FIX_CASE);
     }
     public function testDefaultListenerIsDoctrineEventListener() {
-        $this->assertTrue($this->manager->getAttribute(Doctrine::ATTR_LISTENER) instanceof Doctrine_EventListener);                                                                 	
+        $this->assertTrue($this->manager->getAttribute(Doctrine::ATTR_LISTENER) instanceof Doctrine_EventListener);                                                                     
     }
     public function testListenerAttributeAcceptsEventListenerObjects() {
         $this->manager->setAttribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_Debugger());
diff --git a/tests/CustomResultSetOrderTestCase.php b/tests/CustomResultSetOrderTestCase.php
index 591445058..f1e6439bf 100644
--- a/tests/CustomResultSetOrderTestCase.php
+++ b/tests/CustomResultSetOrderTestCase.php
@@ -81,7 +81,7 @@ class Doctrine_CustomResultSetOrder_TestCase extends Doctrine_UnitTestCase {
      */
     public function prepareTables() {
         $this->tables[] = "CategoryWithPosition";
-		$this->tables[] = "BoardWithPosition";
+        $this->tables[] = "BoardWithPosition";
         parent::prepareTables();
     }
     /**
diff --git a/tests/DBTestCase.php b/tests/DBTestCase.php
index bcbb93035..259e64ca5 100644
--- a/tests/DBTestCase.php
+++ b/tests/DBTestCase.php
@@ -183,7 +183,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
 
     public function testListeningErrorHandlingMethodsOnExec()
     {
-    	$this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
+        $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
         $listener = $this->conn->getListener()->get(0);
         $this->conn->exec('DELETE FROM unknown');
 
@@ -195,7 +195,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
 
     public function testListeningErrorHandlingMethodsOnQuery()
     {
-    	$this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
+        $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
         $listener = $this->conn->getListener()->get(0);
         $this->conn->execute('DELETE FROM unknown');
 
@@ -207,7 +207,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
 
     public function testListeningErrorHandlingMethodsOnPrepare()
     {
-    	$this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
+        $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
         $listener = $this->conn->getListener()->get(0);
 
         $this->conn->prepare('INSERT INTO unknown (id) VALUES (?)');
@@ -220,7 +220,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
 
     public function testListeningErrorHandlingMethodsOnStatementExecute()
     {
-    	$this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
+        $this->conn->setAttribute(Doctrine::ATTR_THROW_EXCEPTIONS, false);
         $listener = $this->conn->getListener()->get(0);
 
         $stmt = $this->conn->prepare('INSERT INTO entity (id) VALUES (?)');
@@ -315,7 +315,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
     }
     public function testInvalidDSN() 
     {
-    	$manager = Doctrine_Manager::getInstance();
+        $manager = Doctrine_Manager::getInstance();
         try {
             $this->conn = $manager->openConnection('');
             $this->fail();
@@ -337,7 +337,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
     }
     public function testInvalidScheme() 
     {
-    	$manager = Doctrine_Manager::getInstance();
+        $manager = Doctrine_Manager::getInstance();
         try {
             $this->conn = $manager->openConnection('unknown://:memory:');
             $this->fail();
@@ -347,7 +347,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
     }
     public function testInvalidHost() 
     {
-    	$manager = Doctrine_Manager::getInstance();
+        $manager = Doctrine_Manager::getInstance();
         try {
             $this->conn = $manager->openConnection('mysql://user:password@');
             $this->fail();
@@ -357,7 +357,7 @@ class Doctrine_Db_TestCase extends Doctrine_UnitTestCase
     }
     public function testInvalidDatabase() 
     {
-    	$manager = Doctrine_Manager::getInstance();
+        $manager = Doctrine_Manager::getInstance();
         try {
             $this->conn = $manager->openConnection('mysql://user:password@host/');
             $this->fail();
diff --git a/tests/DriverTestCase.php b/tests/DriverTestCase.php
index 84d11de4f..d9e3933df 100644
--- a/tests/DriverTestCase.php
+++ b/tests/DriverTestCase.php
@@ -78,10 +78,10 @@ class AdapterMock implements Doctrine_Adapter_Interface {
     }
     public function lastInsertId()
     {
-    	$this->queries[] = 'LAST_INSERT_ID()';
-    	if ($this->lastInsertIdFail) {
+        $this->queries[] = 'LAST_INSERT_ID()';
+        if ($this->lastInsertIdFail) {
             return null;
-    	} else {
+        } else {
             return 1;
         }
     }
@@ -102,7 +102,7 @@ class AdapterMock implements Doctrine_Adapter_Interface {
             return strtolower($this->name);
     }
     public function setAttribute($attribute, $value) {
-                                   	
+                                       
     }
 }
 class AdapterStatementMock {
diff --git a/tests/ExpressionTestCase.php b/tests/ExpressionTestCase.php
index beda3bb5a..6abb957c5 100644
--- a/tests/ExpressionTestCase.php
+++ b/tests/ExpressionTestCase.php
@@ -40,7 +40,7 @@ class Doctrine_Expression_TestCase extends Doctrine_UnitTestCase
     }
     public function prepareData()
     {
-    	
+        
     }
     public function testSavingWithAnExpression()
     {
diff --git a/tests/Import/MssqlTestCase.php b/tests/Import/MssqlTestCase.php
index 903e9abff..5a72b31a4 100644
--- a/tests/Import/MssqlTestCase.php
+++ b/tests/Import/MssqlTestCase.php
@@ -40,7 +40,7 @@ class Doctrine_Import_Mssql_TestCase extends Doctrine_UnitTestCase
     }
     public function testListTableColumnsExecutesSql()
     {
-    	$this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
+        $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false);
         $this->import->listTableColumns('table');
         
         $this->assertEqual($this->adapter->pop(), "EXEC sp_columns @table_name = table");
diff --git a/tests/Import/Schema/XmlTestCase.php b/tests/Import/Schema/XmlTestCase.php
index d957f3879..5216df890 100644
--- a/tests/Import/Schema/XmlTestCase.php
+++ b/tests/Import/Schema/XmlTestCase.php
@@ -37,16 +37,16 @@ class Doctrine_Import_Schema_Xml_TestCase extends Doctrine_UnitTestCase
         $import = new Doctrine_Import_Schema_Xml();
         $import->importSchema('schema.xml', 'classes');
         
-        if (!file_exists('classes/User.class.php')) {
+        if ( ! file_exists('classes/User.class.php')) {
             $this->fail();
         } else {
             unlink('classes/User.class.php');
         }
         
-        if (!file_exists('classes/Group.class.php')) {
+        if ( ! file_exists('classes/Group.class.php')) {
             $this->fail();
         } else {
             unlink('classes/Group.class.php');
         }
     }
-}
\ No newline at end of file
+}
diff --git a/tests/Import/Schema/YmlTestCase.php b/tests/Import/Schema/YmlTestCase.php
index e982354d5..1a59cd3a9 100644
--- a/tests/Import/Schema/YmlTestCase.php
+++ b/tests/Import/Schema/YmlTestCase.php
@@ -37,16 +37,16 @@ class Doctrine_Import_Schema_Yml_TestCase extends Doctrine_UnitTestCase
         $import = new Doctrine_Import_Schema_Yml();
         $import->importSchema('schema.yml', 'classes');
         
-        if (!file_exists('classes/User.class.php')) {
+        if ( ! file_exists('classes/User.class.php')) {
             $this->fail();
         } else {
             unlink('classes/User.class.php');
         }
         
-        if (!file_exists('classes/Group.class.php')) {
+        if ( ! file_exists('classes/Group.class.php')) {
             $this->fail();
         } else {
             unlink('classes/Group.class.php');
         }
     }
-}
\ No newline at end of file
+}
diff --git a/tests/ImportTestCase.php b/tests/ImportTestCase.php
index 76e66b11c..a080a4cc4 100644
--- a/tests/ImportTestCase.php
+++ b/tests/ImportTestCase.php
@@ -39,7 +39,7 @@ class Doctrine_Import_TestCase extends Doctrine_UnitTestCase
 
     public function testImport()
     {
-    	$this->dbh = new PDO('sqlite::memory:');
+        $this->dbh = new PDO('sqlite::memory:');
 
         $this->dbh->exec('CREATE TABLE import_test_user (id INTEGER PRIMARY KEY, name TEXT)');
 
diff --git a/tests/NestedSet/SingleRootTestCase.php b/tests/NestedSet/SingleRootTestCase.php
index f82875766..b3366555d 100644
--- a/tests/NestedSet/SingleRootTestCase.php
+++ b/tests/NestedSet/SingleRootTestCase.php
@@ -73,12 +73,12 @@ class Doctrine_NestedSet_SingleRoot_TestCase extends Doctrine_UnitTestCase
         $this->assertEqual(1, $desc[0]['level']);
     }
 
-	public function testGetNumberChildren()
-	{
-		$treeMngr = $this->conn->getTable('NestedSetTest_SingleRootNode')->getTree();
+    public function testGetNumberChildren()
+    {
+        $treeMngr = $this->conn->getTable('NestedSetTest_SingleRootNode')->getTree();
         $root = $treeMngr->fetchRoot();
-		$this->assertEqual(1, $root->getNode()->getNumberChildren());
-	}
+        $this->assertEqual(1, $root->getNode()->getNumberChildren());
+    }
     
     public function testGetAncestors()
     {
diff --git a/tests/Query/DriverTestCase.php b/tests/Query/DriverTestCase.php
index 0a08c7b42..252a2a850 100644
--- a/tests/Query/DriverTestCase.php
+++ b/tests/Query/DriverTestCase.php
@@ -39,7 +39,7 @@ class Doctrine_Query_Driver_TestCase extends Doctrine_UnitTestCase
 
     public function testLimitQueriesForPgsql()
     {
-    	$this->dbh = new Doctrine_Adapter_Mock('pgsql');
+        $this->dbh = new Doctrine_Adapter_Mock('pgsql');
 
         $conn = $this->manager->openConnection($this->dbh);
 
@@ -52,7 +52,7 @@ class Doctrine_Query_Driver_TestCase extends Doctrine_UnitTestCase
 
     public function testLimitQueriesForSqlite()
     {
-    	$this->dbh = new Doctrine_Adapter_Mock('sqlite');
+        $this->dbh = new Doctrine_Adapter_Mock('sqlite');
 
         $conn = $this->manager->openConnection($this->dbh);
 
@@ -65,7 +65,7 @@ class Doctrine_Query_Driver_TestCase extends Doctrine_UnitTestCase
     
     public function testLimitQueriesForMysql()
     {
-    	$this->dbh = new Doctrine_Adapter_Mock('mysql');
+        $this->dbh = new Doctrine_Adapter_Mock('mysql');
 
         $conn = $this->manager->openConnection($this->dbh);
 
@@ -78,7 +78,7 @@ class Doctrine_Query_Driver_TestCase extends Doctrine_UnitTestCase
 
     public function testLimitQueriesForOracle()
     {
-    	$this->dbh = new Doctrine_Adapter_Mock('oracle');
+        $this->dbh = new Doctrine_Adapter_Mock('oracle');
 
         $conn = $this->manager->openConnection($this->dbh);
 
@@ -91,7 +91,7 @@ class Doctrine_Query_Driver_TestCase extends Doctrine_UnitTestCase
 
     public function testLimitOffsetQueriesForOracle()
     {
-    	$this->dbh = new Doctrine_Adapter_Mock('oracle');
+        $this->dbh = new Doctrine_Adapter_Mock('oracle');
 
         $conn = $this->manager->openConnection($this->dbh);
 
diff --git a/tests/Query/JoinTestCase.php b/tests/Query/JoinTestCase.php
index 56d963082..66864afcf 100644
--- a/tests/Query/JoinTestCase.php
+++ b/tests/Query/JoinTestCase.php
@@ -64,7 +64,7 @@ class Doctrine_Query_Join_TestCase extends Doctrine_UnitTestCase
 
     public function testQuerySupportsCustomJoins()
     {
-    	$q = new Doctrine_Query();
+        $q = new Doctrine_Query();
 
         $q->select('c.*, c2.*, d.*')
           ->from('Record_Country c')->innerJoin('c.City c2 ON c2.id = 2')
@@ -75,7 +75,7 @@ class Doctrine_Query_Join_TestCase extends Doctrine_UnitTestCase
 
     public function testQuerySupportsCustomJoinsAndWithKeyword()
     {
-    	$q = new Doctrine_Query();
+        $q = new Doctrine_Query();
 
         $q->select('c.*, c2.*, d.*')
           ->from('Record_Country c')->innerJoin('c.City c2 WITH c2.id = 2')
@@ -195,7 +195,7 @@ class Doctrine_Query_Join_TestCase extends Doctrine_UnitTestCase
     
     public function testMapKeywordThrowsExceptionOnNonExistentColumn()
     {
-    	try {
+        try {
             $q = new Doctrine_Query();
             $country = $q->from('Record_Country c LEFT JOIN c.City c2 MAP c2.unknown')->fetchOne();
         
diff --git a/tests/Query/MultiJoin2TestCase.php b/tests/Query/MultiJoin2TestCase.php
index 1a3c77e80..66532907d 100644
--- a/tests/Query/MultiJoin2TestCase.php
+++ b/tests/Query/MultiJoin2TestCase.php
@@ -89,7 +89,7 @@ class Doctrine_Query_MultiJoin2_TestCase extends Doctrine_UnitTestCase
             $categories[0]->subCategories;
             $this->assertEqual($queryCount + 1, $this->connection->count());
         } catch (Doctrine_Exception $e) {
-            $this->fail();                                	
+            $this->fail();                                    
         }
     }
     
diff --git a/tests/Query/MultipleAggregateValueTestCase.php b/tests/Query/MultipleAggregateValueTestCase.php
index e6ee85c93..1eb6f094b 100644
--- a/tests/Query/MultipleAggregateValueTestCase.php
+++ b/tests/Query/MultipleAggregateValueTestCase.php
@@ -35,62 +35,62 @@ class Doctrine_Query_MultipleAggregateValue_TestCase extends Doctrine_UnitTestCa
 {
     public function prepareData() 
     { }
-	public function testInitData()
-	{
-		$user = new User();
-		$user->name = 'jon';
-		
-		$user->Album[0] = new Album();
-		$user->Album[1] = new Album();
-		$user->Album[2] = new Album();
-		
-		$user->Book[0] = new Book();
-		$user->Book[1] = new Book();
-		$user->save();
-	}
-	
-	public function testMultipleAggregateValues()
-	{
-	    $query = new Doctrine_Query();
-		$query->select('u.*, COUNT(DISTINCT b.id) num_books, COUNT(DISTINCT a.id) num_albums');
-		$query->from('User u');
-		$query->leftJoin('u.Album a, u.Book b');
-		$query->where("u.name = 'jon'");
-		$query->limit(1);
-		
-		$user = $query->execute()->getFirst();
-		
-		try {
-			$name = $user->name;
-			$num_albums = $user->Album[0]->num_albums;
-			$num_books = $user->Book[0]->num_books;	
-		} catch (Doctrine_Exception $e) {
-			$this->fail();
-		}
-		
-		$this->assertEqual($num_albums, 3);
-		$this->assertEqual($num_books, 2);
-	}
-	public function testMultipleAggregateValuesWithArrayFetching()
-	{
-	    $query = new Doctrine_Query();
-		$query->select('u.*, COUNT(DISTINCT b.id) num_books, COUNT(DISTINCT a.id) num_albums');
-		$query->from('User u');
-		$query->leftJoin('u.Album a, u.Book b');
-		$query->where("u.name = 'jon'");
-		$query->limit(1);
-		
-		$users = $query->execute(array(), Doctrine::FETCH_ARRAY);
+    public function testInitData()
+    {
+        $user = new User();
+        $user->name = 'jon';
+        
+        $user->Album[0] = new Album();
+        $user->Album[1] = new Album();
+        $user->Album[2] = new Album();
+        
+        $user->Book[0] = new Book();
+        $user->Book[1] = new Book();
+        $user->save();
+    }
+    
+    public function testMultipleAggregateValues()
+    {
+        $query = new Doctrine_Query();
+        $query->select('u.*, COUNT(DISTINCT b.id) num_books, COUNT(DISTINCT a.id) num_albums');
+        $query->from('User u');
+        $query->leftJoin('u.Album a, u.Book b');
+        $query->where("u.name = 'jon'");
+        $query->limit(1);
+        
+        $user = $query->execute()->getFirst();
+        
+        try {
+            $name = $user->name;
+            $num_albums = $user->Album[0]->num_albums;
+            $num_books = $user->Book[0]->num_books;    
+        } catch (Doctrine_Exception $e) {
+            $this->fail();
+        }
+        
+        $this->assertEqual($num_albums, 3);
+        $this->assertEqual($num_books, 2);
+    }
+    public function testMultipleAggregateValuesWithArrayFetching()
+    {
+        $query = new Doctrine_Query();
+        $query->select('u.*, COUNT(DISTINCT b.id) num_books, COUNT(DISTINCT a.id) num_albums');
+        $query->from('User u');
+        $query->leftJoin('u.Album a, u.Book b');
+        $query->where("u.name = 'jon'");
+        $query->limit(1);
+        
+        $users = $query->execute(array(), Doctrine::FETCH_ARRAY);
 
-		try {
-			$name = $users[0]['name'];
-			$num_albums = $users[0]['Album'][0]['num_albums'];
-			$num_books = $users[0]['Book'][0]['num_books'];
-		} catch (Doctrine_Exception $e) {
-			$this->fail();
-		}
+        try {
+            $name = $users[0]['name'];
+            $num_albums = $users[0]['Album'][0]['num_albums'];
+            $num_books = $users[0]['Book'][0]['num_books'];
+        } catch (Doctrine_Exception $e) {
+            $this->fail();
+        }
 
-		$this->assertEqual($num_albums, 3);
-		$this->assertEqual($num_books, 2);
-	}
+        $this->assertEqual($num_albums, 3);
+        $this->assertEqual($num_books, 2);
+    }
 }
diff --git a/tests/Query/OneToOneFetchingTestCase.php b/tests/Query/OneToOneFetchingTestCase.php
index b5ecf7f93..0bdb92839 100644
--- a/tests/Query/OneToOneFetchingTestCase.php
+++ b/tests/Query/OneToOneFetchingTestCase.php
@@ -138,7 +138,7 @@ class Doctrine_Query_OneToOneFetching_TestCase extends Doctrine_UnitTestCase
             $this->assertEqual('freak.png', $board['lastEntry']['author']['visibleRank']['icon']);
                     
         } catch (Doctrine_Exception $e) {
-            $this->fail();                                	
+            $this->fail();                                    
         }
     }
 
@@ -177,7 +177,7 @@ class Doctrine_Query_OneToOneFetching_TestCase extends Doctrine_UnitTestCase
             $this->assertTrue( ! isset($tmpBoard['lastEntry']));
                     
         } catch (Doctrine_Exception $e) {
-            $this->fail();                                	
+            $this->fail();                                    
         }
         
         $board->lastEntryId = $lastEntryId;
@@ -216,7 +216,7 @@ class Doctrine_Query_OneToOneFetching_TestCase extends Doctrine_UnitTestCase
             $this->assertEqual('freak.png', $board['lastEntry']['author']['visibleRank']['icon']);
                     
         } catch (Doctrine_Exception $e) {
-            $this->fail();                                	
+            $this->fail();                                    
         }
     }
 
diff --git a/tests/Query/WhereTestCase.php b/tests/Query/WhereTestCase.php
index 63d026fdd..477f847ae 100644
--- a/tests/Query/WhereTestCase.php
+++ b/tests/Query/WhereTestCase.php
@@ -263,9 +263,9 @@ class Doctrine_Query_Where_TestCase extends Doctrine_UnitTestCase
     }
     public function testEnumValuesWorkInPlaceholders()
     {
-    	$e = new EnumTest;
-    	$e->status = 'verified';
-    	$e->save();
+        $e = new EnumTest;
+        $e->status = 'verified';
+        $e->save();
 
         $q = new Doctrine_Query();
         
diff --git a/tests/QueryTestCase.php b/tests/QueryTestCase.php
index 306c0cb4a..6aed7b45a 100644
--- a/tests/QueryTestCase.php
+++ b/tests/QueryTestCase.php
@@ -49,7 +49,7 @@ class MyQuery extends Doctrine_Query
 {
     public function preQuery()
     {
-    	if ($this->getRoot()->getComponentName() == 'User') {
+        if ($this->getRoot()->getComponentName() == 'User') {
             $this->where('u.id = 4');
         }
     }
diff --git a/tests/Record/LockTestCase.php b/tests/Record/LockTestCase.php
index 6bb1c1717..b061918cd 100644
--- a/tests/Record/LockTestCase.php
+++ b/tests/Record/LockTestCase.php
@@ -5,13 +5,13 @@ class Doctrine_Record_Lock_TestCase extends Doctrine_UnitTestCase {
         $this->tables[] = 'rec1';
         $this->tables[] = 'rec2';
         parent::prepareTables();
-    }    	
+    }        
         
     public function prepareData() { }
     
     public function testDeleteRecords()
     {
-    	$rec1 = new Rec1();
+        $rec1 = new Rec1();
         $rec1->first_name = 'Some name';
         $rec1->Account = new Rec2();
         $rec1->Account->address = 'Some address';
diff --git a/tests/Record/SerializeUnserializeTestCase.php b/tests/Record/SerializeUnserializeTestCase.php
index 120ff8044..eb5132b51 100644
--- a/tests/Record/SerializeUnserializeTestCase.php
+++ b/tests/Record/SerializeUnserializeTestCase.php
@@ -109,7 +109,7 @@ class TestObject
     
     public function __construct($value)
     {
-    	$this->test_field = $value;
+        $this->test_field = $value;
     }
         
 }
diff --git a/tests/Record/StateTestCase.php b/tests/Record/StateTestCase.php
index e06a86757..876ba86f1 100644
--- a/tests/Record/StateTestCase.php
+++ b/tests/Record/StateTestCase.php
@@ -189,18 +189,18 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase
     }
     
     public function testProxyToDirtyToProxy() {
-    	
-    	define('UNAME','someuser') ;
-    	define('UPWD1','123') ;
-    	define('UPWD2','456') ;
-    	define('ULNAME','somelogin') ;
-    	
-    	$user = new User() ;
-    	$user->name      = UNAME ;
-    	$user->password  = UPWD1 ;
-    	$user->loginname = ULNAME ;
-    	$user->save() ;
-    	
+        
+        define('UNAME','someuser') ;
+        define('UPWD1','123') ;
+        define('UPWD2','456') ;
+        define('ULNAME','somelogin') ;
+        
+        $user = new User() ;
+        $user->name      = UNAME ;
+        $user->password  = UPWD1 ;
+        $user->loginname = ULNAME ;
+        $user->save() ;
+        
         $this->assertEqual($user->name,UNAME) ;
         $this->assertEqual($user->password,UPWD1) ;
         $this->assertEqual($user->loginname,ULNAME) ;
@@ -212,13 +212,13 @@ class Doctrine_Record_State_TestCase extends Doctrine_UnitTestCase
         $this->assertEqual($user1->password,UPWD1) ;
         $this->assertEqual($user1->loginname,ULNAME) ;
         
-    	$this->connection->clear() ;
-    	//$this->clearCache() ;
-    	
-    	// now lets fetch partially the object
-		//$users = Doctrine_Query::create($this->connection)->select('u.name')->from('User u')->where("u.name='someuser'")->execute() ;
+        $this->connection->clear() ;
+        //$this->clearCache() ;
+        
+        // now lets fetch partially the object
+        //$users = Doctrine_Query::create($this->connection)->select('u.name')->from('User u')->where("u.name='someuser'")->execute() ;
         //$user2 = $users[0] ;
-		$user2 = $this->connection->queryOne("SELECT u.name FROM User u WHERE u.name = '" . UNAME . "'");
+        $user2 = $this->connection->queryOne("SELECT u.name FROM User u WHERE u.name = '" . UNAME . "'");
         
         // the object should be in state proxy with only 'name' fetched ...
         $this->assertEqual($user2->state(), Doctrine_Record::STATE_PROXY);
diff --git a/tests/Relation/AccessTestCase.php b/tests/Relation/AccessTestCase.php
index c08f4a15d..be3be67d1 100644
--- a/tests/Relation/AccessTestCase.php
+++ b/tests/Relation/AccessTestCase.php
@@ -145,7 +145,7 @@ class Doctrine_Relation_Access_TestCase extends Doctrine_UnitTestCase {
         $other = $this->connection->query($query);
         $check1 = array();
         foreach($other as $oth) {
-            if(!isset($check1[$oth->other_thing_id])) {
+            if( ! isset($check1[$oth->other_thing_id])) {
                 $check1[$oth->other_thing_id] = array();
             }
             $check1[$oth->other_thing_id][$oth->id] = $oth;
@@ -154,7 +154,7 @@ class Doctrine_Relation_Access_TestCase extends Doctrine_UnitTestCase {
         $ones = $this->connection->query($query);
         $check2 = array();
         foreach($ones as $one) {
-            if(!isset($check2[$one->one_thing_id])) {
+            if( ! isset($check2[$one->one_thing_id])) {
                 $check2[$one->one_thing_id] = array();
             }
             $check2[$one->one_thing_id][$one->id] = $one;
diff --git a/tests/Relation/CircularSavingTestCase.php b/tests/Relation/CircularSavingTestCase.php
index 8c26f36d4..b1c0b7f1b 100644
--- a/tests/Relation/CircularSavingTestCase.php
+++ b/tests/Relation/CircularSavingTestCase.php
@@ -43,8 +43,8 @@ class Doctrine_Relation_CircularSaving_TestCase extends Doctrine_UnitTestCase
         parent::prepareTables();
     }
 
-	public function testMultiplePrimaryKeys()
-	{
+    public function testMultiplePrimaryKeys()
+    {
         $r = new Doctrine_Collection('NestReference');
         $r[0]->parent_id = 1;
         $r[0]->child_id = 2;
diff --git a/tests/Relation/ManyToMany2TestCase.php b/tests/Relation/ManyToMany2TestCase.php
index 136ecca35..e5be52dce 100644
--- a/tests/Relation/ManyToMany2TestCase.php
+++ b/tests/Relation/ManyToMany2TestCase.php
@@ -32,40 +32,40 @@
  */
 class Doctrine_Relation_ManyToMany2_TestCase extends Doctrine_UnitTestCase 
 {
-	public function prepareData() 
+    public function prepareData() 
     {
-	}
-	
+    }
+    
     public function prepareTables() 
     {
-    	$this->tables = array('TestUser', 'TestMovie', 'TestMovieUserBookmark', 'TestMovieUserVote');
+        $this->tables = array('TestUser', 'TestMovie', 'TestMovieUserBookmark', 'TestMovieUserVote');
         parent::prepareTables();
     }
     
     public function testManyToManyCreateSelectAndUpdate() 
     {
-    	$user = new TestUser();
+        $user = new TestUser();
         $user['name'] = 'tester';
         $user->save();
-    	
-    	$data = new TestMovie();
-    	$data['name'] = 'movie';
-    	$data['User'] =  $user;
-    	$data['MovieBookmarks'][0] = $user;
-    	$data['MovieVotes'][0] = $user;
-    	$data->save(); //All ok here
+        
+        $data = new TestMovie();
+        $data['name'] = 'movie';
+        $data['User'] =  $user;
+        $data['MovieBookmarks'][0] = $user;
+        $data['MovieVotes'][0] = $user;
+        $data->save(); //All ok here
         
         $this->conn->clear();
 
-    	$q = new Doctrine_Query();
-    	$newdata = $q->select('m.*')
-    	 			 ->from('TestMovie m')
-	 				 ->execute()
-	 				 ->getFirst();	 
-    	$newdata['name'] = 'movie2';	
-    	try {
-			$newdata->save(); //big failure here
-			$this->pass();
+        $q = new Doctrine_Query();
+        $newdata = $q->select('m.*')
+                      ->from('TestMovie m')
+                      ->execute()
+                      ->getFirst();     
+        $newdata['name'] = 'movie2';    
+        try {
+            $newdata->save(); //big failure here
+            $this->pass();
         } catch(Doctrine_Exception $e) {
             $this->fail();
         }
diff --git a/tests/RelationTestCase.php b/tests/RelationTestCase.php
index a2f3db474..bdc1f29e5 100644
--- a/tests/RelationTestCase.php
+++ b/tests/RelationTestCase.php
@@ -84,7 +84,7 @@ class Doctrine_Relation_TestCase extends Doctrine_UnitTestCase
 
     public function testUnlinkSupportsOneToManyRelations()
     {
-    	$this->conn->clear();
+        $this->conn->clear();
 
         $users = Doctrine_Query::create()->from('User u')->where('u.name = ?', array('zYne'))->execute();
         
diff --git a/tests/SchemaTestCase.php b/tests/SchemaTestCase.php
index c20033329..d802587ba 100644
--- a/tests/SchemaTestCase.php
+++ b/tests/SchemaTestCase.php
@@ -9,15 +9,15 @@
 class Doctrine_Schema_TestCase extends Doctrine_UnitTestCase 
 { 
 
-	public function testEverySchemaObjectIsThrowingExceptionOnNonPropertyAssignment()
+    public function testEverySchemaObjectIsThrowingExceptionOnNonPropertyAssignment()
     {
-    	$isException = false;     
-    	$obj = new Doctrine_Schema();
-    	try {
-    		$obj->no_such_property = 'this should throw an exception';
-    	} catch (Doctrine_Schema_Exception $e)
+        $isException = false;     
+        $obj = new Doctrine_Schema();
+        try {
+            $obj->no_such_property = 'this should throw an exception';
+        } catch (Doctrine_Schema_Exception $e)
         {
-        	$isException = true;
+            $isException = true;
         }
         $this->assertTrue($isException);
 
@@ -62,7 +62,7 @@ class Doctrine_Schema_TestCase extends Doctrine_UnitTestCase
         $this->assertTrue($isException);
     }
 
-	public function testEverySchemaObjectIsThrowingExceptionOnNonPropertyAccess()
+    public function testEverySchemaObjectIsThrowingExceptionOnNonPropertyAccess()
     {
         $isException = false;     
         $obj = new Doctrine_Schema();
@@ -181,19 +181,19 @@ class Doctrine_Schema_TestCase extends Doctrine_UnitTestCase
     
     public function testSchemaIsTraversable()
     {
-    	/* @todo complete 
+        /* @todo complete 
         
-    	$schema = new Doctrine_Schema();
+        $schema = new Doctrine_Schema();
 
         foreach($schema as $key => $db)
         {
             $this->assertEqual($db->name, $key);
-        	foreach($db as $key => $table)
+            foreach($db as $key => $table)
             {
                 $this->assertEqual($table->name, $key);
-            	foreach($table as $key => $col)
+                foreach($table as $key => $col)
                 {
-                	$this->assertEqual($col->name, $key);
+                    $this->assertEqual($col->name, $key);
                 }
             }
         }        
diff --git a/tests/Search/IndexerTestCase.php b/tests/Search/IndexerTestCase.php
index 0d578c20d..0454b6afe 100644
--- a/tests/Search/IndexerTestCase.php
+++ b/tests/Search/IndexerTestCase.php
@@ -43,8 +43,8 @@ class Doctrine_Search_Indexer_TestCase extends Doctrine_UnitTestCase
 
     public function testIndexexCanRecursivelyIndexDirectories()
     {
-    	$profiler = new Doctrine_Connection_Profiler();
-    	$this->conn->addListener($profiler);
+        $profiler = new Doctrine_Connection_Profiler();
+        $this->conn->addListener($profiler);
 
         $indexer = new Doctrine_Search_Indexer();
 
diff --git a/tests/Search/QueryTestCase.php b/tests/Search/QueryTestCase.php
index c48886d5a..8acbf87f7 100644
--- a/tests/Search/QueryTestCase.php
+++ b/tests/Search/QueryTestCase.php
@@ -43,14 +43,14 @@ class Doctrine_Search_Query_TestCase extends Doctrine_UnitTestCase
 
     public function testInitData()
     {
-    	$e = new SearchTest();
+        $e = new SearchTest();
 
         $e->title = 'Once there was an ORM framework';
         $e->content = 'There are many ORM frameworks, but nevertheless we decided to create one.';
 
         $e->save();
 
-    	$e = new SearchTest();
+        $e = new SearchTest();
 
         $e->title = 'Doctrine development continues';
         $e->content = 'The development has been going well so far.';
diff --git a/tests/SearchTestCase.php b/tests/SearchTestCase.php
index fc00c29f3..3bdd80a04 100644
--- a/tests/SearchTestCase.php
+++ b/tests/SearchTestCase.php
@@ -53,7 +53,7 @@ class Doctrine_Search_TestCase extends Doctrine_UnitTestCase
     }
     public function testSavingEntriesUpdatesIndex()
     {
-    	$e = new SearchTest();
+        $e = new SearchTest();
 
         $e->title = 'Once there was an ORM framework';
         $e->content = 'There are many ORM frameworks, but nevertheless we decided to create one.';
diff --git a/tests/Sequence/SqliteTestCase.php b/tests/Sequence/SqliteTestCase.php
index 792f3a831..7ffb1ab40 100644
--- a/tests/Sequence/SqliteTestCase.php
+++ b/tests/Sequence/SqliteTestCase.php
@@ -34,7 +34,7 @@ class Doctrine_Sequence_Sqlite_TestCase extends Doctrine_UnitTestCase
 {
     public function testCurrIdExecutesSql() 
     {
-     	$this->adapter->forceLastInsertIdFail(false);
+         $this->adapter->forceLastInsertIdFail(false);
 
         $this->sequence->currId('user');
 
diff --git a/tests/SequenceTestCase.php b/tests/SequenceTestCase.php
index 572b41ca5..1222fe1c3 100644
--- a/tests/SequenceTestCase.php
+++ b/tests/SequenceTestCase.php
@@ -40,7 +40,7 @@ class Doctrine_Sequence_TestCase extends Doctrine_UnitTestCase
     }
     public function testSequencesAreSupportedForRecords()
     {
-    	$this->adapter->forceLastInsertIdFail();
+        $this->adapter->forceLastInsertIdFail();
         $r = new CustomSequenceRecord;
         $r->name = 'custom seq';
         $r->save();
diff --git a/tests/TableTestCase.php b/tests/TableTestCase.php
index 098195f4e..45d1c30d9 100644
--- a/tests/TableTestCase.php
+++ b/tests/TableTestCase.php
@@ -162,10 +162,10 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
         try {
             $record = $this->objTable->find('4', Doctrine::FETCH_ARRAY);
             $this->assertTrue(is_array($record));
-            $this->assertTrue(!is_object($record));
+            $this->assertTrue( ! is_object($record));
             $this->assertTrue(array_key_exists('id', $record));
             $this->assertTrue(array_key_exists('name', $record));
-            $this->assertTrue(! $record instanceof Doctrine_Record);
+            $this->assertTrue( ! $record instanceof Doctrine_Record);
         } catch(Exception $e) {
             $this->assertTrue(false);
         }
@@ -199,9 +199,9 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
         $this->assertTrue($users instanceof Doctrine_Collection);
 
         $users = $this->objTable->findAll(Doctrine::FETCH_ARRAY);
-        $this->assertTrue(! $users instanceof Doctrine_Collection);
+        $this->assertTrue( ! $users instanceof Doctrine_Collection);
         $this->assertTrue(is_array($users));
-        $this->assertTrue(!is_object($users));
+        $this->assertTrue( ! is_object($users));
         $this->assertEqual(count($users), 8);
     }
 
diff --git a/tests/TemplateTestCase.php b/tests/TemplateTestCase.php
index a525d3379..4746cd241 100644
--- a/tests/TemplateTestCase.php
+++ b/tests/TemplateTestCase.php
@@ -39,7 +39,7 @@ class Doctrine_Template_TestCase extends Doctrine_UnitTestCase
 
     public function testAccessingNonExistingImplementationThrowsException()
     {
-    	try {
+        try {
             $user = new ConcreteUser();
             $user->Group;
             $this->fail();
@@ -50,7 +50,7 @@ class Doctrine_Template_TestCase extends Doctrine_UnitTestCase
     
     public function testAccessingExistingImplementationSupportsAssociations()
     {
-    	$this->manager->setImpl('UserTemplate', 'ConcreteUser')
+        $this->manager->setImpl('UserTemplate', 'ConcreteUser')
                       ->setImpl('GroupUserTemplate', 'ConcreteGroupUser')
                       ->setImpl('GroupTemplate', 'ConcreteGroup')
                       ->setImpl('EmailTemplate', 'ConcreteEmail');
diff --git a/tests/Test.php b/tests/Test.php
index 64ab58602..b02fc2534 100644
--- a/tests/Test.php
+++ b/tests/Test.php
@@ -136,12 +136,12 @@ class UnitTestCase
     }
     public function fail($message = "")
     {
-        $this->_fail($message);	
+        $this->_fail($message);    
     }
     public function _fail($message = "")
     {
-    	$trace = debug_backtrace();
-    	array_shift($trace);
+        $trace = debug_backtrace();
+        array_shift($trace);
 
 
         foreach ($trace as $stack) {
@@ -157,7 +157,7 @@ class UnitTestCase
                 break;
             }
             $line = $stack['line'];
-    	}
+        }
         $this->_failed++;
     }
     public function run() 
diff --git a/tests/cc.php b/tests/cc.php
index 37b1a4144..fc0be5a20 100644
--- a/tests/cc.php
+++ b/tests/cc.php
@@ -109,7 +109,7 @@ class Doctrine_Coverage_Report
     {
         $key = $this->path . $fileName;
         $html = '
'; - if (!isset( $this->coverage[$key])) + if ( ! isset( $this->coverage[$key])) { echo '

This file has not been tested!

'; }