Completed
Push — php-cs-fixer ( b6f93e )
by Fabio
07:29
created
framework/Data/Common/Mssql/TMssqlMetaData.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -123,6 +123,7 @@
 block discarded – undo
123 123
 	/**
124 124
 	 * @param TMssqlTableInfo table information.
125 125
 	 * @param array column information.
126
+	 * @param TMssqlTableInfo $tableInfo
126 127
 	 */
127 128
 	protected function processColumn($tableInfo, $col)
128 129
 	{
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	protected function createTableInfo($table)
75 75
 	{
76
-		list($catalogName, $schemaName, $tableName) = $this->getCatalogSchemaTableName($table);
76
+		list($catalogName, $schemaName, $tableName)=$this->getCatalogSchemaTableName($table);
77 77
 		$this->getDbConnection()->setActive(true);
78
-		$sql = <<<EOD
78
+		$sql=<<<EOD
79 79
 				SELECT t.*,
80 80
 												c.*,
81 81
 					columnproperty(object_id(c.table_schema + '.' + c.table_name), c.column_name,'IsIdentity') as IsIdentity
@@ -85,11 +85,11 @@  discard block
 block discarded – undo
85 85
 										AND t.table_name = :table
86 86
 EOD;
87 87
 		if($schemaName!==null)
88
-			$sql .= ' AND t.table_schema = :schema';
88
+			$sql.=' AND t.table_schema = :schema';
89 89
 		if($catalogName!==null)
90
-			$sql .= ' AND t.table_catalog = :catalog';
90
+			$sql.=' AND t.table_catalog = :catalog';
91 91
 
92
-		$command = $this->getDbConnection()->createCommand($sql);
92
+		$command=$this->getDbConnection()->createCommand($sql);
93 93
 		$command->bindValue(':table', $tableName);
94 94
 		if($schemaName!==null)
95 95
 			$command->bindValue(':schema', $schemaName);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		foreach($command->query() as $col)
101 101
 		{
102 102
 			if($tableInfo===null)
103
-				$tableInfo = $this->createNewTableInfo($col);
103
+				$tableInfo=$this->createNewTableInfo($col);
104 104
 			$this->processColumn($tableInfo, $col);
105 105
 		}
106 106
 		if($tableInfo===null)
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
 	protected function getCatalogSchemaTableName($table)
116 116
 	{
117 117
 		//remove possible delimiters
118
-		$result = explode('.', preg_replace('/\[|\]|"/', '', $table));
118
+		$result=explode('.', preg_replace('/\[|\]|"/', '', $table));
119 119
 		if(count($result)===1)
120
-			return [null,null,$result[0]];
120
+			return [null, null, $result[0]];
121 121
 		if(count($result)===2)
122
-			return [null,$result[0],$result[1]];
123
-		if(count($result)>2)
124
-			return [$result[0],$result[1],$result[2]];
122
+			return [null, $result[0], $result[1]];
123
+		if(count($result) > 2)
124
+			return [$result[0], $result[1], $result[2]];
125 125
 	}
126 126
 
127 127
 	/**
@@ -130,31 +130,31 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	protected function processColumn($tableInfo, $col)
132 132
 	{
133
-		$columnId = $col['COLUMN_NAME'];
133
+		$columnId=$col['COLUMN_NAME'];
134 134
 
135
-		$info['ColumnName'] = "[$columnId]"; //quote the column names!
136
-		$info['ColumnId'] = $columnId;
137
-		$info['ColumnIndex'] = intval($col['ORDINAL_POSITION'])-1; //zero-based index
135
+		$info['ColumnName']="[$columnId]"; //quote the column names!
136
+		$info['ColumnId']=$columnId;
137
+		$info['ColumnIndex']=intval($col['ORDINAL_POSITION']) - 1; //zero-based index
138 138
 		if($col['IS_NULLABLE']!=='NO')
139
-			$info['AllowNull'] = true;
139
+			$info['AllowNull']=true;
140 140
 		if($col['COLUMN_DEFAULT']!==null)
141
-			$info['DefaultValue'] = $col['COLUMN_DEFAULT'];
141
+			$info['DefaultValue']=$col['COLUMN_DEFAULT'];
142 142
 
143 143
 		if(in_array($columnId, $tableInfo->getPrimaryKeys()))
144
-			$info['IsPrimaryKey'] = true;
144
+			$info['IsPrimaryKey']=true;
145 145
 		if($this->isForeignKeyColumn($columnId, $tableInfo))
146
-			$info['IsForeignKey'] = true;
146
+			$info['IsForeignKey']=true;
147 147
 
148 148
 		if($col['IsIdentity']==='1')
149
-			$info['AutoIncrement'] = true;
150
-		$info['DbType'] = $col['DATA_TYPE'];
149
+			$info['AutoIncrement']=true;
150
+		$info['DbType']=$col['DATA_TYPE'];
151 151
 		if($col['CHARACTER_MAXIMUM_LENGTH']!==null)
152
-			$info['ColumnSize'] = intval($col['CHARACTER_MAXIMUM_LENGTH']);
153
-		if($col['NUMERIC_PRECISION'] !== null)
154
-			$info['NumericPrecision'] = intval($col['NUMERIC_PRECISION']);
152
+			$info['ColumnSize']=intval($col['CHARACTER_MAXIMUM_LENGTH']);
153
+		if($col['NUMERIC_PRECISION']!==null)
154
+			$info['NumericPrecision']=intval($col['NUMERIC_PRECISION']);
155 155
 		if($col['NUMERIC_SCALE']!==null)
156
-			$info['NumericScale'] = intval($col['NUMERIC_SCALE']);
157
-		$tableInfo->Columns[$columnId] = new TMssqlTableColumn($info);
156
+			$info['NumericScale']=intval($col['NUMERIC_SCALE']);
157
+		$tableInfo->Columns[$columnId]=new TMssqlTableColumn($info);
158 158
 	}
159 159
 
160 160
 	/**
@@ -164,13 +164,13 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	protected function createNewTableInfo($col)
166 166
 	{
167
-		$info['CatalogName'] = $col['TABLE_CATALOG'];
168
-		$info['SchemaName'] = $col['TABLE_SCHEMA'];
169
-		$info['TableName'] = $col['TABLE_NAME'];
167
+		$info['CatalogName']=$col['TABLE_CATALOG'];
168
+		$info['SchemaName']=$col['TABLE_SCHEMA'];
169
+		$info['TableName']=$col['TABLE_NAME'];
170 170
 		if($col['TABLE_TYPE']==='VIEW')
171
-			$info['IsView'] = true;
172
-		list($primary, $foreign) = $this->getConstraintKeys($col);
173
-		$class = $this->getTableInfoClass();
171
+			$info['IsView']=true;
172
+		list($primary, $foreign)=$this->getConstraintKeys($col);
173
+		$class=$this->getTableInfoClass();
174 174
 		return new $class($info, $primary, $foreign);
175 175
 	}
176 176
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	protected function getConstraintKeys($col)
184 184
 	{
185
-		$sql = <<<EOD
185
+		$sql=<<<EOD
186 186
 		SELECT k.column_name field_name
187 187
 				FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE k
188 188
 				LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS c
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 			c.constraint_type ='PRIMARY KEY'
194 194
 				AND k.table_name = :table
195 195
 EOD;
196
-		$command = $this->getDbConnection()->createCommand($sql);
196
+		$command=$this->getDbConnection()->createCommand($sql);
197 197
 		$command->bindValue(':table', $col['TABLE_NAME']);
198
-		$primary = [];
198
+		$primary=[];
199 199
 		foreach($command->query()->readAll() as $field)
200
-			$primary[] = $field['field_name'];
201
-		$foreign = $this->getForeignConstraints($col);
202
-		return [$primary,$foreign];
200
+			$primary[]=$field['field_name'];
201
+		$foreign=$this->getForeignConstraints($col);
202
+		return [$primary, $foreign];
203 203
 	}
204 204
 
205 205
 	/**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	protected function getForeignConstraints($col)
212 212
 	{
213 213
 		//From http://msdn2.microsoft.com/en-us/library/aa175805(SQL.80).aspx
214
-		$sql = <<<EOD
214
+		$sql=<<<EOD
215 215
 		SELECT
216 216
 				KCU1.CONSTRAINT_NAME AS 'FK_CONSTRAINT_NAME'
217 217
 			, KCU1.TABLE_NAME AS 'FK_TABLE_NAME'
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
 			AND KCU2.ORDINAL_POSITION = KCU1.ORDINAL_POSITION
237 237
 		WHERE KCU1.TABLE_NAME = :table
238 238
 EOD;
239
-		$command = $this->getDbConnection()->createCommand($sql);
239
+		$command=$this->getDbConnection()->createCommand($sql);
240 240
 		$command->bindValue(':table', $col['TABLE_NAME']);
241 241
 		$fkeys=[];
242
-		$catalogSchema = "[{$col['TABLE_CATALOG']}].[{$col['TABLE_SCHEMA']}]";
242
+		$catalogSchema="[{$col['TABLE_CATALOG']}].[{$col['TABLE_SCHEMA']}]";
243 243
 		foreach($command->query() as $info)
244 244
 		{
245
-			$fkeys[$info['FK_CONSTRAINT_NAME']]['keys'][$info['FK_COLUMN_NAME']] = $info['UQ_COLUMN_NAME'];
246
-			$fkeys[$info['FK_CONSTRAINT_NAME']]['table'] = $info['UQ_TABLE_NAME'];
245
+			$fkeys[$info['FK_CONSTRAINT_NAME']]['keys'][$info['FK_COLUMN_NAME']]=$info['UQ_COLUMN_NAME'];
246
+			$fkeys[$info['FK_CONSTRAINT_NAME']]['table']=$info['UQ_TABLE_NAME'];
247 247
 		}
248 248
 		return count($fkeys) > 0 ? array_values($fkeys) : $fkeys;
249 249
 	}
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 		$command->bindParam(":schema", $schema);
281 281
 		$rows=$command->queryAll();
282 282
 		$names=[];
283
-		foreach ($rows as $row)
283
+		foreach($rows as $row)
284 284
 		{
285
-			if ($schema == self::DEFAULT_SCHEMA)
285
+			if($schema==self::DEFAULT_SCHEMA)
286 286
 				$names[]=$row['TABLE_NAME'];
287 287
 			else
288
-				$names[]=$schema . '.' . $row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME'];
288
+				$names[]=$schema.'.'.$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME'];
289 289
 		}
290 290
 
291 291
 		return $names;
Please login to merge, or discard this patch.
framework/Data/Common/Mssql/TMssqlTableColumn.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
 	/**
29 29
 	 * Overrides parent implementation, returns PHP type from the db type.
30
-	 * @return boolean derived PHP primitive type from the column db type.
30
+	 * @return string derived PHP primitive type from the column db type.
31 31
 	 */
32 32
 	public function getPHPType()
33 33
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
  */
28 28
 class TMssqlTableColumn extends TDbTableColumn
29 29
 {
30
-	private static $types = [];
30
+	private static $types=[];
31 31
 
32 32
 	/**
33 33
 	 * Overrides parent implementation, returns PHP type from the db type.
Please login to merge, or discard this patch.
framework/Data/Common/Mysql/TMysqlMetaData.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -114,6 +114,7 @@
 block discarded – undo
114 114
 	/**
115 115
 	 * @param TMysqlTableInfo table information.
116 116
 	 * @param array column information.
117
+	 * @param TMysqlTableInfo $tableInfo
117 118
 	 */
118 119
 	protected function processColumn($tableInfo, $col)
119 120
 	{
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -80,24 +80,24 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	protected function createTableInfo($table)
82 82
 	{
83
-		list($schemaName, $tableName) = $this->getSchemaTableName($table);
84
-		$find = $schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
85
-		$colCase = $this->getDbConnection()->getColumnCase();
86
-		if($colCase != TDbColumnCaseMode::Preserved)
83
+		list($schemaName, $tableName)=$this->getSchemaTableName($table);
84
+		$find=$schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
85
+		$colCase=$this->getDbConnection()->getColumnCase();
86
+		if($colCase!=TDbColumnCaseMode::Preserved)
87 87
 			$this->getDbConnection()->setColumnCase('Preserved');
88 88
 		$this->getDbConnection()->setActive(true);
89
-		$sql = "SHOW FULL FIELDS FROM {$find}";
90
-		$command = $this->getDbConnection()->createCommand($sql);
91
-		$tableInfo = $this->createNewTableInfo($table);
89
+		$sql="SHOW FULL FIELDS FROM {$find}";
90
+		$command=$this->getDbConnection()->createCommand($sql);
91
+		$tableInfo=$this->createNewTableInfo($table);
92 92
 		$index=0;
93 93
 		foreach($command->query() as $col)
94 94
 		{
95
-			$col['index'] = $index++;
95
+			$col['index']=$index++;
96 96
 			$this->processColumn($tableInfo, $col);
97 97
 		}
98 98
 		if($index===0)
99 99
 			throw new TDbException('dbmetadata_invalid_table_view', $table);
100
-		if($colCase != TDbColumnCaseMode::Preserved)
100
+		if($colCase!=TDbColumnCaseMode::Preserved)
101 101
 			$this->getDbConnection()->setColumnCase($colCase);
102 102
 		return $tableInfo;
103 103
 	}
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	{
110 110
 		if(!$this->_serverVersion)
111 111
 		{
112
-			$version = $this->getDbConnection()->getAttribute(PDO::ATTR_SERVER_VERSION);
112
+			$version=$this->getDbConnection()->getAttribute(PDO::ATTR_SERVER_VERSION);
113 113
 			$digits=[];
114 114
 			preg_match('/(\d+)\.(\d+)\.(\d+)/', $version, $digits);
115
-			$this->_serverVersion=floatval($digits[1] . '.' . $digits[2] . $digits[3]);
115
+			$this->_serverVersion=floatval($digits[1].'.'.$digits[2].$digits[3]);
116 116
 		}
117 117
 		return $this->_serverVersion;
118 118
 	}
@@ -123,50 +123,50 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	protected function processColumn($tableInfo, $col)
125 125
 	{
126
-		$columnId = $col['Field'];
126
+		$columnId=$col['Field'];
127 127
 
128
-		$info['ColumnName'] = "`$columnId`"; //quote the column names!
129
-		$info['ColumnId'] = $columnId;
130
-		$info['ColumnIndex'] = $col['index'];
128
+		$info['ColumnName']="`$columnId`"; //quote the column names!
129
+		$info['ColumnId']=$columnId;
130
+		$info['ColumnIndex']=$col['index'];
131 131
 		if($col['Null']==='YES')
132
-			$info['AllowNull'] = true;
132
+			$info['AllowNull']=true;
133 133
 		if(is_int(strpos(strtolower($col['Extra']), 'auto_increment')))
134 134
 			$info['AutoIncrement']=true;
135 135
 		if($col['Default']!=="")
136
-			$info['DefaultValue'] = $col['Default'];
136
+			$info['DefaultValue']=$col['Default'];
137 137
 
138 138
 		if($col['Key']==='PRI' || in_array($columnId, $tableInfo->getPrimaryKeys()))
139
-			$info['IsPrimaryKey'] = true;
139
+			$info['IsPrimaryKey']=true;
140 140
 		if($this->isForeignKeyColumn($columnId, $tableInfo))
141
-			$info['IsForeignKey'] = true;
141
+			$info['IsForeignKey']=true;
142 142
 
143
-		$info['DbType'] = $col['Type'];
143
+		$info['DbType']=$col['Type'];
144 144
 		$match=[];
145 145
 		//find SET/ENUM values, column size, precision, and scale
146 146
 		if(preg_match('/\((.*)\)/', $col['Type'], $match))
147 147
 		{
148
-			$info['DbType']= preg_replace('/\(.*\)/', '', $col['Type']);
148
+			$info['DbType']=preg_replace('/\(.*\)/', '', $col['Type']);
149 149
 
150 150
 			//find SET/ENUM values
151 151
 			if($this->isEnumSetType($info['DbType']))
152
-				$info['DbTypeValues'] = preg_split("/[',]/S", $match[1], -1, PREG_SPLIT_NO_EMPTY);
152
+				$info['DbTypeValues']=preg_split("/[',]/S", $match[1], -1, PREG_SPLIT_NO_EMPTY);
153 153
 
154 154
 			//find column size, precision and scale
155
-			$pscale = [];
155
+			$pscale=[];
156 156
 			if(preg_match('/(\d+)(?:,(\d+))?+/', $match[1], $pscale))
157 157
 			{
158 158
 				if($this->isPrecisionType($info['DbType']))
159 159
 				{
160
-					$info['NumericPrecision'] = intval($pscale[1]);
160
+					$info['NumericPrecision']=intval($pscale[1]);
161 161
 					if(count($pscale) > 2)
162
-						$info['NumericScale'] = intval($pscale[2]);
162
+						$info['NumericScale']=intval($pscale[2]);
163 163
 				}
164 164
 				else
165
-					$info['ColumnSize'] = intval($pscale[1]);
165
+					$info['ColumnSize']=intval($pscale[1]);
166 166
 			}
167 167
 		}
168 168
 
169
-		$tableInfo->Columns[$columnId] = new TMysqlTableColumn($info);
169
+		$tableInfo->Columns[$columnId]=new TMysqlTableColumn($info);
170 170
 	}
171 171
 
172 172
 	/**
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 */
175 175
 	protected function isPrecisionType($type)
176 176
 	{
177
-		$type = strtolower(trim($type));
177
+		$type=strtolower(trim($type));
178 178
 		return $type==='decimal' || $type==='dec'
179 179
 				|| $type==='float' || $type==='double'
180 180
 				|| $type==='double precision' || $type==='real';
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	protected function isEnumSetType($type)
187 187
 	{
188
-		$type = strtolower(trim($type));
188
+		$type=strtolower(trim($type));
189 189
 		return $type==='set' || $type==='enum';
190 190
 	}
191 191
 
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 	protected function getSchemaTableName($table)
198 198
 	{
199 199
 		//remove the back ticks and separate out the "database.table"
200
-		$result = explode('.', str_replace('`', '', $table));
200
+		$result=explode('.', str_replace('`', '', $table));
201 201
 		foreach($result as $name)
202 202
 		{
203 203
 			if(!$this->isValidIdentifier($name))
204 204
 			{
205
-				$ref = 'http://dev.mysql.com/doc/refman/5.0/en/identifiers.html';
205
+				$ref='http://dev.mysql.com/doc/refman/5.0/en/identifiers.html';
206 206
 				throw new TDbException('dbcommon_invalid_identifier_name', $table, $ref);
207 207
 			}
208 208
 		}
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	protected function createNewTableInfo($table)
228 228
 	{
229
-		list($schemaName, $tableName) = $this->getSchemaTableName($table);
230
-		$info['SchemaName'] = $schemaName;
231
-		$info['TableName'] = $tableName;
229
+		list($schemaName, $tableName)=$this->getSchemaTableName($table);
230
+		$info['SchemaName']=$schemaName;
231
+		$info['TableName']=$tableName;
232 232
 		if($this->getIsView($schemaName, $tableName))
233
-			$info['IsView'] = true;
234
-		list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName);
235
-		$class = $this->getTableInfoClass();
233
+			$info['IsView']=true;
234
+		list($primary, $foreign)=$this->getConstraintKeys($schemaName, $tableName);
235
+		$class=$this->getTableInfoClass();
236 236
 		return new $class($info, $primary, $foreign);
237 237
 	}
238 238
 
@@ -248,22 +248,22 @@  discard block
 block discarded – undo
248 248
 	 */
249 249
 	protected function getIsView($schemaName, $tableName)
250 250
 	{
251
-		if($this->getServerVersion()<5.01)
251
+		if($this->getServerVersion() < 5.01)
252 252
 			return false;
253 253
 		if($schemaName!==null)
254
-			$sql = "SHOW FULL TABLES FROM `{$schemaName}` LIKE :table";
254
+			$sql="SHOW FULL TABLES FROM `{$schemaName}` LIKE :table";
255 255
 		else
256
-			$sql = "SHOW FULL TABLES LIKE :table";
256
+			$sql="SHOW FULL TABLES LIKE :table";
257 257
 
258
-		$command = $this->getDbConnection()->createCommand($sql);
258
+		$command=$this->getDbConnection()->createCommand($sql);
259 259
 		$command->bindValue(':table', $tableName);
260 260
 		try
261 261
 		{
262
-			return count($result = $command->queryRow()) > 0 && $result['Table_type']==='VIEW';
262
+			return count($result=$command->queryRow()) > 0 && $result['Table_type']==='VIEW';
263 263
 		}
264 264
 		catch(TDbException $e)
265 265
 		{
266
-			$table = $schemaName===null?$tableName:$schemaName . '.' . $tableName;
266
+			$table=$schemaName===null ? $tableName : $schemaName.'.'.$tableName;
267 267
 			throw new TDbException('dbcommon_invalid_table_name', $table, $e->getMessage());
268 268
 		}
269 269
 	}
@@ -276,22 +276,22 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	protected function getConstraintKeys($schemaName, $tableName)
278 278
 	{
279
-		$table = $schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
280
-		$sql = "SHOW INDEX FROM {$table}";
281
-		$command = $this->getDbConnection()->createCommand($sql);
282
-		$primary = [];
279
+		$table=$schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
280
+		$sql="SHOW INDEX FROM {$table}";
281
+		$command=$this->getDbConnection()->createCommand($sql);
282
+		$primary=[];
283 283
 		foreach($command->query() as $row)
284 284
 		{
285 285
 			if($row['Key_name']==='PRIMARY')
286
-				$primary[] = $row['Column_name'];
286
+				$primary[]=$row['Column_name'];
287 287
 		}
288 288
 				// MySQL version was increased to >=5.1.21 instead of 5.x
289 289
 				// due to a MySQL bug (http://bugs.mysql.com/bug.php?id=19588)
290 290
 		if($this->getServerVersion() >= 5.121)
291
-			$foreign = $this->getForeignConstraints($schemaName, $tableName);
291
+			$foreign=$this->getForeignConstraints($schemaName, $tableName);
292 292
 		else
293
-			$foreign = $this->findForeignConstraints($schemaName, $tableName);
294
-		return [$primary,$foreign];
293
+			$foreign=$this->findForeignConstraints($schemaName, $tableName);
294
+		return [$primary, $foreign];
295 295
 	}
296 296
 
297 297
 	/**
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 	 */
303 303
 	protected function getForeignConstraints($schemaName, $tableName)
304 304
 	{
305
-		$andSchema = $schemaName !== null ? 'AND TABLE_SCHEMA LIKE :schema' : 'AND TABLE_SCHEMA LIKE DATABASE()';
306
-		$sql = <<<EOD
305
+		$andSchema=$schemaName!==null ? 'AND TABLE_SCHEMA LIKE :schema' : 'AND TABLE_SCHEMA LIKE DATABASE()';
306
+		$sql=<<<EOD
307 307
 			SELECT
308 308
 				CONSTRAINT_NAME as con,
309 309
 				COLUMN_NAME as col,
@@ -317,15 +317,15 @@  discard block
 block discarded – undo
317 317
 				AND TABLE_NAME LIKE :table
318 318
 				$andSchema
319 319
 EOD;
320
-		$command = $this->getDbConnection()->createCommand($sql);
320
+		$command=$this->getDbConnection()->createCommand($sql);
321 321
 		$command->bindValue(':table', $tableName);
322 322
 		if($schemaName!==null)
323 323
 			$command->bindValue(':schema', $schemaName);
324 324
 		$fkeys=[];
325 325
 		foreach($command->query() as $col)
326 326
 		{
327
-			$fkeys[$col['con']]['keys'][$col['col']] = $col['fkcol'];
328
-			$fkeys[$col['con']]['table'] = $col['fktable'];
327
+			$fkeys[$col['con']]['keys'][$col['col']]=$col['fkcol'];
328
+			$fkeys[$col['con']]['table']=$col['fktable'];
329 329
 		}
330 330
 		return count($fkeys) > 0 ? array_values($fkeys) : $fkeys;
331 331
 	}
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
 		//See http://netevil.org/node.php?nid=795&SC=1
345 345
 		$this->getDbConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
346 346
 		if($schemaName!==null)
347
-			$sql = "SHOW CREATE TABLE `{$schemaName}`.`{$tableName}`";
347
+			$sql="SHOW CREATE TABLE `{$schemaName}`.`{$tableName}`";
348 348
 		else
349
-			$sql = "SHOW CREATE TABLE `{$tableName}`";
350
-		$command = $this->getDbConnection()->createCommand($sql);
351
-		$result = $command->queryRow();
349
+			$sql="SHOW CREATE TABLE `{$tableName}`";
350
+		$command=$this->getDbConnection()->createCommand($sql);
351
+		$result=$command->queryRow();
352 352
 		return isset($result['Create Table']) ? $result['Create Table'] : (isset($result['Create View']) ? $result['Create View'] : '');
353 353
 	}
354 354
 
@@ -360,19 +360,19 @@  discard block
 block discarded – undo
360 360
 	 */
361 361
 	protected function findForeignConstraints($schemaName, $tableName)
362 362
 	{
363
-		$sql = $this->getShowCreateTable($schemaName, $tableName);
364
-		$matches =[];
365
-		$regexp = '/FOREIGN KEY\s+\(([^\)]+)\)\s+REFERENCES\s+`?([^`]+)`?\s\(([^\)]+)\)/mi';
363
+		$sql=$this->getShowCreateTable($schemaName, $tableName);
364
+		$matches=[];
365
+		$regexp='/FOREIGN KEY\s+\(([^\)]+)\)\s+REFERENCES\s+`?([^`]+)`?\s\(([^\)]+)\)/mi';
366 366
 		preg_match_all($regexp, $sql, $matches, PREG_SET_ORDER);
367
-		$foreign = [];
367
+		$foreign=[];
368 368
 		foreach($matches as $match)
369 369
 		{
370
-			$fields = array_map('trim', explode(',', str_replace('`', '', $match[1])));
371
-			$fk_fields = array_map('trim', explode(',', str_replace('`', '', $match[3])));
370
+			$fields=array_map('trim', explode(',', str_replace('`', '', $match[1])));
371
+			$fk_fields=array_map('trim', explode(',', str_replace('`', '', $match[3])));
372 372
 			$keys=[];
373 373
 			foreach($fields as $k=>$v)
374
-				$keys[$v] = $fk_fields[$k];
375
-			$foreign[] = ['keys' => $keys, 'table' => trim($match[2])];
374
+				$keys[$v]=$fk_fields[$k];
375
+			$foreign[]=['keys' => $keys, 'table' => trim($match[2])];
376 376
 		}
377 377
 		return $foreign;
378 378
 	}
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
 	{
403 403
 		if($schema==='')
404 404
 			return $this->getDbConnection()->createCommand('SHOW TABLES')->queryColumn();
405
-		$names=$this->getDbConnection()->createCommand('SHOW TABLES FROM ' . $this->quoteTableName($schema))->queryColumn();
405
+		$names=$this->getDbConnection()->createCommand('SHOW TABLES FROM '.$this->quoteTableName($schema))->queryColumn();
406 406
 		foreach($names as &$name)
407
-			$name=$schema . '.' . $name;
407
+			$name=$schema.'.'.$name;
408 408
 		return $names;
409 409
 	}
410 410
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -160,8 +160,7 @@  discard block
 block discarded – undo
160 160
 					$info['NumericPrecision'] = intval($pscale[1]);
161 161
 					if(count($pscale) > 2)
162 162
 						$info['NumericScale'] = intval($pscale[2]);
163
-				}
164
-				else
163
+				} else
165 164
 					$info['ColumnSize'] = intval($pscale[1]);
166 165
 			}
167 166
 		}
@@ -260,8 +259,7 @@  discard block
 block discarded – undo
260 259
 		try
261 260
 		{
262 261
 			return count($result = $command->queryRow()) > 0 && $result['Table_type']==='VIEW';
263
-		}
264
-		catch(TDbException $e)
262
+		} catch(TDbException $e)
265 263
 		{
266 264
 			$table = $schemaName===null?$tableName:$schemaName . '.' . $tableName;
267 265
 			throw new TDbException('dbcommon_invalid_table_name', $table, $e->getMessage());
Please login to merge, or discard this patch.
framework/Data/Common/Pgsql/TPgsqlMetaData.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -204,6 +204,7 @@
 block discarded – undo
204 204
 	/**
205 205
 	 * @param TPgsqlTableInfo table information.
206 206
 	 * @param array column information.
207
+	 * @param TPgsqlTableInfo $tableInfo
207 208
 	 */
208 209
 	protected function processColumn($tableInfo, $col)
209 210
 	{
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -244,11 +244,9 @@
 block discarded – undo
244 244
 				$info['NumericPrecision'] = intval($matches[1]);
245 245
 				if(count($matches) > 2)
246 246
 					$info['NumericScale'] = intval($matches[2]);
247
-			}
248
-			else
247
+			} else
249 248
 				$info['ColumnSize'] = intval($matches[1]);
250
-		}
251
-		else
249
+		} else
252 250
 			$info['DbType'] = $col['type'];
253 251
 
254 252
 		$tableInfo->Columns[$columnId] = new TPgsqlTableColumn($info);
Please login to merge, or discard this patch.
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
  */
29 29
 class TPgsqlMetaData extends TDbMetaData
30 30
 {
31
-	private $_defaultSchema = 'public';
31
+	private $_defaultSchema='public';
32 32
 
33 33
 	/**
34 34
 	 * @return string TDbTableInfo class name.
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	protected function getSchemaTableName($table)
92 92
 	{
93
-		if(count($parts= explode('.', str_replace('"', '', $table))) > 1)
93
+		if(count($parts=explode('.', str_replace('"', '', $table))) > 1)
94 94
 			return [$parts[0], $parts[1]];
95 95
 		else
96
-			return [$this->getDefaultSchema(),$parts[0]];
96
+			return [$this->getDefaultSchema(), $parts[0]];
97 97
 	}
98 98
 
99 99
 	/**
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function createTableInfo($table)
105 105
 	{
106
-		list($schemaName, $tableName) = $this->getSchemaTableName($table);
106
+		list($schemaName, $tableName)=$this->getSchemaTableName($table);
107 107
 
108 108
 		// This query is made much more complex by the addition of the 'attisserial' field.
109 109
 		// The subquery to get that field checks to see if there is an internally dependent
110 110
 		// sequence on the field.
111
-		$sql =
111
+		$sql=
112 112
 <<<EOD
113 113
 		SELECT
114 114
 			a.attname,
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 		ORDER BY a.attnum
140 140
 EOD;
141 141
 		$this->getDbConnection()->setActive(true);
142
-		$command = $this->getDbConnection()->createCommand($sql);
142
+		$command=$this->getDbConnection()->createCommand($sql);
143 143
 		$command->bindValue(':table', $tableName);
144 144
 		$command->bindValue(':schema', $schemaName);
145
-		$tableInfo = $this->createNewTableInfo($schemaName, $tableName);
145
+		$tableInfo=$this->createNewTableInfo($schemaName, $tableName);
146 146
 		$index=0;
147 147
 		foreach($command->query() as $col)
148 148
 		{
149
-			$col['index'] = $index++;
149
+			$col['index']=$index++;
150 150
 			$this->processColumn($tableInfo, $col);
151 151
 		}
152 152
 		if($index===0)
@@ -161,12 +161,12 @@  discard block
 block discarded – undo
161 161
 	 */
162 162
 	protected function createNewTableInfo($schemaName, $tableName)
163 163
 	{
164
-		$info['SchemaName'] = $this->assertIdentifier($schemaName);
165
-		$info['TableName'] = $this->assertIdentifier($tableName);
164
+		$info['SchemaName']=$this->assertIdentifier($schemaName);
165
+		$info['TableName']=$this->assertIdentifier($tableName);
166 166
 		if($this->getIsView($schemaName, $tableName))
167
-			$info['IsView'] = true;
168
-		list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName);
169
-		$class = $this->getTableInfoClass();
167
+			$info['IsView']=true;
168
+		list($primary, $foreign)=$this->getConstraintKeys($schemaName, $tableName);
169
+		$class=$this->getTableInfoClass();
170 170
 		return new $class($info, $primary, $foreign);
171 171
 	}
172 172
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	{
180 180
 		if(strpos($name, '"')!==false)
181 181
 		{
182
-			$ref = 'http://www.postgresql.org/docs/7.4/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS';
182
+			$ref='http://www.postgresql.org/docs/7.4/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS';
183 183
 			throw new TDbException('dbcommon_invalid_identifier_name', $name, $ref);
184 184
 		}
185 185
 		return $name;
@@ -192,17 +192,17 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	protected function getIsView($schemaName, $tableName)
194 194
 	{
195
-		$sql =
195
+		$sql=
196 196
 <<<EOD
197 197
 		SELECT count(c.relname) FROM pg_catalog.pg_class c
198 198
 		LEFT JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace)
199 199
 		WHERE (n.nspname=:schema) AND (c.relkind = 'v'::"char") AND c.relname = :table
200 200
 EOD;
201 201
 		$this->getDbConnection()->setActive(true);
202
-		$command = $this->getDbConnection()->createCommand($sql);
202
+		$command=$this->getDbConnection()->createCommand($sql);
203 203
 		$command->bindValue(':schema', $schemaName);
204 204
 		$command->bindValue(':table', $tableName);
205
-		return intval($command->queryScalar()) === 1;
205
+		return intval($command->queryScalar())===1;
206 206
 	}
207 207
 
208 208
 	/**
@@ -211,47 +211,47 @@  discard block
 block discarded – undo
211 211
 	 */
212 212
 	protected function processColumn($tableInfo, $col)
213 213
 	{
214
-		$columnId = $col['attname']; //use column name as column Id
214
+		$columnId=$col['attname']; //use column name as column Id
215 215
 
216
-		$info['ColumnName'] = '"' . $columnId . '"'; //quote the column names!
217
-		$info['ColumnId'] = $columnId;
218
-		$info['ColumnIndex'] = $col['index'];
216
+		$info['ColumnName']='"'.$columnId.'"'; //quote the column names!
217
+		$info['ColumnId']=$columnId;
218
+		$info['ColumnIndex']=$col['index'];
219 219
 		if(!$col['attnotnull'])
220
-			$info['AllowNull'] = true;
220
+			$info['AllowNull']=true;
221 221
 		if(in_array($columnId, $tableInfo->getPrimaryKeys()))
222
-			$info['IsPrimaryKey'] = true;
222
+			$info['IsPrimaryKey']=true;
223 223
 		if($this->isForeignKeyColumn($columnId, $tableInfo))
224
-			$info['IsForeignKey'] = true;
224
+			$info['IsForeignKey']=true;
225 225
 
226 226
 		if($col['atttypmod'] > 0)
227
-			$info['ColumnSize'] =  $col['atttypmod'] - 4;
227
+			$info['ColumnSize']=$col['atttypmod'] - 4;
228 228
 		if($col['atthasdef'])
229
-			$info['DefaultValue'] = $col['adsrc'];
230
-		if($col['attisserial'] || substr($col['adsrc'], 0, 8) === 'nextval(')
229
+			$info['DefaultValue']=$col['adsrc'];
230
+		if($col['attisserial'] || substr($col['adsrc'], 0, 8)==='nextval(')
231 231
 		{
232
-			if(($sequence = $this->getSequenceName($tableInfo, $col['adsrc']))!==null)
232
+			if(($sequence=$this->getSequenceName($tableInfo, $col['adsrc']))!==null)
233 233
 			{
234
-				$info['SequenceName'] = $sequence;
234
+				$info['SequenceName']=$sequence;
235 235
 				unset($info['DefaultValue']);
236 236
 			}
237 237
 		}
238
-		$matches = [];
238
+		$matches=[];
239 239
 		if(preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches))
240 240
 		{
241
-			$info['DbType'] = preg_replace('/\(\d+(?:,\d+)?\)/', '', $col['type']);
241
+			$info['DbType']=preg_replace('/\(\d+(?:,\d+)?\)/', '', $col['type']);
242 242
 			if($this->isPrecisionType($info['DbType']))
243 243
 			{
244
-				$info['NumericPrecision'] = intval($matches[1]);
244
+				$info['NumericPrecision']=intval($matches[1]);
245 245
 				if(count($matches) > 2)
246
-					$info['NumericScale'] = intval($matches[2]);
246
+					$info['NumericScale']=intval($matches[2]);
247 247
 			}
248 248
 			else
249
-				$info['ColumnSize'] = intval($matches[1]);
249
+				$info['ColumnSize']=intval($matches[1]);
250 250
 		}
251 251
 		else
252
-			$info['DbType'] = $col['type'];
252
+			$info['DbType']=$col['type'];
253 253
 
254
-		$tableInfo->Columns[$columnId] = new TPgsqlTableColumn($info);
254
+		$tableInfo->Columns[$columnId]=new TPgsqlTableColumn($info);
255 255
 	}
256 256
 
257 257
 	/**
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	protected function getSequenceName($tableInfo, $src)
261 261
 	{
262
-		$matches = [];
262
+		$matches=[];
263 263
 		if(preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches))
264 264
 		{
265 265
 			if(is_int(strpos($matches[1], '.')))
266 266
 				return $matches[1];
267 267
 			else
268
-				return $tableInfo->getSchemaName() . '.' . $matches[1];
268
+				return $tableInfo->getSchemaName().'.'.$matches[1];
269 269
 		}
270 270
 	}
271 271
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	 */
275 275
 	protected function isPrecisionType($type)
276 276
 	{
277
-		$type = strtolower(trim($type));
277
+		$type=strtolower(trim($type));
278 278
 		return $type==='numeric' || $type==='interval' || strpos($type, 'time')===0;
279 279
 	}
280 280
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	protected function getConstraintKeys($schemaName, $tableName)
288 288
 	{
289
-		$sql =
289
+		$sql=
290 290
 <<<EOD
291 291
 	SELECT conname, consrc, contype, indkey, indisclustered FROM (
292 292
 			SELECT
@@ -334,25 +334,25 @@  discard block
 block discarded – undo
334 334
 			1
335 335
 EOD;
336 336
 		$this->getDbConnection()->setActive(true);
337
-		$command = $this->getDbConnection()->createCommand($sql);
337
+		$command=$this->getDbConnection()->createCommand($sql);
338 338
 		$command->bindValue(':table', $tableName);
339 339
 		$command->bindValue(':schema', $schemaName);
340
-		$primary = [];
341
-		$foreign = [];
340
+		$primary=[];
341
+		$foreign=[];
342 342
 		foreach($command->query() as $row)
343 343
 		{
344 344
 			switch($row['contype'])
345 345
 			{
346 346
 				case 'p':
347
-					$primary = $this->getPrimaryKeys($tableName, $schemaName, $row['indkey']);
347
+					$primary=$this->getPrimaryKeys($tableName, $schemaName, $row['indkey']);
348 348
 					break;
349 349
 				case 'f':
350
-					if(($fkey = $this->getForeignKeys($row['consrc']))!==null)
351
-						$foreign[] = $fkey;
350
+					if(($fkey=$this->getForeignKeys($row['consrc']))!==null)
351
+						$foreign[]=$fkey;
352 352
 					break;
353 353
 			}
354 354
 		}
355
-		return [$primary,$foreign];
355
+		return [$primary, $foreign];
356 356
 	}
357 357
 
358 358
 	/**
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
 	 */
363 363
 	protected function getPrimaryKeys($tableName, $schemaName, $columnIndex)
364 364
 	{
365
-		$index = implode(', ', explode(' ', $columnIndex));
366
-		$sql =
365
+		$index=implode(', ', explode(' ', $columnIndex));
366
+		$sql=
367 367
 <<<EOD
368 368
 		SELECT attnum, attname FROM pg_catalog.pg_attribute WHERE
369 369
 		attrelid=(
@@ -373,14 +373,14 @@  discard block
 block discarded – undo
373 373
 		)
374 374
 				AND attnum IN ({$index})
375 375
 EOD;
376
-		$command = $this->getDbConnection()->createCommand($sql);
376
+		$command=$this->getDbConnection()->createCommand($sql);
377 377
 		$command->bindValue(':table', $tableName);
378 378
 		$command->bindValue(':schema', $schemaName);
379 379
 //		$command->bindValue(':columnIndex', join(', ', explode(' ', $columnIndex)));
380
-		$primary = [];
380
+		$primary=[];
381 381
 		foreach($command->query() as $row)
382 382
 		{
383
-						$primary[] = $row['attname'];
383
+						$primary[]=$row['attname'];
384 384
 		}
385 385
 
386 386
 		return $primary;
@@ -393,15 +393,15 @@  discard block
 block discarded – undo
393 393
 	 */
394 394
 	protected function getForeignKeys($src)
395 395
 	{
396
-		$matches = [];
397
-		$brackets = '\(([^\)]+)\)';
398
-		$find = "/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
396
+		$matches=[];
397
+		$brackets='\(([^\)]+)\)';
398
+		$find="/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
399 399
 		if(preg_match($find, $src, $matches))
400 400
 		{
401
-			$keys = preg_split('/,\s+/', $matches[1]);
402
-			$fkeys = [];
401
+			$keys=preg_split('/,\s+/', $matches[1]);
402
+			$fkeys=[];
403 403
 			foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey)
404
-				$fkeys[$keys[$i]] = $fkey;
404
+				$fkeys[$keys[$i]]=$fkey;
405 405
 			return ['table' => str_replace('"', '', $matches[2]), 'keys' => $fkeys];
406 406
 		}
407 407
 	}
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 			if($schema===self::DEFAULT_SCHEMA)
445 445
 				$names[]=$row['table_name'];
446 446
 			else
447
-				$names[]=$row['table_schema'] . '.' . $row['table_name'];
447
+				$names[]=$row['table_schema'].'.'.$row['table_name'];
448 448
 		}
449 449
 		return $names;
450 450
 	}
Please login to merge, or discard this patch.
framework/Data/Common/TDbMetaData.php 2 patches
Doc Comments   -6 removed lines patch added patch discarded remove patch
@@ -127,8 +127,6 @@  discard block
 block discarded – undo
127 127
 	/**
128 128
 	 * Quotes a table name for use in a query.
129 129
 	 * @param string $name table name
130
-	 * @param string $lft left delimiter
131
-	 * @param string $rgt right delimiter
132 130
 	 * @return string the properly quoted table name
133 131
 	 */
134 132
 	public function quoteTableName($name)
@@ -150,8 +148,6 @@  discard block
 block discarded – undo
150 148
 	/**
151 149
 	 * Quotes a column name for use in a query.
152 150
 	 * @param string $name column name
153
-	 * @param string $lft left delimiter
154
-	 * @param string $rgt right delimiter
155 151
 	 * @return string the properly quoted column name
156 152
 	 */
157 153
 	public function quoteColumnName($name)
@@ -166,8 +162,6 @@  discard block
 block discarded – undo
166 162
 	/**
167 163
 	 * Quotes a column alias for use in a query.
168 164
 	 * @param string $name column alias
169
-	 * @param string $lft left delimiter
170
-	 * @param string $rgt right delimiter
171 165
 	 * @return string the properly quoted column alias
172 166
 	 */
173 167
 	public function quoteColumnAlias($name)
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	/**
38 38
 	 * @var array
39 39
 	 */
40
-	protected static $delimiterIdentifier = ['[', ']', '"', '`', "'"];
40
+	protected static $delimiterIdentifier=['[', ']', '"', '`', "'"];
41 41
 
42 42
 	/**
43 43
 	 * @param TDbConnection database connection.
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	public static function getInstance($conn)
64 64
 	{
65 65
 		$conn->setActive(true); //must be connected before retrieving driver name
66
-		$driver = $conn->getDriverName();
66
+		$driver=$conn->getDriverName();
67 67
 		switch(strtolower($driver))
68 68
 		{
69 69
 			case 'pgsql':
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getTableInfo($tableName=null)
96 96
 	{
97
-		$key = $tableName===null?$this->getDbConnection()->getConnectionString():$tableName;
97
+		$key=$tableName===null ? $this->getDbConnection()->getConnectionString() : $tableName;
98 98
 		if(!isset($this->_tableInfoCache[$key]))
99 99
 		{
100
-			$class = $this->getTableInfoClass();
101
-			$tableInfo = $tableName===null ? new $class : $this->createTableInfo($tableName);
102
-			$this->_tableInfoCache[$key] = $tableInfo;
100
+			$class=$this->getTableInfoClass();
101
+			$tableInfo=$tableName===null ? new $class : $this->createTableInfo($tableName);
102
+			$this->_tableInfoCache[$key]=$tableInfo;
103 103
 		}
104 104
 		return $this->_tableInfoCache[$key];
105 105
 	}
@@ -137,17 +137,17 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	public function quoteTableName($name)
139 139
 	{
140
-		$name = str_replace(self::$delimiterIdentifier, '', $name);
140
+		$name=str_replace(self::$delimiterIdentifier, '', $name);
141 141
 
142
-		$args = func_get_args();
143
-		$rgt = $lft = isset($args[1]) ? $args[1] : '';
144
-		$rgt = isset($args[2]) ? $args[2] : $rgt;
142
+		$args=func_get_args();
143
+		$rgt=$lft=isset($args[1]) ? $args[1] : '';
144
+		$rgt=isset($args[2]) ? $args[2] : $rgt;
145 145
 
146 146
 		if(strpos($name, '.')===false)
147
-			return $lft . $name . $rgt;
147
+			return $lft.$name.$rgt;
148 148
 		$names=explode('.', $name);
149 149
 		foreach($names as &$n)
150
-			$n = $lft . $n . $rgt;
150
+			$n=$lft.$n.$rgt;
151 151
 		return implode('.', $names);
152 152
 	}
153 153
 
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	public function quoteColumnName($name)
162 162
 	{
163
-		$args = func_get_args();
164
-		$rgt = $lft = isset($args[1]) ? $args[1] : '';
165
-		$rgt = isset($args[2]) ? $args[2] : $rgt;
163
+		$args=func_get_args();
164
+		$rgt=$lft=isset($args[1]) ? $args[1] : '';
165
+		$rgt=isset($args[2]) ? $args[2] : $rgt;
166 166
 
167
-		return $lft . str_replace(self::$delimiterIdentifier, '', $name) . $rgt;
167
+		return $lft.str_replace(self::$delimiterIdentifier, '', $name).$rgt;
168 168
 	}
169 169
 
170 170
 	/**
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	 */
177 177
 	public function quoteColumnAlias($name)
178 178
 	{
179
-		$args = func_get_args();
180
-		$rgt = $lft = isset($args[1]) ? $args[1] : '';
181
-		$rgt = isset($args[2]) ? $args[2] : $rgt;
179
+		$args=func_get_args();
180
+		$rgt=$lft=isset($args[1]) ? $args[1] : '';
181
+		$rgt=isset($args[2]) ? $args[2] : $rgt;
182 182
 
183
-		return $lft . str_replace(self::$delimiterIdentifier, '', $name) . $rgt;
183
+		return $lft.str_replace(self::$delimiterIdentifier, '', $name).$rgt;
184 184
 	}
185 185
 
186 186
 		/**
Please login to merge, or discard this patch.
framework/Data/DataGateway/TSqlCriteria.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	}
189 189
 
190 190
 	/**
191
-	 * @return boolean true if the parameter index are string base, false otherwise.
191
+	 * @return boolean|null true if the parameter index are string base, false otherwise.
192 192
 	 */
193 193
 	public function getIsNamedParameters()
194 194
 	{
@@ -206,6 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
 	/**
208 208
 	 * @param mixed ordering clause.
209
+	 * @param string $value
209 210
 	 */
210 211
 	public function setOrdersBy($value)
211 212
 	{
@@ -250,6 +251,7 @@  discard block
 block discarded – undo
250 251
 
251 252
 	/**
252 253
 	 * @param int record offset.
254
+	 * @param double $value
253 255
 	 */
254 256
 	public function setOffset($value)
255 257
 	{
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 	public function __construct($condition=null, $parameters=[])
55 55
 	{
56 56
 		if(!is_array($parameters) && func_num_args() > 1)
57
-			$parameters = array_slice(func_get_args(), 1);
57
+			$parameters=array_slice(func_get_args(), 1);
58 58
 		$this->_parameters=new TAttributeCollection;
59 59
 		$this->_parameters->setCaseSensitive(true);
60
-		$this->_parameters->copyFrom((array)$parameters);
60
+		$this->_parameters->copyFrom((array) $parameters);
61 61
 		$this->_ordersBy=new TAttributeCollection;
62 62
 		$this->_ordersBy->setCaseSensitive(true);
63 63
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function setSelect($value)
117 117
 	{
118
-		$this->_select = $value;
118
+		$this->_select=$value;
119 119
 	}
120 120
 
121 121
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	{
135 135
 		if(empty($value)) {
136 136
 			// reset the condition
137
-			$this->_condition = null;
137
+			$this->_condition=null;
138 138
 			return;
139 139
 		}
140 140
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 		if(preg_match('/ORDER\s+BY\s+(.*?)(?=LIMIT)|ORDER\s+BY\s+(.*?)$/i', $value, $matches) > 0) {
148 148
 			// condition contains ORDER BY
149
-			$value = str_replace($matches[0], '', $value);
149
+			$value=str_replace($matches[0], '', $value);
150 150
 			if(strlen($matches[1]) > 0) {
151 151
 				$this->setOrdersBy($matches[1]);
152 152
 			} elseif(strlen($matches[2]) > 0) {
@@ -156,23 +156,23 @@  discard block
 block discarded – undo
156 156
 
157 157
 		if(preg_match('/LIMIT\s+([\d\s,]+)/i', $value, $matches) > 0) {
158 158
 			// condition contains limit
159
-			$value = str_replace($matches[0], '', $value); // remove limit from query
159
+			$value=str_replace($matches[0], '', $value); // remove limit from query
160 160
 			if(strpos($matches[1], ',')) { // both offset and limit given
161
-				list($offset, $limit) = explode(',', $matches[1]);
162
-				$this->_limit = (int)$limit;
163
-				$this->_offset = (int)$offset;
161
+				list($offset, $limit)=explode(',', $matches[1]);
162
+				$this->_limit=(int) $limit;
163
+				$this->_offset=(int) $offset;
164 164
 			} else { // only limit given
165
-				$this->_limit = (int)$matches[1];
165
+				$this->_limit=(int) $matches[1];
166 166
 			}
167 167
 		}
168 168
 
169 169
 		if(preg_match('/OFFSET\s+(\d+)/i', $value, $matches) > 0) {
170 170
 			// condition contains offset
171
-			$value = str_replace($matches[0], '', $value); // remove offset from query
172
-			$this->_offset = (int)$matches[1]; // set offset in criteria
171
+			$value=str_replace($matches[0], '', $value); // remove offset from query
172
+			$this->_offset=(int) $matches[1]; // set offset in criteria
173 173
 		}
174 174
 
175
-		$this->_condition = trim($value);
175
+		$this->_condition=trim($value);
176 176
 	}
177 177
 
178 178
 	/**
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
 			$this->_ordersBy->copyFrom($value);
220 220
 		else
221 221
 		{
222
-			$value=trim(preg_replace('/\s+/', ' ', (string)$value));
222
+			$value=trim(preg_replace('/\s+/', ' ', (string) $value));
223 223
 			$orderBys=[];
224 224
 			foreach(explode(',', $value) as $orderBy)
225 225
 			{
226 226
 				$vs=explode(' ', trim($orderBy));
227
-				$orderBys[$vs[0]]=isset($vs[1])?$vs[1]:'asc';
227
+				$orderBys[$vs[0]]=isset($vs[1]) ? $vs[1] : 'asc';
228 228
 			}
229 229
 			$this->_ordersBy->copyFrom($orderBys);
230 230
 		}
@@ -267,23 +267,23 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	public function __toString()
269 269
 	{
270
-		$str = '';
271
-		if(strlen((string)$this->getCondition()) > 0)
272
-			$str .= '"' . (string)$this->getCondition() . '"';
273
-		$params = [];
270
+		$str='';
271
+		if(strlen((string) $this->getCondition()) > 0)
272
+			$str.='"'.(string) $this->getCondition().'"';
273
+		$params=[];
274 274
 		foreach($this->getParameters() as $k=>$v)
275
-			$params[] = "{$k} => ${v}";
275
+			$params[]="{$k} => ${v}";
276 276
 		if(count($params) > 0)
277
-			$str .= ', "' . implode(', ', $params) . '"';
278
-		$orders = [];
277
+			$str.=', "'.implode(', ', $params).'"';
278
+		$orders=[];
279 279
 		foreach($this->getOrdersBy() as $k=>$v)
280
-			$orders[] = "{$k} => ${v}";
280
+			$orders[]="{$k} => ${v}";
281 281
 		if(count($orders) > 0)
282
-			$str .= ', "' . implode(', ', $orders) . '"';
283
-		if($this->_limit !==null)
284
-			$str .= ', ' . $this->_limit;
285
-		if($this->_offset !== null)
286
-			$str .= ', ' . $this->_offset;
282
+			$str.=', "'.implode(', ', $orders).'"';
283
+		if($this->_limit!==null)
284
+			$str.=', '.$this->_limit;
285
+		if($this->_offset!==null)
286
+			$str.=', '.$this->_offset;
287 287
 		return $str;
288 288
 	}
289 289
 }
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TDiscriminator.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -132,6 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
 	/**
134 134
 	 * @param TSubMap add new sub mapping.
135
+	 * @param TSubMap $subMap
135 136
 	 */
136 137
 	public function addSubMap($subMap)
137 138
 	{
@@ -140,6 +141,7 @@  discard block
 block discarded – undo
140 141
 
141 142
 	/**
142 143
 	 * @param string database value
144
+	 * @param string $value
143 145
 	 * @return TResultMap result mapping.
144 146
 	 */
145 147
 	public function getSubMap($value)
@@ -151,6 +153,7 @@  discard block
 block discarded – undo
151 153
 	/**
152 154
 	 * Copies the discriminator properties to a new TResultProperty.
153 155
 	 * @param TResultMap result map holding the discriminator.
156
+	 * @param TResultMap $resultMap
154 157
 	 */
155 158
 	public function initMapping($resultMap)
156 159
 	{
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function setColumn($value)
54 54
 	{
55
-		$this->_column = $value;
55
+		$this->_column=$value;
56 56
 	}
57 57
 
58 58
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function setType($value)
74 74
 	{
75
-		$this->_type = $value;
75
+		$this->_type=$value;
76 76
 	}
77 77
 
78 78
 	/**
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function setTypeHandler($value)
90 90
 	{
91
-		$this->_typeHandler = $value;
91
+		$this->_typeHandler=$value;
92 92
 	}
93 93
 
94 94
 	/**
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function setColumnIndex($value)
108 108
 	{
109
-		$this->_columnIndex = TPropertyValue::ensureInteger($value);
109
+		$this->_columnIndex=TPropertyValue::ensureInteger($value);
110 110
 	}
111 111
 
112 112
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function setNullValue($value)
124 124
 	{
125
-		$this->_nullValue = $value;
125
+		$this->_nullValue=$value;
126 126
 	}
127 127
 
128 128
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function addSubMap($subMap)
140 140
 	{
141
-		$this->_subMaps[] = $subMap;
141
+		$this->_subMaps[]=$subMap;
142 142
 	}
143 143
 
144 144
 	/**
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 */
158 158
 	public function initMapping($resultMap)
159 159
 	{
160
-		$this->_mapping = new TResultProperty($resultMap);
160
+		$this->_mapping=new TResultProperty($resultMap);
161 161
 		$this->_mapping->setColumn($this->getColumn());
162 162
 		$this->_mapping->setColumnIndex($this->getColumnIndex());
163 163
 		$this->_mapping->setType($this->getType());
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	{
174 174
 		foreach($this->_subMaps as $subMap)
175 175
 		{
176
-			$this->_resultMaps[$subMap->getValue()] =
176
+			$this->_resultMaps[$subMap->getValue()]=
177 177
 				$manager->getResultMap($subMap->getResultMapping());
178 178
 		}
179 179
 	}
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TParameterMap.php 3 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,6 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
 	/**
57 57
 	 * @param string a unique identifier for the <parameterMap>.
58
+	 * @param string $value
58 59
 	 */
59 60
 	public function setID($value)
60 61
 	{
@@ -62,7 +63,7 @@  discard block
 block discarded – undo
62 63
 	}
63 64
 
64 65
 	/**
65
-	 * @return TParameterProperty[] list of properties for the parameter map.
66
+	 * @return TList list of properties for the parameter map.
66 67
 	 */
67 68
 	public function getProperties()
68 69
 	{
@@ -112,6 +113,7 @@  discard block
 block discarded – undo
112 113
 	/**
113 114
 	 * @param int parameter property index
114 115
 	 * @param TParameterProperty new parameter property.
116
+	 * @param integer $index
115 117
 	 */
116 118
 	public function insertProperty($index, TParameterProperty $property)
117 119
 	{
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -177,8 +177,7 @@
 block discarded – undo
177 177
 		try
178 178
 		{
179 179
 			return TPropertyAccess::get($object, $property->getProperty());
180
-		}
181
-		catch (TInvalidPropertyException $e)
180
+		} catch (TInvalidPropertyException $e)
182 181
 		{
183 182
 			throw new TSqlMapException(
184 183
 				'sqlmap_unable_to_get_property_for_parameter',
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function __construct()
52 52
 	{
53
-		$this->_properties = new TList;
54
-		$this->_propertyMap = new TMap;
53
+		$this->_properties=new TList;
54
+		$this->_propertyMap=new TMap;
55 55
 	}
56 56
 
57 57
 	/**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function setExtends($value)
93 93
 	{
94
-		$this->_extend = $value;
94
+		$this->_extend=$value;
95 95
 	}
96 96
 
97 97
 	/**
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	public function getPropertyValue($registry, $property, $parameterValue)
147 147
 	{
148
-		$value = $this->getObjectValue($parameterValue, $property);
148
+		$value=$this->getObjectValue($parameterValue, $property);
149 149
 
150 150
 		if(($handler=$this->createTypeHandler($property, $registry))!==null)
151
-			$value = $handler->getParameter($value);
151
+			$value=$handler->getParameter($value);
152 152
 
153
-		$value = $this->nullifyDefaultValue($property, $value);
153
+		$value=$this->nullifyDefaultValue($property, $value);
154 154
 
155
-		if(($type = $property->getType())!==null)
156
-			$value = $registry->convertToType($type, $value);
155
+		if(($type=$property->getType())!==null)
156
+			$value=$registry->convertToType($type, $value);
157 157
 
158 158
 		return $value;
159 159
 	}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		$type=$property->getTypeHandler() ? $property->getTypeHandler() : $property->getType();
171 171
 		$handler=$registry->getTypeHandler($type);
172 172
 		if($handler===null && $property->getTypeHandler())
173
-			$handler = Prado::createComponent($type);
173
+			$handler=Prado::createComponent($type);
174 174
 		return $handler;
175 175
 	}
176 176
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		{
188 188
 			return TPropertyAccess::get($object, $property->getProperty());
189 189
 		}
190
-		catch (TInvalidPropertyException $e)
190
+		catch(TInvalidPropertyException $e)
191 191
 		{
192 192
 			throw new TSqlMapException(
193 193
 				'sqlmap_unable_to_get_property_for_parameter',
@@ -207,10 +207,10 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	protected function nullifyDefaultValue($property, $value)
209 209
 	{
210
-		if(($nullValue = $property->getNullValue())!==null)
210
+		if(($nullValue=$property->getNullValue())!==null)
211 211
 		{
212
-			if($nullValue === $value)
213
-				$value = null;
212
+			if($nullValue===$value)
213
+				$value=null;
214 214
 		}
215 215
 		return $value;
216 216
 	}
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TParameterProperty.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -110,6 +110,7 @@
 block discarded – undo
110 110
 
111 111
 	/**
112 112
 	 * @param string name of a property of the parameter object.
113
+	 * @param string $value
113 114
 	 */
114 115
 	public function setProperty($value)
115 116
 	{
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function setTypeHandler($value)
53 53
 	{
54
-		$this->_typeHandler = $value;
54
+		$this->_typeHandler=$value;
55 55
 	}
56 56
 
57 57
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function setType($value)
69 69
 	{
70
-		$this->_type = $value;
70
+		$this->_type=$value;
71 71
 	}
72 72
 
73 73
 	/**
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function setColumn($value)
85 85
 	{
86
-		$this->_column = $value;
86
+		$this->_column=$value;
87 87
 	}
88 88
 
89 89
 	/**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	public function setDbType($value)
101 101
 	{
102
-		$this->_dbType = $value;
102
+		$this->_dbType=$value;
103 103
 	}
104 104
 
105 105
 	/**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function setProperty($value)
117 117
 	{
118
-		$this->_property = $value;
118
+		$this->_property=$value;
119 119
 	}
120 120
 
121 121
 	/**
@@ -132,18 +132,18 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	public function setNullValue($value)
134 134
 	{
135
-		$this->_nullValue = $value;
135
+		$this->_nullValue=$value;
136 136
 	}
137 137
 
138 138
 	public function __sleep()
139 139
 	{
140
-		$exprops = []; $cn = 'TParameterProperty';
141
-		if ($this->_typeHandler===null) $exprops[] = "\0$cn\0_typeHandler";
142
-		if ($this->_type===null) $exprops[] = "\0$cn\0_type";
143
-		if ($this->_column===null) $exprops[] = "\0$cn\0_column";
144
-		if ($this->_dbType===null) $exprops[] = "\0$cn\0_dbType";
145
-		if ($this->_property===null) $exprops[] = "\0$cn\0_property";
146
-		if ($this->_nullValue===null) $exprops[] = "\0$cn\0_nullValue";
140
+		$exprops=[]; $cn='TParameterProperty';
141
+		if($this->_typeHandler===null) $exprops[]="\0$cn\0_typeHandler";
142
+		if($this->_type===null) $exprops[]="\0$cn\0_type";
143
+		if($this->_column===null) $exprops[]="\0$cn\0_column";
144
+		if($this->_dbType===null) $exprops[]="\0$cn\0_dbType";
145
+		if($this->_property===null) $exprops[]="\0$cn\0_property";
146
+		if($this->_nullValue===null) $exprops[]="\0$cn\0_nullValue";
147 147
 		return array_diff(parent::__sleep(), $exprops);
148 148
 	}
149 149
 }
Please login to merge, or discard this patch.