Completed
Push — intl ( 51e284 )
by Fabio
06:51
created
framework/Data/SqlMap/DataMapper/TObjectProxy.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -116,6 +116,7 @@
 block discarded – undo
116 116
 	/**
117 117
 	 * @param object handler to method calls.
118 118
 	 * @param object the object to by proxied.
119
+	 * @param TLazyLoadList $handler
119 120
 	 */
120 121
 	public function __construct($handler, $object)
121 122
 	{
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	public function __construct($handler, $object)
32 32
 	{
33
-		$this->_handler = $handler;
34
-		$this->_object = $object;
33
+		$this->_handler=$handler;
34
+		$this->_object=$object;
35 35
 	}
36 36
 
37 37
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param array method arguments
42 42
 	 * @return mixed method return value.
43 43
 	 */
44
-	public function __call($method,$params)
44
+	public function __call($method, $params)
45 45
 	{
46 46
 		if($this->_handler->hasMethod($method))
47 47
 			return $this->_handler->intercept($method, $params);
Please login to merge, or discard this patch.
framework/Data/SqlMap/DataMapper/TSqlMapApplicationCache.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -205,6 +205,9 @@
 block discarded – undo
205 205
 		return $keyList;
206 206
 	}
207 207
 
208
+	/**
209
+	 * @param TList $keyList
210
+	 */
208 211
 	protected function setKeyList($keyList)
209 212
 	{
210 213
 		$this->getCache()->set($this->getKeyListId(), $keyList);
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	protected function getKeyListId()
44 44
 	{
45 45
 		$id='keyList';
46
-		if ($this->_cacheModel instanceof TSqlMapCacheModel)
46
+		if($this->_cacheModel instanceof TSqlMapCacheModel)
47 47
 				$id.='_'.$this->_cacheModel->getId();
48 48
 		return $id;
49 49
 	}
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	protected function getKeyList()
55 55
 	{
56
-		if (($keyList=$this->getCache()->get($this->getKeyListId()))===false)
56
+		if(($keyList=$this->getCache()->get($this->getKeyListId()))===false)
57 57
 		{
58 58
 			$keyList=new TList();
59 59
 			$this->getCache()->set($this->getKeyListId(), $keyList);
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	{
85 85
 		$keyList=$this->getKeyList();
86 86
 		$cache=$this->getCache();
87
-		foreach ($keyList as $key)
87
+		foreach($keyList as $key)
88 88
 		{
89 89
 			$cache->delete($key);
90 90
 		}
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
 	 */
98 98
 	public function get($key)
99 99
 	{
100
-		$result = $this->getCache()->get($key);
101
-		if ($result === false)
100
+		$result=$this->getCache()->get($key);
101
+		if($result===false)
102 102
 		{
103 103
 			// if the key has not been found in cache (e.g expired), remove from keylist
104 104
 			$keyList=$this->getKeyList();
105
-			if ($keyList->contains($key))
105
+			if($keyList->contains($key))
106 106
 			{
107 107
 				$keyList->remove($key);
108 108
 				$this->setKeyList($keyList);
109 109
 			}
110 110
 		}
111
-		return $result === false ? null : $result;
111
+		return $result===false ? null : $result;
112 112
 	}
113 113
 
114 114
 	/**
@@ -116,11 +116,11 @@  discard block
 block discarded – undo
116 116
 	 * @param string the key identifying the value to be cached
117 117
 	 * @param mixed the value to be cached
118 118
 	 */
119
-	public function set($key, $value,$expire=0,$dependency=null)
119
+	public function set($key, $value, $expire=0, $dependency=null)
120 120
 	{
121
-		$this->getCache()->set($key, $value, $expire,$dependency);
121
+		$this->getCache()->set($key, $value, $expire, $dependency);
122 122
 		$keyList=$this->getKeyList();
123
-		if (!$keyList->contains($key))
123
+		if(!$keyList->contains($key))
124 124
 		{
125 125
 			$keyList->add($key);
126 126
 			$this->setKeyList($keyList);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	/**
139 139
 	 * @throws TSqlMapException not implemented.
140 140
 	 */
141
-	public function add($id,$value,$expire=0,$dependency=null)
141
+	public function add($id, $value, $expire=0, $dependency=null)
142 142
 	{
143 143
 		throw new TSqlMapException('sqlmap_use_set_to_store_cache');
144 144
 	}
Please login to merge, or discard this patch.
framework/Data/SqlMap/Statements/TMappedStatement.php 3 patches
Doc Comments   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 	/**
99
-	 * @return TSqlMapper The SqlMap used by this MappedStatement
99
+	 * @return TSqlMapManager The SqlMap used by this MappedStatement
100 100
 	 */
101 101
 	public function getManager()
102 102
 	{
@@ -481,6 +481,7 @@  discard block
 block discarded – undo
481 481
 	 * @param IDbConnection database connection
482 482
 	 * @param mixed insert statement parameter
483 483
 	 * @param TSqlMapSelectKey select key statement
484
+	 * @param \Prado\Data\SqlMap\Configuration\TSqlMapSelectKey $selectKey
484 485
 	 * @return string last insert ID.
485 486
 	 */
486 487
 	protected function executeSelectKey($connection, $parameter, $selectKey)
@@ -581,6 +582,7 @@  discard block
 block discarded – undo
581 582
 	 * @param string result object class name
582 583
 	 * @param array a result set row retrieved from the database
583 584
 	 * @param object the result object, will create if necessary.
585
+	 * @param string $resultClass
584 586
 	 * @return object result object filled with data
585 587
 	 */
586 588
 	protected function fillResultClass($resultClass, $row, $resultObject)
@@ -603,6 +605,7 @@  discard block
 block discarded – undo
603 605
 	 * Apply the result to a TList or an array.
604 606
 	 * @param array a result set row retrieved from the database
605 607
 	 * @param object result object, array or list
608
+	 * @param \ArrayAccess $resultObject
606 609
 	 * @return object result filled with data.
607 610
 	 */
608 611
 	protected function fillResultArrayList($row, $resultObject)
@@ -645,6 +648,7 @@  discard block
 block discarded – undo
645 648
 	 * @param string result map name.
646 649
 	 * @param array a result set row retrieved from the database
647 650
 	 * @param object result object to fill, will create new instances if required.
651
+	 * @param string $parentGroup
648 652
 	 * @return object result object filled with data.
649 653
 	 */
650 654
 	protected function fillResultMap($resultMapName, $row, $parentGroup=null, &$resultObject=null)
@@ -784,6 +788,7 @@  discard block
 block discarded – undo
784 788
 	 * Converts the first array value to scalar value of given type.
785 789
 	 * @param array list of results
786 790
 	 * @param string scalar type.
791
+	 * @param string $type
787 792
 	 * @return mixed scalar value.
788 793
 	 */
789 794
 	protected function getScalarResult($result, $type)
Please login to merge, or discard this patch.
Spacing   +137 added lines, -140 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	/**
57 57
 	 * @var boolean true when data is mapped to a particular row.
58 58
 	 */
59
-	private $_IsRowDataFound = false;
59
+	private $_IsRowDataFound=false;
60 60
 
61 61
 	/**
62 62
 	 * @var TSQLMapObjectCollectionTree group by object collection tree
@@ -66,17 +66,17 @@  discard block
 block discarded – undo
66 66
 	/**
67 67
 	 * @var Post select is to query for list.
68 68
 	 */
69
-	const QUERY_FOR_LIST = 0;
69
+	const QUERY_FOR_LIST=0;
70 70
 
71 71
 	/**
72 72
 	 * @var Post select is to query for list.
73 73
 	 */
74
-	const QUERY_FOR_ARRAY = 1;
74
+	const QUERY_FOR_ARRAY=1;
75 75
 
76 76
 	/**
77 77
 	 * @var Post select is to query for object.
78 78
 	 */
79
-	const QUERY_FOR_OBJECT = 2;
79
+	const QUERY_FOR_OBJECT=2;
80 80
 
81 81
 	/**
82 82
 	 * @return string Name used to identify the TMappedStatement amongst the others.
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	protected function initialGroupByResults()
118 118
 	{
119
-		$this->_groupBy = new TSqlMapObjectCollectionTree();
119
+		$this->_groupBy=new TSqlMapObjectCollectionTree();
120 120
 	}
121 121
 
122 122
 	/**
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	public function __construct(TSqlMapManager $sqlMap, TSqlMapStatement $statement)
128 128
 	{
129
-		$this->_manager = $sqlMap;
130
-		$this->_statement = $statement;
131
-		$this->_command = new TPreparedCommand();
129
+		$this->_manager=$sqlMap;
130
+		$this->_statement=$statement;
131
+		$this->_command=new TPreparedCommand();
132 132
 		$this->initialGroupByResults();
133 133
 	}
134 134
 
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	protected function executeSQLQueryLimit($connection, $command, $max, $skip)
175 175
 	{
176
-		if($max>-1 || $skip > -1)
176
+		if($max > -1 || $skip > -1)
177 177
 		{
178
-			$maxStr=$max>0?' LIMIT '.$max:'';
179
-			$skipStr=$skip>0?' OFFSET '.$skip:'';
178
+			$maxStr=$max > 0 ? ' LIMIT '.$max : '';
179
+			$skipStr=$skip > 0 ? ' OFFSET '.$skip : '';
180 180
 			$command->setText($command->getText().$maxStr.$skipStr);
181 181
 		}
182 182
 		$connection->setActive(true);
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	public function executeQueryForList($connection, $parameter, $result=null, $skip=-1, $max=-1, $delegate=null)
215 215
 	{
216
-		$sql = $this->_command->create($this->_manager, $connection, $this->_statement, $parameter,$skip,$max);
216
+		$sql=$this->_command->create($this->_manager, $connection, $this->_statement, $parameter, $skip, $max);
217 217
 		return $this->runQueryForList($connection, $parameter, $sql, $result, $delegate);
218 218
 	}
219 219
 
@@ -236,17 +236,16 @@  discard block
 block discarded – undo
236 236
 	public function runQueryForList($connection, $parameter, $sql, $result, $delegate=null)
237 237
 	{
238 238
 		$registry=$this->getManager()->getTypeHandlers();
239
-		$list = $result instanceof \ArrayAccess ? $result :
240
-							$this->_statement->createInstanceOfListClass($registry);
239
+		$list=$result instanceof \ArrayAccess ? $result : $this->_statement->createInstanceOfListClass($registry);
241 240
 		$connection->setActive(true);
242
-		$reader = $sql->query();
241
+		$reader=$sql->query();
243 242
 		//$reader = $this->executeSQLQueryLimit($connection, $sql, $max, $skip);
244 243
 		if($delegate!==null)
245 244
 		{
246 245
 			foreach($reader as $row)
247 246
 			{
248
-				$obj = $this->applyResultMap($row);
249
-				$param = new TResultSetListItemParameter($obj, $parameter, $list);
247
+				$obj=$this->applyResultMap($row);
248
+				$param=new TResultSetListItemParameter($obj, $parameter, $list);
250 249
 				$this->raiseRowDelegate($delegate, $param);
251 250
 			}
252 251
 		}
@@ -256,13 +255,13 @@  discard block
 block discarded – undo
256 255
 			foreach($reader as $row)
257 256
 			{
258 257
 //				var_dump($row);
259
-				$list[] = $this->applyResultMap($row);
258
+				$list[]=$this->applyResultMap($row);
260 259
 			}
261 260
 		}
262 261
 
263 262
 		if(!$this->_groupBy->isEmpty())
264 263
 		{
265
-			$list = $this->_groupBy->collect();
264
+			$list=$this->_groupBy->collect();
266 265
 			$this->initialGroupByResults();
267 266
 		}
268 267
 
@@ -284,9 +283,9 @@  discard block
 block discarded – undo
284 283
 	 * @param callback row delegate handler
285 284
 	 * @return array An array of object containing the rows keyed by keyProperty.
286 285
 	 */
287
-	public function executeQueryForMap($connection, $parameter, $keyProperty, $valueProperty=null,  $skip=-1, $max=-1, $delegate=null)
286
+	public function executeQueryForMap($connection, $parameter, $keyProperty, $valueProperty=null, $skip=-1, $max=-1, $delegate=null)
288 287
 	{
289
-		$sql = $this->_command->create($this->_manager, $connection, $this->_statement, $parameter, $skip, $max);
288
+		$sql=$this->_command->create($this->_manager, $connection, $this->_statement, $parameter, $skip, $max);
290 289
 		return $this->runQueryForMap($connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate);
291 290
 	}
292 291
 
@@ -310,20 +309,19 @@  discard block
 block discarded – undo
310 309
 	 */
311 310
 	public function runQueryForMap($connection, $parameter, $command, $keyProperty, $valueProperty=null, $delegate=null)
312 311
 	{
313
-		$map = array();
312
+		$map=array();
314 313
 		//$recordSet = $this->executeSQLQuery($connection, $sql);
315 314
 		$connection->setActive(true);
316
-		$reader = $command->query();
315
+		$reader=$command->query();
317 316
 		if($delegate!==null)
318 317
 		{
319 318
 			//while($row = $recordSet->fetchRow())
320 319
 			foreach($reader as $row)
321 320
 			{
322
-				$obj = $this->applyResultMap($row);
323
-				$key = TPropertyAccess::get($obj, $keyProperty);
324
-				$value = ($valueProperty===null) ? $obj :
325
-							TPropertyAccess::get($obj, $valueProperty);
326
-				$param = new TResultSetMapItemParameter($key, $value, $parameter, $map);
321
+				$obj=$this->applyResultMap($row);
322
+				$key=TPropertyAccess::get($obj, $keyProperty);
323
+				$value=($valueProperty===null) ? $obj : TPropertyAccess::get($obj, $valueProperty);
324
+				$param=new TResultSetMapItemParameter($key, $value, $parameter, $map);
327 325
 				$this->raiseRowDelegate($delegate, $param);
328 326
 			}
329 327
 		}
@@ -332,10 +330,9 @@  discard block
 block discarded – undo
332 330
 			//while($row = $recordSet->fetchRow())
333 331
 			foreach($reader as $row)
334 332
 			{
335
-				$obj = $this->applyResultMap($row);
336
-				$key = TPropertyAccess::get($obj, $keyProperty);
337
-				$map[$key] = ($valueProperty===null) ? $obj :
338
-								TPropertyAccess::get($obj, $valueProperty);
333
+				$obj=$this->applyResultMap($row);
334
+				$key=TPropertyAccess::get($obj, $keyProperty);
335
+				$map[$key]=($valueProperty===null) ? $obj : TPropertyAccess::get($obj, $valueProperty);
339 336
 			}
340 337
 		}
341 338
 		$this->onExecuteQuery($command);
@@ -352,22 +349,22 @@  discard block
 block discarded – undo
352 349
 	{
353 350
 		if(is_string($handler))
354 351
 		{
355
-			call_user_func($handler,$this,$param);
352
+			call_user_func($handler, $this, $param);
356 353
 		}
357
-		else if(is_callable($handler,true))
354
+		else if(is_callable($handler, true))
358 355
 		{
359 356
 			// an array: 0 - object, 1 - method name/path
360
-			list($object,$method)=$handler;
357
+			list($object, $method)=$handler;
361 358
 			if(is_string($object))	// static method call
362
-				call_user_func($handler,$this,$param);
359
+				call_user_func($handler, $this, $param);
363 360
 			else
364 361
 			{
365
-				if(($pos=strrpos($method,'.'))!==false)
362
+				if(($pos=strrpos($method, '.'))!==false)
366 363
 				{
367
-					$object=$this->getSubProperty(substr($method,0,$pos));
368
-					$method=substr($method,$pos+1);
364
+					$object=$this->getSubProperty(substr($method, 0, $pos));
365
+					$method=substr($method, $pos + 1);
369 366
 				}
370
-				$object->$method($this,$param);
367
+				$object->$method($this, $param);
371 368
 			}
372 369
 		}
373 370
 		else
@@ -384,7 +381,7 @@  discard block
 block discarded – undo
384 381
 	 */
385 382
 	public function executeQueryForObject($connection, $parameter, $result=null)
386 383
 	{
387
-		$sql = $this->_command->create($this->_manager, $connection, $this->_statement, $parameter);
384
+		$sql=$this->_command->create($this->_manager, $connection, $this->_statement, $parameter);
388 385
 		return $this->runQueryForObject($connection, $sql, $result);
389 386
 	}
390 387
 
@@ -403,16 +400,16 @@  discard block
 block discarded – undo
403 400
 	 */
404 401
 	public function runQueryForObject($connection, $command, &$result)
405 402
 	{
406
-		$object = null;
403
+		$object=null;
407 404
 		$connection->setActive(true);
408 405
 		foreach($command->query() as $row)
409
-			$object = $this->applyResultMap($row, $result);
406
+			$object=$this->applyResultMap($row, $result);
410 407
 
411 408
 		if(!$this->_groupBy->isEmpty())
412 409
 		{
413
-			$list = $this->_groupBy->collect();
410
+			$list=$this->_groupBy->collect();
414 411
 			$this->initialGroupByResults();
415
-			$object = $list[0];
412
+			$object=$list[0];
416 413
 		}
417 414
 
418 415
 		$this->executePostSelect($connection);
@@ -430,14 +427,14 @@  discard block
 block discarded – undo
430 427
 	 */
431 428
 	public function executeInsert($connection, $parameter)
432 429
 	{
433
-		$generatedKey = $this->getPreGeneratedSelectKey($connection, $parameter);
430
+		$generatedKey=$this->getPreGeneratedSelectKey($connection, $parameter);
434 431
 
435
-		$command = $this->_command->create($this->_manager, $connection, $this->_statement, $parameter);
432
+		$command=$this->_command->create($this->_manager, $connection, $this->_statement, $parameter);
436 433
 //		var_dump($command,$parameter);
437
-		$result = $command->execute();
434
+		$result=$command->execute();
438 435
 
439 436
 		if($generatedKey===null)
440
-			$generatedKey = $this->getPostGeneratedSelectKey($connection, $parameter);
437
+			$generatedKey=$this->getPostGeneratedSelectKey($connection, $parameter);
441 438
 
442 439
 		$this->executePostSelect($connection);
443 440
 		$this->onExecuteQuery($command);
@@ -454,7 +451,7 @@  discard block
 block discarded – undo
454 451
 	{
455 452
 		if($this->_statement instanceof TSqlMapInsert)
456 453
 		{
457
-			$selectKey = $this->_statement->getSelectKey();
454
+			$selectKey=$this->_statement->getSelectKey();
458 455
 			if(($selectKey!==null) && !$selectKey->getIsAfter())
459 456
 				return $this->executeSelectKey($connection, $parameter, $selectKey);
460 457
 		}
@@ -470,7 +467,7 @@  discard block
 block discarded – undo
470 467
 	{
471 468
 		if($this->_statement instanceof TSqlMapInsert)
472 469
 		{
473
-			$selectKey = $this->_statement->getSelectKey();
470
+			$selectKey=$this->_statement->getSelectKey();
474 471
 			if(($selectKey!==null) && $selectKey->getIsAfter())
475 472
 				return $this->executeSelectKey($connection, $parameter, $selectKey);
476 473
 		}
@@ -485,10 +482,10 @@  discard block
 block discarded – undo
485 482
 	 */
486 483
 	protected function executeSelectKey($connection, $parameter, $selectKey)
487 484
 	{
488
-		$mappedStatement = $this->getManager()->getMappedStatement($selectKey->getID());
489
-		$generatedKey = $mappedStatement->executeQueryForObject(
485
+		$mappedStatement=$this->getManager()->getMappedStatement($selectKey->getID());
486
+		$generatedKey=$mappedStatement->executeQueryForObject(
490 487
 									$connection, $parameter, null);
491
-		if(strlen($prop = $selectKey->getProperty()) > 0)
488
+		if(strlen($prop=$selectKey->getProperty()) > 0)
492 489
 				TPropertyAccess::set($parameter, $prop, $generatedKey);
493 490
 		return $generatedKey;
494 491
 	}
@@ -502,8 +499,8 @@  discard block
 block discarded – undo
502 499
 	 */
503 500
 	public function executeUpdate($connection, $parameter)
504 501
 	{
505
-		$sql = $this->_command->create($this->getManager(),$connection, $this->_statement, $parameter);
506
-		$affectedRows = $sql->execute();
502
+		$sql=$this->_command->create($this->getManager(), $connection, $this->_statement, $parameter);
503
+		$affectedRows=$sql->execute();
507 504
 		//$this->executeSQLQuery($connection, $sql);
508 505
 		$this->executePostSelect($connection);
509 506
 		$this->onExecuteQuery($sql);
@@ -518,24 +515,24 @@  discard block
 block discarded – undo
518 515
 	{
519 516
 		while(count($this->_selectQueue))
520 517
 		{
521
-			$postSelect = array_shift($this->_selectQueue);
522
-			$method = $postSelect->getMethod();
523
-			$statement = $postSelect->getStatement();
524
-			$property = $postSelect->getResultProperty()->getProperty();
525
-			$keys = $postSelect->getKeys();
526
-			$resultObject = $postSelect->getResultObject();
527
-
528
-			if($method == self::QUERY_FOR_LIST || $method == self::QUERY_FOR_ARRAY)
518
+			$postSelect=array_shift($this->_selectQueue);
519
+			$method=$postSelect->getMethod();
520
+			$statement=$postSelect->getStatement();
521
+			$property=$postSelect->getResultProperty()->getProperty();
522
+			$keys=$postSelect->getKeys();
523
+			$resultObject=$postSelect->getResultObject();
524
+
525
+			if($method==self::QUERY_FOR_LIST || $method==self::QUERY_FOR_ARRAY)
529 526
 			{
530
-				$values = $statement->executeQueryForList($connection, $keys, null);
527
+				$values=$statement->executeQueryForList($connection, $keys, null);
531 528
 
532
-				if($method == self::QUERY_FOR_ARRAY)
533
-					$values = $values->toArray();
529
+				if($method==self::QUERY_FOR_ARRAY)
530
+					$values=$values->toArray();
534 531
 				TPropertyAccess::set($resultObject, $property, $values);
535 532
 			}
536
-			else if($method == self::QUERY_FOR_OBJECT)
533
+			else if($method==self::QUERY_FOR_OBJECT)
537 534
 			{
538
-				$value = $statement->executeQueryForObject($connection, $keys, null);
535
+				$value=$statement->executeQueryForObject($connection, $keys, null);
539 536
 				TPropertyAccess::set($resultObject, $property, $value);
540 537
 			}
541 538
 		}
@@ -558,21 +555,21 @@  discard block
 block discarded – undo
558 555
 	 */
559 556
 	protected function applyResultMap($row, &$resultObject=null)
560 557
 	{
561
-		if($row === false) return null;
558
+		if($row===false) return null;
562 559
 
563
-		$resultMapName = $this->_statement->getResultMap();
564
-		$resultClass = $this->_statement->getResultClass();
560
+		$resultMapName=$this->_statement->getResultMap();
561
+		$resultClass=$this->_statement->getResultClass();
565 562
 
566 563
 		$obj=null;
567 564
 		if($this->getManager()->getResultMaps()->contains($resultMapName))
568
-			$obj = $this->fillResultMap($resultMapName, $row, null, $resultObject);
565
+			$obj=$this->fillResultMap($resultMapName, $row, null, $resultObject);
569 566
 		else if(strlen($resultClass) > 0)
570
-			$obj = $this->fillResultClass($resultClass, $row, $resultObject);
567
+			$obj=$this->fillResultClass($resultClass, $row, $resultObject);
571 568
 		else
572
-			$obj = $this->fillDefaultResultMap(null, $row, $resultObject);
573
-		if(class_exists('TActiveRecord',false) && $obj instanceof TActiveRecord)
569
+			$obj=$this->fillDefaultResultMap(null, $row, $resultObject);
570
+		if(class_exists('TActiveRecord', false) && $obj instanceof TActiveRecord)
574 571
 			//Create a new clean active record.
575
-			$obj=TActiveRecord::createRecord(get_class($obj),$obj);
572
+			$obj=TActiveRecord::createRecord(get_class($obj), $obj);
576 573
 		return $obj;
577 574
 	}
578 575
 
@@ -587,8 +584,8 @@  discard block
 block discarded – undo
587 584
 	{
588 585
 		if($resultObject===null)
589 586
 		{
590
-			$registry = $this->getManager()->getTypeHandlers();
591
-			$resultObject = $this->_statement->createInstanceOfResultClass($registry,$row);
587
+			$registry=$this->getManager()->getTypeHandlers();
588
+			$resultObject=$this->_statement->createInstanceOfResultClass($registry, $row);
592 589
 		}
593 590
 
594 591
 		if($resultObject instanceOf \ArrayAccess)
@@ -609,10 +606,10 @@  discard block
 block discarded – undo
609 606
 	{
610 607
 		if($resultObject instanceof TList)
611 608
 			foreach($row as $v)
612
-				$resultObject[] = $v;
609
+				$resultObject[]=$v;
613 610
 		else
614 611
 			foreach($row as $k => $v)
615
-				$resultObject[$k] = $v;
612
+				$resultObject[$k]=$v;
616 613
 		return $resultObject;
617 614
 	}
618 615
 
@@ -624,18 +621,18 @@  discard block
 block discarded – undo
624 621
 	 */
625 622
 	protected function fillResultObjectProperty($row, $resultObject)
626 623
 	{
627
-		$index = 0;
624
+		$index=0;
628 625
 		$registry=$this->getManager()->getTypeHandlers();
629 626
 		foreach($row as $k=>$v)
630 627
 		{
631
-			$property = new TResultProperty;
628
+			$property=new TResultProperty;
632 629
 			if(is_string($k) && strlen($k) > 0)
633 630
 				$property->setColumn($k);
634 631
 			$property->setColumnIndex(++$index);
635
-			$type = gettype(TPropertyAccess::get($resultObject,$k));
632
+			$type=gettype(TPropertyAccess::get($resultObject, $k));
636 633
 			$property->setType($type);
637
-			$value = $property->getPropertyValue($registry,$row);
638
-			TPropertyAccess::set($resultObject, $k,$value);
634
+			$value=$property->getPropertyValue($registry, $row);
635
+			TPropertyAccess::set($resultObject, $k, $value);
639 636
 		}
640 637
 		return $resultObject;
641 638
 	}
@@ -649,12 +646,12 @@  discard block
 block discarded – undo
649 646
 	 */
650 647
 	protected function fillResultMap($resultMapName, $row, $parentGroup=null, &$resultObject=null)
651 648
 	{
652
-		$resultMap = $this->getManager()->getResultMap($resultMapName);
653
-		$registry = $this->getManager()->getTypeHandlers();
654
-		$resultMap = $resultMap->resolveSubMap($registry,$row);
649
+		$resultMap=$this->getManager()->getResultMap($resultMapName);
650
+		$registry=$this->getManager()->getTypeHandlers();
651
+		$resultMap=$resultMap->resolveSubMap($registry, $row);
655 652
 
656 653
 		if($resultObject===null)
657
-			$resultObject = $resultMap->createInstanceOfResult($registry);
654
+			$resultObject=$resultMap->createInstanceOfResult($registry);
658 655
 
659 656
 		if(is_object($resultObject))
660 657
 		{
@@ -666,7 +663,7 @@  discard block
 block discarded – undo
666 663
 		}
667 664
 		else
668 665
 		{
669
-			$resultObject = $this->fillDefaultResultMap($resultMap, $row, $resultObject);
666
+			$resultObject=$this->fillDefaultResultMap($resultMap, $row, $resultObject);
670 667
 		}
671 668
 		return $resultObject;
672 669
 	}
@@ -681,11 +678,11 @@  discard block
 block discarded – undo
681 678
 	 */
682 679
 	protected function addResultMapGroupBy($resultMap, $row, $parent, &$resultObject)
683 680
 	{
684
-		$group = $this->getResultMapGroupKey($resultMap, $row);
681
+		$group=$this->getResultMapGroupKey($resultMap, $row);
685 682
 
686 683
 		if(empty($parent))
687 684
 		{
688
-			$rootObject = array('object'=>$resultObject, 'property' => null);
685
+			$rootObject=array('object'=>$resultObject, 'property' => null);
689 686
 			$this->_groupBy->add(null, $group, $rootObject);
690 687
 		}
691 688
 
@@ -693,23 +690,23 @@  discard block
 block discarded – undo
693 690
 		{
694 691
 			//set properties.
695 692
 			$this->setObjectProperty($resultMap, $property, $row, $resultObject);
696
-			$nested = $property->getResultMapping();
693
+			$nested=$property->getResultMapping();
697 694
 
698 695
 			//nested property
699 696
 			if($this->getManager()->getResultMaps()->contains($nested))
700 697
 			{
701
-				$nestedMap = $this->getManager()->getResultMap($nested);
702
-				$groupKey = $this->getResultMapGroupKey($nestedMap, $row);
698
+				$nestedMap=$this->getManager()->getResultMap($nested);
699
+				$groupKey=$this->getResultMapGroupKey($nestedMap, $row);
703 700
 
704 701
 				//add the node reference first
705 702
 				if(empty($parent))
706 703
 					$this->_groupBy->add($group, $groupKey, '');
707 704
 
708 705
 				//get the nested result mapping value
709
-				$value = $this->fillResultMap($nested, $row, $groupKey);
706
+				$value=$this->fillResultMap($nested, $row, $groupKey);
710 707
 
711 708
 				//add it to the object tree graph
712
-				$groupObject = array('object'=>$value, 'property' => $property->getProperty());
709
+				$groupObject=array('object'=>$value, 'property' => $property->getProperty());
713 710
 				if(empty($parent))
714 711
 					$this->_groupBy->add($group, $groupKey, $groupObject);
715 712
 				else
@@ -727,7 +724,7 @@  discard block
 block discarded – undo
727 724
 	 */
728 725
 	protected function getResultMapGroupKey($resultMap, $row)
729 726
 	{
730
-		$groupBy = $resultMap->getGroupBy();
727
+		$groupBy=$resultMap->getGroupBy();
731 728
 		if(isset($row[$groupBy]))
732 729
 			return $resultMap->getID().$row[$groupBy];
733 730
 		else
@@ -748,12 +745,12 @@  discard block
 block discarded – undo
748 745
 			$resultObject='';
749 746
 
750 747
 		if($resultMap!==null)
751
-			$result = $this->fillArrayResultMap($resultMap, $row, $resultObject);
748
+			$result=$this->fillArrayResultMap($resultMap, $row, $resultObject);
752 749
 		else
753
-			$result = $row;
750
+			$result=$row;
754 751
 
755 752
 		//if scalar result types
756
-		if(count($result) == 1 && ($type = gettype($resultObject))!= 'array')
753
+		if(count($result)==1 && ($type=gettype($resultObject))!='array')
757 754
 			return $this->getScalarResult($result, $type);
758 755
 		else
759 756
 			return $result;
@@ -768,14 +765,14 @@  discard block
 block discarded – undo
768 765
 	 */
769 766
 	protected function fillArrayResultMap($resultMap, $row, $resultObject)
770 767
 	{
771
-		$result = array();
768
+		$result=array();
772 769
 		$registry=$this->getManager()->getTypeHandlers();
773 770
 		foreach($resultMap->getColumns() as $column)
774 771
 		{
775 772
 			if(($column->getType()===null)
776 773
 				&& ($resultObject!==null) && !is_object($resultObject))
777 774
 			$column->setType(gettype($resultObject));
778
-			$result[$column->getProperty()] = $column->getPropertyValue($registry,$row);
775
+			$result[$column->getProperty()]=$column->getPropertyValue($registry, $row);
779 776
 		}
780 777
 		return $result;
781 778
 	}
@@ -788,7 +785,7 @@  discard block
 block discarded – undo
788 785
 	 */
789 786
 	protected function getScalarResult($result, $type)
790 787
 	{
791
-		$scalar = array_shift($result);
788
+		$scalar=array_shift($result);
792 789
 		settype($scalar, $type);
793 790
 		return $scalar;
794 791
 	}
@@ -802,23 +799,23 @@  discard block
 block discarded – undo
802 799
 	 */
803 800
 	protected function setObjectProperty($resultMap, $property, $row, &$resultObject)
804 801
 	{
805
-		$select = $property->getSelect();
806
-		$key = $property->getProperty();
807
-		$nested = $property->getNestedResultMap();
802
+		$select=$property->getSelect();
803
+		$key=$property->getProperty();
804
+		$nested=$property->getNestedResultMap();
808 805
 		$registry=$this->getManager()->getTypeHandlers();
809
-		if($key === '')
806
+		if($key==='')
810 807
 		{
811
-			$resultObject = $property->getPropertyValue($registry,$row);
808
+			$resultObject=$property->getPropertyValue($registry, $row);
812 809
 		}
813
-		else if(strlen($select) == 0 && ($nested===null))
810
+		else if(strlen($select)==0 && ($nested===null))
814 811
 		{
815
-			$value = $property->getPropertyValue($registry,$row);
812
+			$value=$property->getPropertyValue($registry, $row);
816 813
 
817
-			$this->_IsRowDataFound = $this->_IsRowDataFound || ($value != null);
814
+			$this->_IsRowDataFound=$this->_IsRowDataFound || ($value!=null);
818 815
 			if(is_array($resultObject) || is_object($resultObject))
819 816
 				TPropertyAccess::set($resultObject, $key, $value);
820 817
 			else
821
-				$resultObject = $value;
818
+				$resultObject=$value;
822 819
 		}
823 820
 		else if($nested!==null)
824 821
 		{
@@ -831,9 +828,9 @@  discard block
 block discarded – undo
831 828
 			}
832 829
 			else
833 830
 			{
834
-				$obj = $nested->createInstanceOfResult($this->getManager()->getTypeHandlers());
835
-				if($this->fillPropertyWithResultMap($nested, $row, $obj) == false)
836
-					$obj = null;
831
+				$obj=$nested->createInstanceOfResult($this->getManager()->getTypeHandlers());
832
+				if($this->fillPropertyWithResultMap($nested, $row, $obj)==false)
833
+					$obj=null;
837 834
 				TPropertyAccess::set($resultObject, $key, $obj);
838 835
 			}
839 836
 		}
@@ -853,9 +850,9 @@  discard block
 block discarded – undo
853 850
 	 */
854 851
 	protected function enquequePostSelect($select, $resultMap, $property, $row, $resultObject)
855 852
 	{
856
-		$statement = $this->getManager()->getMappedStatement($select);
857
-		$key = $this->getPostSelectKeys($resultMap, $property, $row);
858
-		$postSelect = new TPostSelectBinding;
853
+		$statement=$this->getManager()->getMappedStatement($select);
854
+		$key=$this->getPostSelectKeys($resultMap, $property, $row);
855
+		$postSelect=new TPostSelectBinding;
859 856
 		$postSelect->setStatement($statement);
860 857
 		$postSelect->setResultObject($resultObject);
861 858
 		$postSelect->setResultProperty($property);
@@ -863,10 +860,10 @@  discard block
 block discarded – undo
863 860
 
864 861
 		if($property->instanceOfListType($resultObject))
865 862
 		{
866
-			$values = null;
863
+			$values=null;
867 864
 			if($property->getLazyLoad())
868 865
 			{
869
-				$values = TLazyLoadList::newInstance($statement, $key,
866
+				$values=TLazyLoadList::newInstance($statement, $key,
870 867
 								$resultObject, $property->getProperty());
871 868
 				TPropertyAccess::set($resultObject, $property->getProperty(), $values);
872 869
 			}
@@ -879,7 +876,7 @@  discard block
 block discarded – undo
879 876
 			$postSelect->setMethod(self::QUERY_FOR_OBJECT);
880 877
 
881 878
 		if(!$property->getLazyLoad())
882
-			$this->_selectQueue[] = $postSelect;
879
+			$this->_selectQueue[]=$postSelect;
883 880
 	}
884 881
 
885 882
 	/**
@@ -889,23 +886,23 @@  discard block
 block discarded – undo
889 886
 	 * @param array current row data.
890 887
 	 * @return array list of primary key values.
891 888
 	 */
892
-	protected function getPostSelectKeys($resultMap, $property,$row)
889
+	protected function getPostSelectKeys($resultMap, $property, $row)
893 890
 	{
894
-		$value = $property->getColumn();
895
-		if(is_int(strpos($value.',',0)) || is_int(strpos($value, '=',0)))
891
+		$value=$property->getColumn();
892
+		if(is_int(strpos($value.',', 0)) || is_int(strpos($value, '=', 0)))
896 893
 		{
897
-			$keys = array();
894
+			$keys=array();
898 895
 			foreach(explode(',', $value) as $entry)
899 896
 			{
900
-				$pair =explode('=',$entry);
901
-				$keys[trim($pair[0])] = $row[trim($pair[1])];
897
+				$pair=explode('=', $entry);
898
+				$keys[trim($pair[0])]=$row[trim($pair[1])];
902 899
 			}
903 900
 			return $keys;
904 901
 		}
905 902
 		else
906 903
 		{
907 904
 			$registry=$this->getManager()->getTypeHandlers();
908
-			return $property->getPropertyValue($registry,$row);
905
+			return $property->getPropertyValue($registry, $row);
909 906
 		}
910 907
 	}
911 908
 
@@ -918,28 +915,28 @@  discard block
 block discarded – undo
918 915
 	 */
919 916
 	protected function fillPropertyWithResultMap($resultMap, $row, &$resultObject)
920 917
 	{
921
-		$dataFound = false;
918
+		$dataFound=false;
922 919
 		foreach($resultMap->getColumns() as $property)
923 920
 		{
924
-			$this->_IsRowDataFound = false;
921
+			$this->_IsRowDataFound=false;
925 922
 			$this->setObjectProperty($resultMap, $property, $row, $resultObject);
926
-			$dataFound = $dataFound || $this->_IsRowDataFound;
923
+			$dataFound=$dataFound || $this->_IsRowDataFound;
927 924
 		}
928
-		$this->_IsRowDataFound = $dataFound;
925
+		$this->_IsRowDataFound=$dataFound;
929 926
 		return $dataFound;
930 927
 	}
931 928
 
932 929
 	public function __wakeup()
933 930
 	{
934
-		if (is_null($this->_selectQueue)) $this->_selectQueue = array();
931
+		if(is_null($this->_selectQueue)) $this->_selectQueue=array();
935 932
 	}
936 933
 
937 934
 	public function __sleep()
938 935
 	{
939
-		$exprops = array(); $cn = __CLASS__;
940
-		if (!count($this->_selectQueue)) $exprops[] = "\0$cn\0_selectQueue";
941
-		if (is_null($this->_groupBy)) $exprops[] = "\0$cn\0_groupBy";
942
-		if (!$this->_IsRowDataFound) $exprops[] = "\0$cn\0_IsRowDataFound";
943
-		return array_diff(parent::__sleep(),$exprops);
936
+		$exprops=array(); $cn=__CLASS__;
937
+		if(!count($this->_selectQueue)) $exprops[]="\0$cn\0_selectQueue";
938
+		if(is_null($this->_groupBy)) $exprops[]="\0$cn\0_groupBy";
939
+		if(!$this->_IsRowDataFound) $exprops[]="\0$cn\0_IsRowDataFound";
940
+		return array_diff(parent::__sleep(), $exprops);
944 941
 	}
945 942
 }
946 943
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -249,8 +249,7 @@  discard block
 block discarded – undo
249 249
 				$param = new TResultSetListItemParameter($obj, $parameter, $list);
250 250
 				$this->raiseRowDelegate($delegate, $param);
251 251
 			}
252
-		}
253
-		else
252
+		} else
254 253
 		{
255 254
 			//var_dump($sql,$parameter);
256 255
 			foreach($reader as $row)
@@ -326,8 +325,7 @@  discard block
 block discarded – undo
326 325
 				$param = new TResultSetMapItemParameter($key, $value, $parameter, $map);
327 326
 				$this->raiseRowDelegate($delegate, $param);
328 327
 			}
329
-		}
330
-		else
328
+		} else
331 329
 		{
332 330
 			//while($row = $recordSet->fetchRow())
333 331
 			foreach($reader as $row)
@@ -353,8 +351,7 @@  discard block
 block discarded – undo
353 351
 		if(is_string($handler))
354 352
 		{
355 353
 			call_user_func($handler,$this,$param);
356
-		}
357
-		else if(is_callable($handler,true))
354
+		} else if(is_callable($handler,true))
358 355
 		{
359 356
 			// an array: 0 - object, 1 - method name/path
360 357
 			list($object,$method)=$handler;
@@ -369,8 +366,7 @@  discard block
 block discarded – undo
369 366
 				}
370 367
 				$object->$method($this,$param);
371 368
 			}
372
-		}
373
-		else
369
+		} else
374 370
 			throw new TInvalidDataValueException('sqlmap_invalid_delegate', $this->getID(), $handler);
375 371
 	}
376 372
 
@@ -532,8 +528,7 @@  discard block
 block discarded – undo
532 528
 				if($method == self::QUERY_FOR_ARRAY)
533 529
 					$values = $values->toArray();
534 530
 				TPropertyAccess::set($resultObject, $property, $values);
535
-			}
536
-			else if($method == self::QUERY_FOR_OBJECT)
531
+			} else if($method == self::QUERY_FOR_OBJECT)
537 532
 			{
538 533
 				$value = $statement->executeQueryForObject($connection, $keys, null);
539 534
 				TPropertyAccess::set($resultObject, $property, $value);
@@ -663,8 +658,7 @@  discard block
 block discarded – undo
663 658
 			else
664 659
 				foreach($resultMap->getColumns() as $property)
665 660
 					$this->setObjectProperty($resultMap, $property, $row, $resultObject);
666
-		}
667
-		else
661
+		} else
668 662
 		{
669 663
 			$resultObject = $this->fillDefaultResultMap($resultMap, $row, $resultObject);
670 664
 		}
@@ -809,8 +803,7 @@  discard block
 block discarded – undo
809 803
 		if($key === '')
810 804
 		{
811 805
 			$resultObject = $property->getPropertyValue($registry,$row);
812
-		}
813
-		else if(strlen($select) == 0 && ($nested===null))
806
+		} else if(strlen($select) == 0 && ($nested===null))
814 807
 		{
815 808
 			$value = $property->getPropertyValue($registry,$row);
816 809
 
@@ -819,8 +812,7 @@  discard block
 block discarded – undo
819 812
 				TPropertyAccess::set($resultObject, $key, $value);
820 813
 			else
821 814
 				$resultObject = $value;
822
-		}
823
-		else if($nested!==null)
815
+		} else if($nested!==null)
824 816
 		{
825 817
 			if($property->instanceOfListType($resultObject) || $property->instanceOfArrayType($resultObject))
826 818
 			{
@@ -828,16 +820,14 @@  discard block
 block discarded – undo
828 820
 					throw new TSqlMapExecutionException(
829 821
 						'sqlmap_non_groupby_array_list_type', $resultMap->getID(),
830 822
 						get_class($resultObject), $key);
831
-			}
832
-			else
823
+			} else
833 824
 			{
834 825
 				$obj = $nested->createInstanceOfResult($this->getManager()->getTypeHandlers());
835 826
 				if($this->fillPropertyWithResultMap($nested, $row, $obj) == false)
836 827
 					$obj = null;
837 828
 				TPropertyAccess::set($resultObject, $key, $obj);
838 829
 			}
839
-		}
840
-		else //'select' ResultProperty
830
+		} else //'select' ResultProperty
841 831
 		{
842 832
 			$this->enquequePostSelect($select, $resultMap, $property, $row, $resultObject);
843 833
 		}
@@ -869,11 +859,9 @@  discard block
 block discarded – undo
869 859
 				$values = TLazyLoadList::newInstance($statement, $key,
870 860
 								$resultObject, $property->getProperty());
871 861
 				TPropertyAccess::set($resultObject, $property->getProperty(), $values);
872
-			}
873
-			else
862
+			} else
874 863
 				$postSelect->setMethod(self::QUERY_FOR_LIST);
875
-		}
876
-		else if($property->instanceOfArrayType($resultObject))
864
+		} else if($property->instanceOfArrayType($resultObject))
877 865
 			$postSelect->setMethod(self::QUERY_FOR_ARRAY);
878 866
 		else
879 867
 			$postSelect->setMethod(self::QUERY_FOR_OBJECT);
@@ -901,8 +889,7 @@  discard block
 block discarded – undo
901 889
 				$keys[trim($pair[0])] = $row[trim($pair[1])];
902 890
 			}
903 891
 			return $keys;
904
-		}
905
-		else
892
+		} else
906 893
 		{
907 894
 			$registry=$this->getManager()->getTypeHandlers();
908 895
 			return $property->getPropertyValue($registry,$row);
Please login to merge, or discard this patch.
framework/Data/SqlMap/Statements/TPostSelectBinding.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -39,5 +39,9 @@
 block discarded – undo
39 39
 	public function setKeys($value){ $this->_keys = $value; }
40 40
 
41 41
 	public function getMethod(){ return $this->_method; }
42
+
43
+	/**
44
+	 * @param integer $value
45
+	 */
42 46
 	public function setMethod($value){ $this->_method = $value; }
43 47
 }
44 48
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,18 +26,18 @@
 block discarded – undo
26 26
 	private $_keys=null;
27 27
 	private $_method=TMappedStatement::QUERY_FOR_LIST;
28 28
 
29
-	public function getStatement(){ return $this->_statement; }
30
-	public function setStatement($value){ $this->_statement = $value; }
29
+	public function getStatement() { return $this->_statement; }
30
+	public function setStatement($value) { $this->_statement=$value; }
31 31
 
32
-	public function getResultProperty(){ return $this->_property; }
33
-	public function setResultProperty($value){ $this->_property = $value; }
32
+	public function getResultProperty() { return $this->_property; }
33
+	public function setResultProperty($value) { $this->_property=$value; }
34 34
 
35
-	public function getResultObject(){ return $this->_resultObject; }
36
-	public function setResultObject($value){ $this->_resultObject = $value; }
35
+	public function getResultObject() { return $this->_resultObject; }
36
+	public function setResultObject($value) { $this->_resultObject=$value; }
37 37
 
38
-	public function getKeys(){ return $this->_keys; }
39
-	public function setKeys($value){ $this->_keys = $value; }
38
+	public function getKeys() { return $this->_keys; }
39
+	public function setKeys($value) { $this->_keys=$value; }
40 40
 
41
-	public function getMethod(){ return $this->_method; }
42
-	public function setMethod($value){ $this->_method = $value; }
41
+	public function getMethod() { return $this->_method; }
42
+	public function setMethod($value) { $this->_method=$value; }
43 43
 }
44 44
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Data/SqlMap/Statements/TResultSetListItemParameter.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -24,6 +24,9 @@
 block discarded – undo
24 24
 	private $_parameterObject;
25 25
 	private $_list;
26 26
 
27
+	/**
28
+	 * @param \ArrayAccess $list
29
+	 */
27 30
 	public function __construct($result, $parameter, &$list)
28 31
 	{
29 32
 		$this->_resultObject = $result;
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@
 block discarded – undo
26 26
 
27 27
 	public function __construct($result, $parameter, &$list)
28 28
 	{
29
-		$this->_resultObject = $result;
30
-		$this->_parameterObject = $parameter;
31
-		$this->_list = &$list;
29
+		$this->_resultObject=$result;
30
+		$this->_parameterObject=$parameter;
31
+		$this->_list=&$list;
32 32
 	}
33 33
 
34 34
 	public function getResult()
Please login to merge, or discard this patch.
framework/Data/SqlMap/Statements/TSqlMapObjectCollectionTree.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -53,6 +53,7 @@
 block discarded – undo
53 53
 	 * @param string parent node id
54 54
 	 * @param string new node id
55 55
 	 * @param mixed node value
56
+	 * @param string $node
56 57
 	 */
57 58
 	public function add($parent, $node, $object='')
58 59
 	{
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -30,22 +30,22 @@  discard block
 block discarded – undo
30 30
 	/**
31 31
 	 * @var array object graph as tree
32 32
 	 */
33
-	private $_tree = array();
33
+	private $_tree=array();
34 34
 	/**
35 35
 	 * @var array tree node values
36 36
 	 */
37
-	private $_entries = array();
37
+	private $_entries=array();
38 38
 	/**
39 39
 	 * @var array resulting object collection
40 40
 	 */
41
-	private $_list = array();
41
+	private $_list=array();
42 42
 
43 43
 	/**
44 44
 	 * @return boolean true if the graph is empty
45 45
 	 */
46 46
 	public function isEmpty()
47 47
 	{
48
-		return count($this->_entries) == 0;
48
+		return count($this->_entries)==0;
49 49
 	}
50 50
 
51 51
 	/**
@@ -59,22 +59,22 @@  discard block
 block discarded – undo
59 59
 		if(isset($this->_entries[$parent]) && ($this->_entries[$parent]!==null)
60 60
 			&& isset($this->_entries[$node]) && ($this->_entries[$node]!==null))
61 61
 		{
62
-			$this->_entries[$node] = $object;
62
+			$this->_entries[$node]=$object;
63 63
 			return;
64 64
 		}
65
-		$this->_entries[$node] = $object;
65
+		$this->_entries[$node]=$object;
66 66
 		if(empty($parent))
67 67
 		{
68 68
 			if(isset($this->_entries[$node]))
69 69
 				return;
70
-			$this->_tree[$node] = array();
70
+			$this->_tree[$node]=array();
71 71
 		}
72
-		$found = $this->addNode($this->_tree, $parent, $node);
72
+		$found=$this->addNode($this->_tree, $parent, $node);
73 73
 		if(!$found && !empty($parent))
74 74
 		{
75
-			$this->_tree[$parent] = array();
76
-			if(!isset($this->_entries[$parent]) || $object !== '')
77
-				$this->_entries[$parent] = $object;
75
+			$this->_tree[$parent]=array();
76
+			if(!isset($this->_entries[$parent]) || $object!=='')
77
+				$this->_entries[$parent]=$object;
78 78
 			$this->addNode($this->_tree, $parent, $node);
79 79
 		}
80 80
 	}
@@ -88,20 +88,20 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	protected function addNode(&$childs, $parent, $node)
90 90
 	{
91
-		$found = false;
91
+		$found=false;
92 92
 		reset($childs);
93
-		for($i = 0, $k = count($childs); $i < $k; $i++)
93
+		for($i=0, $k=count($childs); $i < $k; $i++)
94 94
 		{
95
-			$key = key($childs);
95
+			$key=key($childs);
96 96
 			next($childs);
97
-			if($key == $parent)
97
+			if($key==$parent)
98 98
 			{
99
-				$found = true;
100
-				$childs[$key][$node] = array();
99
+				$found=true;
100
+				$childs[$key][$node]=array();
101 101
 			}
102 102
 			else
103 103
 			{
104
-				$found = $found || $this->addNode($childs[$key], $parent, $node);
104
+				$found=$found || $this->addNode($childs[$key], $parent, $node);
105 105
 			}
106 106
 		}
107 107
 		return $found;
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	protected function hasChildren(&$nodes)
125 125
 	{
126
-		$hasChildren = false;
126
+		$hasChildren=false;
127 127
 		foreach($nodes as $node)
128
-			if(count($node) != 0)
128
+			if(count($node)!=0)
129 129
 				return true;
130 130
 		return $hasChildren;
131 131
 	}
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	protected function collectChildren($parent, &$nodes)
139 139
 	{
140
-		$noChildren = !$this->hasChildren($nodes);
141
-		$childs = array();
142
-		for(reset($nodes); $key = key($nodes);)
140
+		$noChildren=!$this->hasChildren($nodes);
141
+		$childs=array();
142
+		for(reset($nodes); $key=key($nodes);)
143 143
 		{
144 144
 			next($nodes);
145 145
 			if($noChildren)
146 146
 			{
147
-				$childs[] = $key;
147
+				$childs[]=$key;
148 148
 				unset($nodes[$key]);
149 149
 			}
150 150
 			else
@@ -164,17 +164,17 @@  discard block
 block discarded – undo
164 164
 		if(empty($parent) || empty($this->_entries[$parent]))
165 165
 			return;
166 166
 
167
-		$parentObject = $this->_entries[$parent]['object'];
168
-		$property = $this->_entries[$nodes[0]]['property'];
167
+		$parentObject=$this->_entries[$parent]['object'];
168
+		$property=$this->_entries[$nodes[0]]['property'];
169 169
 
170
-		$list = TPropertyAccess::get($parentObject, $property);
170
+		$list=TPropertyAccess::get($parentObject, $property);
171 171
 
172 172
 		foreach($nodes as $node)
173 173
 		{
174 174
 			if($list instanceof TList)
175
-				$parentObject->{$property}[] = $this->_entries[$node]['object'];
175
+				$parentObject->{$property}[]=$this->_entries[$node]['object'];
176 176
 			else if(is_array($list))
177
-				$list[] = $this->_entries[$node]['object'];
177
+				$list[]=$this->_entries[$node]['object'];
178 178
 			else
179 179
 				throw new TSqlMapExecutionException(
180 180
 					'sqlmap_property_must_be_list');
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
 		if(is_array($list))
184 184
 			TPropertyAccess::set($parentObject, $property, $list);
185 185
 
186
-		if($this->_entries[$parent]['property'] === null)
187
-			$this->_list[] = $parentObject;
186
+		if($this->_entries[$parent]['property']===null)
187
+			$this->_list[]=$parentObject;
188 188
 	}
189 189
 
190 190
 	/**
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
 
198 198
 	public function __sleep()
199 199
 	{
200
-		$exprops = array(); $cn = __CLASS__;
201
-		if (!count($this->_tree)) $exprops[] = "\0$cn\0_tree";
202
-		if (!count($this->_entries)) $exprops[] = "\0$cn\0_entries";
203
-		if (!count($this->_list)) $exprops[] = "\0$cn\0_list";
204
-		return array_diff(parent::__sleep(),$exprops);
200
+		$exprops=array(); $cn=__CLASS__;
201
+		if(!count($this->_tree)) $exprops[]="\0$cn\0_tree";
202
+		if(!count($this->_entries)) $exprops[]="\0$cn\0_entries";
203
+		if(!count($this->_list)) $exprops[]="\0$cn\0_list";
204
+		return array_diff(parent::__sleep(), $exprops);
205 205
 	}
206 206
 }
207 207
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -98,8 +98,7 @@  discard block
 block discarded – undo
98 98
 			{
99 99
 				$found = true;
100 100
 				$childs[$key][$node] = array();
101
-			}
102
-			else
101
+			} else
103 102
 			{
104 103
 				$found = $found || $this->addNode($childs[$key], $parent, $node);
105 104
 			}
@@ -112,8 +111,9 @@  discard block
 block discarded – undo
112 111
 	 */
113 112
 	public function collect()
114 113
 	{
115
-		while(count($this->_tree) > 0)
116
-			$this->collectChildren(null, $this->_tree);
114
+		while(count($this->_tree) > 0) {
115
+					$this->collectChildren(null, $this->_tree);
116
+		}
117 117
 		return $this->getCollection();
118 118
 	}
119 119
 
@@ -146,8 +146,7 @@  discard block
 block discarded – undo
146 146
 			{
147 147
 				$childs[] = $key;
148 148
 				unset($nodes[$key]);
149
-			}
150
-			else
149
+			} else
151 150
 				$this->collectChildren($key, $nodes[$key]);
152 151
 		}
153 152
 		if(count($childs) > 0)
Please login to merge, or discard this patch.
framework/Exceptions/THttpException.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -393,6 +393,8 @@
 block discarded – undo
393 393
 	 * in the message file. If so, the message in the preferred language
394 394
 	 * will be used as the error message. Any rest parameters will be used
395 395
 	 * to replace placeholders ({0}, {1}, {2}, etc.) in the message.
396
+	 * @param integer $statusCode
397
+	 * @param string $errorMessage
396 398
 	 */
397 399
 	public function __construct($statusCode,$errorMessage)
398 400
 	{
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * will be used as the error message. Any rest parameters will be used
36 36
 	 * to replace placeholders ({0}, {1}, {2}, etc.) in the message.
37 37
 	 */
38
-	public function __construct($statusCode,$errorMessage)
38
+	public function __construct($statusCode, $errorMessage)
39 39
 	{
40 40
 		$this->_statusCode=$statusCode;
41 41
 		$this->setErrorCode($errorMessage);
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 		array_shift($args);
46 46
 		$n=count($args);
47 47
 		$tokens=array();
48
-		for($i=0;$i<$n;++$i)
48
+		for($i=0; $i < $n; ++$i)
49 49
 			$tokens['{'.$i.'}']=TPropertyValue::ensureString($args[$i]);
50
-		parent::__construct(strtr($errorMessage,$tokens));
50
+		parent::__construct(strtr($errorMessage, $tokens));
51 51
 	}
52 52
 
53 53
 	/**
Please login to merge, or discard this patch.
framework/I18N/core/Gettext/TGettext_MO.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * _read
87 87
      *
88 88
      * @access  private
89
-     * @return  mixed
89
+     * @return  string|null
90 90
      * @param   int     $bytes
91 91
      */
92 92
     function _read($bytes = 1)
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      * Load MO file
166 166
      *
167 167
      * @access   public
168
-     * @return   mixed   Returns true on success or PEAR_Error on failure.
168
+     * @return   boolean   Returns true on success or PEAR_Error on failure.
169 169
      * @param    string  $file
170 170
      */
171 171
     function load($file = null)
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
      * Save MO file
262 262
      *
263 263
      * @access  public
264
-     * @return  mixed   Returns true on success or PEAR_Error on failure.
264
+     * @return  boolean   Returns true on success or PEAR_Error on failure.
265 265
      * @param   string  $file
266 266
      */
267 267
     function save($file = null)
Please login to merge, or discard this patch.
Indentation   +295 added lines, -295 removed lines patch added patch discarded remove patch
@@ -52,304 +52,304 @@
 block discarded – undo
52 52
  */
53 53
 class TGettext_MO extends TGettext
54 54
 {
55
-    /**
56
-     * file handle
57
-     *
58
-     * @access  private
59
-     * @var     resource
60
-     */
61
-    protected $_handle = null;
62
-
63
-    /**
64
-     * big endianess
65
-     *
66
-     * Whether to write with big endian byte order.
67
-     *
68
-     * @access  public
69
-     * @var     bool
70
-     */
71
-    protected $writeBigEndian = false;
72
-
73
-    /**
74
-     * Constructor
75
-     *
76
-     * @access  public
77
-     * @return  object      File_Gettext_MO
78
-     * @param   string      $file   path to GNU MO file
79
-     */
80
-    function __construct($file = '')
81
-    {
82
-        $this->file = $file;
83
-    }
84
-
85
-    /**
86
-     * _read
87
-     *
88
-     * @access  private
89
-     * @return  mixed
90
-     * @param   int     $bytes
91
-     */
92
-    function _read($bytes = 1)
93
-    {
94
-        if (0 < $bytes = abs($bytes)) {
95
-            return fread($this->_handle, $bytes);
96
-        }
97
-        return null;
98
-    }
99
-
100
-    /**
101
-     * _readInt
102
-     *
103
-     * @access  private
104
-     * @return  int
105
-     * @param   bool    $bigendian
106
-     */
107
-    function _readInt($bigendian = false)
108
-    {
55
+	/**
56
+	 * file handle
57
+	 *
58
+	 * @access  private
59
+	 * @var     resource
60
+	 */
61
+	protected $_handle = null;
62
+
63
+	/**
64
+	 * big endianess
65
+	 *
66
+	 * Whether to write with big endian byte order.
67
+	 *
68
+	 * @access  public
69
+	 * @var     bool
70
+	 */
71
+	protected $writeBigEndian = false;
72
+
73
+	/**
74
+	 * Constructor
75
+	 *
76
+	 * @access  public
77
+	 * @return  object      File_Gettext_MO
78
+	 * @param   string      $file   path to GNU MO file
79
+	 */
80
+	function __construct($file = '')
81
+	{
82
+		$this->file = $file;
83
+	}
84
+
85
+	/**
86
+	 * _read
87
+	 *
88
+	 * @access  private
89
+	 * @return  mixed
90
+	 * @param   int     $bytes
91
+	 */
92
+	function _read($bytes = 1)
93
+	{
94
+		if (0 < $bytes = abs($bytes)) {
95
+			return fread($this->_handle, $bytes);
96
+		}
97
+		return null;
98
+	}
99
+
100
+	/**
101
+	 * _readInt
102
+	 *
103
+	 * @access  private
104
+	 * @return  int
105
+	 * @param   bool    $bigendian
106
+	 */
107
+	function _readInt($bigendian = false)
108
+	{
109 109
 		//unpack returns a reference????
110 110
 		$unpacked = unpack($bigendian ? 'N' : 'V', $this->_read(4));
111
-        return array_shift($unpacked);
112
-    }
113
-
114
-    /**
115
-     * _writeInt
116
-     *
117
-     * @access  private
118
-     * @return  int
119
-     * @param   int     $int
120
-     */
121
-    function _writeInt($int)
122
-    {
123
-        return $this->_write(pack($this->writeBigEndian ? 'N' : 'V', (int) $int));
124
-    }
125
-
126
-    /**
127
-     * _write
128
-     *
129
-     * @access  private
130
-     * @return  int
131
-     * @param   string  $data
132
-     */
133
-    function _write($data)
134
-    {
135
-        return fwrite($this->_handle, $data);
136
-    }
137
-
138
-    /**
139
-     * _writeStr
140
-     *
141
-     * @access  private
142
-     * @return  int
143
-     * @param   string  $string
144
-     */
145
-    function _writeStr($string)
146
-    {
147
-        return $this->_write($string . "\0");
148
-    }
149
-
150
-    /**
151
-     * _readStr
152
-     *
153
-     * @access  private
154
-     * @return  string
155
-     * @param   array   $params     associative array with offset and length
156
-     *                              of the string
157
-     */
158
-    function _readStr($params)
159
-    {
160
-        fseek($this->_handle, $params['offset']);
161
-        return $this->_read($params['length']);
162
-    }
163
-
164
-    /**
165
-     * Load MO file
166
-     *
167
-     * @access   public
168
-     * @return   mixed   Returns true on success or PEAR_Error on failure.
169
-     * @param    string  $file
170
-     */
171
-    function load($file = null)
172
-    {
173
-        if (!isset($file)) {
174
-            $file = $this->file;
175
-        }
176
-
177
-        // open MO file
178
-        if (!is_resource($this->_handle = @fopen($file, 'rb'))) {
179
-            return false;
180
-        }
181
-        // lock MO file shared
182
-        if (!@flock($this->_handle, LOCK_SH)) {
183
-            @fclose($this->_handle);
184
-            return false;
185
-        }
186
-
187
-        // read (part of) magic number from MO file header and define endianess
111
+		return array_shift($unpacked);
112
+	}
113
+
114
+	/**
115
+	 * _writeInt
116
+	 *
117
+	 * @access  private
118
+	 * @return  int
119
+	 * @param   int     $int
120
+	 */
121
+	function _writeInt($int)
122
+	{
123
+		return $this->_write(pack($this->writeBigEndian ? 'N' : 'V', (int) $int));
124
+	}
125
+
126
+	/**
127
+	 * _write
128
+	 *
129
+	 * @access  private
130
+	 * @return  int
131
+	 * @param   string  $data
132
+	 */
133
+	function _write($data)
134
+	{
135
+		return fwrite($this->_handle, $data);
136
+	}
137
+
138
+	/**
139
+	 * _writeStr
140
+	 *
141
+	 * @access  private
142
+	 * @return  int
143
+	 * @param   string  $string
144
+	 */
145
+	function _writeStr($string)
146
+	{
147
+		return $this->_write($string . "\0");
148
+	}
149
+
150
+	/**
151
+	 * _readStr
152
+	 *
153
+	 * @access  private
154
+	 * @return  string
155
+	 * @param   array   $params     associative array with offset and length
156
+	 *                              of the string
157
+	 */
158
+	function _readStr($params)
159
+	{
160
+		fseek($this->_handle, $params['offset']);
161
+		return $this->_read($params['length']);
162
+	}
163
+
164
+	/**
165
+	 * Load MO file
166
+	 *
167
+	 * @access   public
168
+	 * @return   mixed   Returns true on success or PEAR_Error on failure.
169
+	 * @param    string  $file
170
+	 */
171
+	function load($file = null)
172
+	{
173
+		if (!isset($file)) {
174
+			$file = $this->file;
175
+		}
176
+
177
+		// open MO file
178
+		if (!is_resource($this->_handle = @fopen($file, 'rb'))) {
179
+			return false;
180
+		}
181
+		// lock MO file shared
182
+		if (!@flock($this->_handle, LOCK_SH)) {
183
+			@fclose($this->_handle);
184
+			return false;
185
+		}
186
+
187
+		// read (part of) magic number from MO file header and define endianess
188 188
 
189 189
 		//unpack returns a reference????
190 190
 		$unpacked = unpack('c', $this->_read(4));
191
-        switch ($magic = array_shift($unpacked))
192
-        {
193
-            case -34:
194
-                $be = false;
195
-            break;
196
-
197
-            case -107:
198
-                $be = true;
199
-            break;
200
-
201
-            default:
202
-                return false;
203
-        }
204
-
205
-        // check file format revision - we currently only support 0
206
-        if (0 !== ($_rev = $this->_readInt($be))) {
207
-            return false;
208
-        }
209
-
210
-        // count of strings in this file
211
-        $count = $this->_readInt($be);
212
-
213
-        // offset of hashing table of the msgids
214
-        $offset_original = $this->_readInt($be);
215
-        // offset of hashing table of the msgstrs
216
-        $offset_translat = $this->_readInt($be);
217
-
218
-        // move to msgid hash table
219
-        fseek($this->_handle, $offset_original);
220
-        // read lengths and offsets of msgids
221
-        $original = array();
222
-        for ($i = 0; $i < $count; $i++) {
223
-            $original[$i] = array(
224
-                'length' => $this->_readInt($be),
225
-                'offset' => $this->_readInt($be)
226
-            );
227
-        }
228
-
229
-        // move to msgstr hash table
230
-        fseek($this->_handle, $offset_translat);
231
-        // read lengths and offsets of msgstrs
232
-        $translat = array();
233
-        for ($i = 0; $i < $count; $i++) {
234
-            $translat[$i] = array(
235
-                'length' => $this->_readInt($be),
236
-                'offset' => $this->_readInt($be)
237
-            );
238
-        }
239
-
240
-        // read all
241
-        for ($i = 0; $i < $count; $i++) {
242
-            $this->strings[$this->_readStr($original[$i])] =
243
-                $this->_readStr($translat[$i]);
244
-        }
245
-
246
-        // done
247
-        @flock($this->_handle, LOCK_UN);
248
-        @fclose($this->_handle);
249
-        $this->_handle = null;
250
-
251
-        // check for meta info
252
-        if (isset($this->strings[''])) {
253
-            $this->meta = parent::meta2array($this->strings['']);
254
-            unset($this->strings['']);
255
-        }
256
-
257
-        return true;
258
-    }
259
-
260
-    /**
261
-     * Save MO file
262
-     *
263
-     * @access  public
264
-     * @return  mixed   Returns true on success or PEAR_Error on failure.
265
-     * @param   string  $file
266
-     */
267
-    function save($file = null)
268
-    {
269
-        if (!isset($file)) {
270
-            $file = $this->file;
271
-        }
272
-
273
-        // open MO file
274
-        if (!is_resource($this->_handle = @fopen($file, 'wb'))) {
275
-            return false;
276
-        }
277
-        // lock MO file exclusively
278
-        if (!@flock($this->_handle, LOCK_EX)) {
279
-            @fclose($this->_handle);
280
-            return false;
281
-        }
282
-
283
-        // write magic number
284
-        if ($this->writeBigEndian) {
285
-            $this->_write(pack('c*', 0x95, 0x04, 0x12, 0xde));
286
-        } else {
287
-            $this->_write(pack('c*', 0xde, 0x12, 0x04, 0x95));
288
-        }
289
-
290
-        // write file format revision
291
-        $this->_writeInt(0);
292
-
293
-        $count = count($this->strings) + ($meta = (count($this->meta) ? 1 : 0));
294
-        // write count of strings
295
-        $this->_writeInt($count);
296
-
297
-        $offset = 28;
298
-        // write offset of orig. strings hash table
299
-        $this->_writeInt($offset);
300
-
301
-        $offset += ($count * 8);
302
-        // write offset transl. strings hash table
303
-        $this->_writeInt($offset);
304
-
305
-        // write size of hash table (we currently ommit the hash table)
306
-        $this->_writeInt(0);
307
-
308
-        $offset += ($count * 8);
309
-        // write offset of hash table
310
-        $this->_writeInt($offset);
311
-
312
-        // unshift meta info
313
-        if ($this->meta) {
314
-            $meta = '';
315
-            foreach ($this->meta as $key => $val) {
316
-                $meta .= $key . ': ' . $val . "\n";
317
-            }
318
-            $strings = array('' => $meta) + $this->strings;
319
-        } else {
320
-            $strings = $this->strings;
321
-        }
322
-
323
-        // write offsets for original strings
324
-        foreach (array_keys($strings) as $o) {
325
-            $len = strlen($o);
326
-            $this->_writeInt($len);
327
-            $this->_writeInt($offset);
328
-            $offset += $len + 1;
329
-        }
330
-
331
-        // write offsets for translated strings
332
-        foreach ($strings as $t) {
333
-            $len = strlen($t);
334
-            $this->_writeInt($len);
335
-            $this->_writeInt($offset);
336
-            $offset += $len + 1;
337
-        }
338
-
339
-        // write original strings
340
-        foreach (array_keys($strings) as $o) {
341
-            $this->_writeStr($o);
342
-        }
343
-
344
-        // write translated strings
345
-        foreach ($strings as $t) {
346
-            $this->_writeStr($t);
347
-        }
348
-
349
-        // done
350
-        @flock($this->_handle, LOCK_UN);
351
-        @fclose($this->_handle);
352
-        chmod($file,PRADO_CHMOD);
353
-        return true;
354
-    }
191
+		switch ($magic = array_shift($unpacked))
192
+		{
193
+			case -34:
194
+				$be = false;
195
+			break;
196
+
197
+			case -107:
198
+				$be = true;
199
+			break;
200
+
201
+			default:
202
+				return false;
203
+		}
204
+
205
+		// check file format revision - we currently only support 0
206
+		if (0 !== ($_rev = $this->_readInt($be))) {
207
+			return false;
208
+		}
209
+
210
+		// count of strings in this file
211
+		$count = $this->_readInt($be);
212
+
213
+		// offset of hashing table of the msgids
214
+		$offset_original = $this->_readInt($be);
215
+		// offset of hashing table of the msgstrs
216
+		$offset_translat = $this->_readInt($be);
217
+
218
+		// move to msgid hash table
219
+		fseek($this->_handle, $offset_original);
220
+		// read lengths and offsets of msgids
221
+		$original = array();
222
+		for ($i = 0; $i < $count; $i++) {
223
+			$original[$i] = array(
224
+				'length' => $this->_readInt($be),
225
+				'offset' => $this->_readInt($be)
226
+			);
227
+		}
228
+
229
+		// move to msgstr hash table
230
+		fseek($this->_handle, $offset_translat);
231
+		// read lengths and offsets of msgstrs
232
+		$translat = array();
233
+		for ($i = 0; $i < $count; $i++) {
234
+			$translat[$i] = array(
235
+				'length' => $this->_readInt($be),
236
+				'offset' => $this->_readInt($be)
237
+			);
238
+		}
239
+
240
+		// read all
241
+		for ($i = 0; $i < $count; $i++) {
242
+			$this->strings[$this->_readStr($original[$i])] =
243
+				$this->_readStr($translat[$i]);
244
+		}
245
+
246
+		// done
247
+		@flock($this->_handle, LOCK_UN);
248
+		@fclose($this->_handle);
249
+		$this->_handle = null;
250
+
251
+		// check for meta info
252
+		if (isset($this->strings[''])) {
253
+			$this->meta = parent::meta2array($this->strings['']);
254
+			unset($this->strings['']);
255
+		}
256
+
257
+		return true;
258
+	}
259
+
260
+	/**
261
+	 * Save MO file
262
+	 *
263
+	 * @access  public
264
+	 * @return  mixed   Returns true on success or PEAR_Error on failure.
265
+	 * @param   string  $file
266
+	 */
267
+	function save($file = null)
268
+	{
269
+		if (!isset($file)) {
270
+			$file = $this->file;
271
+		}
272
+
273
+		// open MO file
274
+		if (!is_resource($this->_handle = @fopen($file, 'wb'))) {
275
+			return false;
276
+		}
277
+		// lock MO file exclusively
278
+		if (!@flock($this->_handle, LOCK_EX)) {
279
+			@fclose($this->_handle);
280
+			return false;
281
+		}
282
+
283
+		// write magic number
284
+		if ($this->writeBigEndian) {
285
+			$this->_write(pack('c*', 0x95, 0x04, 0x12, 0xde));
286
+		} else {
287
+			$this->_write(pack('c*', 0xde, 0x12, 0x04, 0x95));
288
+		}
289
+
290
+		// write file format revision
291
+		$this->_writeInt(0);
292
+
293
+		$count = count($this->strings) + ($meta = (count($this->meta) ? 1 : 0));
294
+		// write count of strings
295
+		$this->_writeInt($count);
296
+
297
+		$offset = 28;
298
+		// write offset of orig. strings hash table
299
+		$this->_writeInt($offset);
300
+
301
+		$offset += ($count * 8);
302
+		// write offset transl. strings hash table
303
+		$this->_writeInt($offset);
304
+
305
+		// write size of hash table (we currently ommit the hash table)
306
+		$this->_writeInt(0);
307
+
308
+		$offset += ($count * 8);
309
+		// write offset of hash table
310
+		$this->_writeInt($offset);
311
+
312
+		// unshift meta info
313
+		if ($this->meta) {
314
+			$meta = '';
315
+			foreach ($this->meta as $key => $val) {
316
+				$meta .= $key . ': ' . $val . "\n";
317
+			}
318
+			$strings = array('' => $meta) + $this->strings;
319
+		} else {
320
+			$strings = $this->strings;
321
+		}
322
+
323
+		// write offsets for original strings
324
+		foreach (array_keys($strings) as $o) {
325
+			$len = strlen($o);
326
+			$this->_writeInt($len);
327
+			$this->_writeInt($offset);
328
+			$offset += $len + 1;
329
+		}
330
+
331
+		// write offsets for translated strings
332
+		foreach ($strings as $t) {
333
+			$len = strlen($t);
334
+			$this->_writeInt($len);
335
+			$this->_writeInt($offset);
336
+			$offset += $len + 1;
337
+		}
338
+
339
+		// write original strings
340
+		foreach (array_keys($strings) as $o) {
341
+			$this->_writeStr($o);
342
+		}
343
+
344
+		// write translated strings
345
+		foreach ($strings as $t) {
346
+			$this->_writeStr($t);
347
+		}
348
+
349
+		// done
350
+		@flock($this->_handle, LOCK_UN);
351
+		@fclose($this->_handle);
352
+		chmod($file,PRADO_CHMOD);
353
+		return true;
354
+	}
355 355
 }
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      * @access  private
59 59
      * @var     resource
60 60
      */
61
-    protected $_handle = null;
61
+    protected $_handle=null;
62 62
 
63 63
     /**
64 64
      * big endianess
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
      * @access  public
69 69
      * @var     bool
70 70
      */
71
-    protected $writeBigEndian = false;
71
+    protected $writeBigEndian=false;
72 72
 
73 73
     /**
74 74
      * Constructor
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
      * @return  object      File_Gettext_MO
78 78
      * @param   string      $file   path to GNU MO file
79 79
      */
80
-    function __construct($file = '')
80
+    function __construct($file='')
81 81
     {
82
-        $this->file = $file;
82
+        $this->file=$file;
83 83
     }
84 84
 
85 85
     /**
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
      * @return  mixed
90 90
      * @param   int     $bytes
91 91
      */
92
-    function _read($bytes = 1)
92
+    function _read($bytes=1)
93 93
     {
94
-        if (0 < $bytes = abs($bytes)) {
94
+        if(0 < $bytes=abs($bytes)) {
95 95
             return fread($this->_handle, $bytes);
96 96
         }
97 97
         return null;
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
      * @return  int
105 105
      * @param   bool    $bigendian
106 106
      */
107
-    function _readInt($bigendian = false)
107
+    function _readInt($bigendian=false)
108 108
     {
109 109
 		//unpack returns a reference????
110
-		$unpacked = unpack($bigendian ? 'N' : 'V', $this->_read(4));
110
+		$unpacked=unpack($bigendian ? 'N' : 'V', $this->_read(4));
111 111
         return array_shift($unpacked);
112 112
     }
113 113
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
      */
145 145
     function _writeStr($string)
146 146
     {
147
-        return $this->_write($string . "\0");
147
+        return $this->_write($string."\0");
148 148
     }
149 149
 
150 150
     /**
@@ -168,18 +168,18 @@  discard block
 block discarded – undo
168 168
      * @return   mixed   Returns true on success or PEAR_Error on failure.
169 169
      * @param    string  $file
170 170
      */
171
-    function load($file = null)
171
+    function load($file=null)
172 172
     {
173
-        if (!isset($file)) {
174
-            $file = $this->file;
173
+        if(!isset($file)) {
174
+            $file=$this->file;
175 175
         }
176 176
 
177 177
         // open MO file
178
-        if (!is_resource($this->_handle = @fopen($file, 'rb'))) {
178
+        if(!is_resource($this->_handle=@fopen($file, 'rb'))) {
179 179
             return false;
180 180
         }
181 181
         // lock MO file shared
182
-        if (!@flock($this->_handle, LOCK_SH)) {
182
+        if(!@flock($this->_handle, LOCK_SH)) {
183 183
             @fclose($this->_handle);
184 184
             return false;
185 185
         }
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
         // read (part of) magic number from MO file header and define endianess
188 188
 
189 189
 		//unpack returns a reference????
190
-		$unpacked = unpack('c', $this->_read(4));
191
-        switch ($magic = array_shift($unpacked))
190
+		$unpacked=unpack('c', $this->_read(4));
191
+        switch($magic=array_shift($unpacked))
192 192
         {
193 193
             case -34:
194
-                $be = false;
194
+                $be=false;
195 195
             break;
196 196
 
197 197
             case -107:
198
-                $be = true;
198
+                $be=true;
199 199
             break;
200 200
 
201 201
             default:
@@ -203,24 +203,24 @@  discard block
 block discarded – undo
203 203
         }
204 204
 
205 205
         // check file format revision - we currently only support 0
206
-        if (0 !== ($_rev = $this->_readInt($be))) {
206
+        if(0!==($_rev=$this->_readInt($be))) {
207 207
             return false;
208 208
         }
209 209
 
210 210
         // count of strings in this file
211
-        $count = $this->_readInt($be);
211
+        $count=$this->_readInt($be);
212 212
 
213 213
         // offset of hashing table of the msgids
214
-        $offset_original = $this->_readInt($be);
214
+        $offset_original=$this->_readInt($be);
215 215
         // offset of hashing table of the msgstrs
216
-        $offset_translat = $this->_readInt($be);
216
+        $offset_translat=$this->_readInt($be);
217 217
 
218 218
         // move to msgid hash table
219 219
         fseek($this->_handle, $offset_original);
220 220
         // read lengths and offsets of msgids
221
-        $original = array();
222
-        for ($i = 0; $i < $count; $i++) {
223
-            $original[$i] = array(
221
+        $original=array();
222
+        for($i=0; $i < $count; $i++) {
223
+            $original[$i]=array(
224 224
                 'length' => $this->_readInt($be),
225 225
                 'offset' => $this->_readInt($be)
226 226
             );
@@ -229,28 +229,28 @@  discard block
 block discarded – undo
229 229
         // move to msgstr hash table
230 230
         fseek($this->_handle, $offset_translat);
231 231
         // read lengths and offsets of msgstrs
232
-        $translat = array();
233
-        for ($i = 0; $i < $count; $i++) {
234
-            $translat[$i] = array(
232
+        $translat=array();
233
+        for($i=0; $i < $count; $i++) {
234
+            $translat[$i]=array(
235 235
                 'length' => $this->_readInt($be),
236 236
                 'offset' => $this->_readInt($be)
237 237
             );
238 238
         }
239 239
 
240 240
         // read all
241
-        for ($i = 0; $i < $count; $i++) {
242
-            $this->strings[$this->_readStr($original[$i])] =
241
+        for($i=0; $i < $count; $i++) {
242
+            $this->strings[$this->_readStr($original[$i])]=
243 243
                 $this->_readStr($translat[$i]);
244 244
         }
245 245
 
246 246
         // done
247 247
         @flock($this->_handle, LOCK_UN);
248 248
         @fclose($this->_handle);
249
-        $this->_handle = null;
249
+        $this->_handle=null;
250 250
 
251 251
         // check for meta info
252
-        if (isset($this->strings[''])) {
253
-            $this->meta = parent::meta2array($this->strings['']);
252
+        if(isset($this->strings[''])) {
253
+            $this->meta=parent::meta2array($this->strings['']);
254 254
             unset($this->strings['']);
255 255
         }
256 256
 
@@ -264,24 +264,24 @@  discard block
 block discarded – undo
264 264
      * @return  mixed   Returns true on success or PEAR_Error on failure.
265 265
      * @param   string  $file
266 266
      */
267
-    function save($file = null)
267
+    function save($file=null)
268 268
     {
269
-        if (!isset($file)) {
270
-            $file = $this->file;
269
+        if(!isset($file)) {
270
+            $file=$this->file;
271 271
         }
272 272
 
273 273
         // open MO file
274
-        if (!is_resource($this->_handle = @fopen($file, 'wb'))) {
274
+        if(!is_resource($this->_handle=@fopen($file, 'wb'))) {
275 275
             return false;
276 276
         }
277 277
         // lock MO file exclusively
278
-        if (!@flock($this->_handle, LOCK_EX)) {
278
+        if(!@flock($this->_handle, LOCK_EX)) {
279 279
             @fclose($this->_handle);
280 280
             return false;
281 281
         }
282 282
 
283 283
         // write magic number
284
-        if ($this->writeBigEndian) {
284
+        if($this->writeBigEndian) {
285 285
             $this->_write(pack('c*', 0x95, 0x04, 0x12, 0xde));
286 286
         } else {
287 287
             $this->_write(pack('c*', 0xde, 0x12, 0x04, 0x95));
@@ -290,66 +290,66 @@  discard block
 block discarded – undo
290 290
         // write file format revision
291 291
         $this->_writeInt(0);
292 292
 
293
-        $count = count($this->strings) + ($meta = (count($this->meta) ? 1 : 0));
293
+        $count=count($this->strings) + ($meta=(count($this->meta) ? 1 : 0));
294 294
         // write count of strings
295 295
         $this->_writeInt($count);
296 296
 
297
-        $offset = 28;
297
+        $offset=28;
298 298
         // write offset of orig. strings hash table
299 299
         $this->_writeInt($offset);
300 300
 
301
-        $offset += ($count * 8);
301
+        $offset+=($count * 8);
302 302
         // write offset transl. strings hash table
303 303
         $this->_writeInt($offset);
304 304
 
305 305
         // write size of hash table (we currently ommit the hash table)
306 306
         $this->_writeInt(0);
307 307
 
308
-        $offset += ($count * 8);
308
+        $offset+=($count * 8);
309 309
         // write offset of hash table
310 310
         $this->_writeInt($offset);
311 311
 
312 312
         // unshift meta info
313
-        if ($this->meta) {
314
-            $meta = '';
315
-            foreach ($this->meta as $key => $val) {
316
-                $meta .= $key . ': ' . $val . "\n";
313
+        if($this->meta) {
314
+            $meta='';
315
+            foreach($this->meta as $key => $val) {
316
+                $meta.=$key.': '.$val."\n";
317 317
             }
318
-            $strings = array('' => $meta) + $this->strings;
318
+            $strings=array('' => $meta) + $this->strings;
319 319
         } else {
320
-            $strings = $this->strings;
320
+            $strings=$this->strings;
321 321
         }
322 322
 
323 323
         // write offsets for original strings
324
-        foreach (array_keys($strings) as $o) {
325
-            $len = strlen($o);
324
+        foreach(array_keys($strings) as $o) {
325
+            $len=strlen($o);
326 326
             $this->_writeInt($len);
327 327
             $this->_writeInt($offset);
328
-            $offset += $len + 1;
328
+            $offset+=$len + 1;
329 329
         }
330 330
 
331 331
         // write offsets for translated strings
332
-        foreach ($strings as $t) {
333
-            $len = strlen($t);
332
+        foreach($strings as $t) {
333
+            $len=strlen($t);
334 334
             $this->_writeInt($len);
335 335
             $this->_writeInt($offset);
336
-            $offset += $len + 1;
336
+            $offset+=$len + 1;
337 337
         }
338 338
 
339 339
         // write original strings
340
-        foreach (array_keys($strings) as $o) {
340
+        foreach(array_keys($strings) as $o) {
341 341
             $this->_writeStr($o);
342 342
         }
343 343
 
344 344
         // write translated strings
345
-        foreach ($strings as $t) {
345
+        foreach($strings as $t) {
346 346
             $this->_writeStr($t);
347 347
         }
348 348
 
349 349
         // done
350 350
         @flock($this->_handle, LOCK_UN);
351 351
         @fclose($this->_handle);
352
-        chmod($file,PRADO_CHMOD);
352
+        chmod($file, PRADO_CHMOD);
353 353
         return true;
354 354
     }
355 355
 }
Please login to merge, or discard this patch.
framework/I18N/core/Gettext/TGettext_PO.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      * Load PO file
68 68
      *
69 69
      * @access  public
70
-     * @return  mixed   Returns true on success or PEAR_Error on failure.
70
+     * @return  boolean   Returns true on success or PEAR_Error on failure.
71 71
      * @param   string  $file
72 72
      */
73 73
     function load($file = null)
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      * Save PO file
117 117
      *
118 118
      * @access  public
119
-     * @return  mixed   Returns true on success or PEAR_Error on failure.
119
+     * @return  boolean   Returns true on success or PEAR_Error on failure.
120 120
      * @param   string  $file
121 121
      */
122 122
     function save($file = null)
Please login to merge, or discard this patch.
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -51,110 +51,110 @@
 block discarded – undo
51 51
  */
52 52
 class TGettext_PO extends TGettext
53 53
 {
54
-    /**
55
-     * Constructor
56
-     *
57
-     * @access  public
58
-     * @return  object      File_Gettext_PO
59
-     * @param   string      path to GNU PO file
60
-     */
61
-    function __construct($file = '')
62
-    {
63
-        $this->file = $file;
64
-    }
65
-
66
-    /**
67
-     * Load PO file
68
-     *
69
-     * @access  public
70
-     * @return  mixed   Returns true on success or PEAR_Error on failure.
71
-     * @param   string  $file
72
-     */
73
-    function load($file = null)
74
-    {
75
-        if (!isset($file)) {
76
-            $file = $this->file;
77
-        }
78
-
79
-        // load file
80
-        if (!$contents = @file($file)) {
81
-            return false;
82
-        }
83
-        $contents = implode('', $contents);
84
-
85
-        // match all msgid/msgstr entries
86
-        $matched = preg_match_all(
87
-            '/(msgid\s+("([^"]|\\\\")*?"\s*)+)\s+' .
88
-            '(msgstr\s+("([^"]|\\\\")*?"\s*)+)/',
89
-            $contents, $matches
90
-        );
91
-        unset($contents);
92
-
93
-        if (!$matched) {
94
-            return false;
95
-        }
96
-
97
-        // get all msgids and msgtrs
98
-        for ($i = 0; $i < $matched; $i++) {
99
-            $msgid = preg_replace(
100
-                '/\s*msgid\s*"(.*)"\s*/s', '\\1', $matches[1][$i]);
101
-            $msgstr= preg_replace(
102
-                '/\s*msgstr\s*"(.*)"\s*/s', '\\1', $matches[4][$i]);
103
-            $this->strings[parent::prepare($msgid)] = parent::prepare($msgstr);
104
-        }
105
-
106
-        // check for meta info
107
-        if (isset($this->strings[''])) {
108
-            $this->meta = parent::meta2array($this->strings['']);
109
-            unset($this->strings['']);
110
-        }
111
-
112
-        return true;
113
-    }
114
-
115
-    /**
116
-     * Save PO file
117
-     *
118
-     * @access  public
119
-     * @return  mixed   Returns true on success or PEAR_Error on failure.
120
-     * @param   string  $file
121
-     */
122
-    function save($file = null)
123
-    {
124
-        if (!isset($file)) {
125
-            $file = $this->file;
126
-        }
127
-
128
-        // open PO file
129
-        if (!is_resource($fh = @fopen($file, 'w'))) {
130
-            return false;
131
-        }
132
-
133
-        // lock PO file exclusively
134
-        if (!flock($fh, LOCK_EX)) {
135
-            fclose($fh);
136
-            return false;
137
-        }
138
-        // write meta info
139
-        if (count($this->meta)) {
140
-            $meta = 'msgid ""' . "\nmsgstr " . '""' . "\n";
141
-            foreach ($this->meta as $k => $v) {
142
-                $meta .= '"' . $k . ': ' . $v . '\n"' . "\n";
143
-            }
144
-            fwrite($fh, $meta . "\n");
145
-        }
146
-        // write strings
147
-        foreach ($this->strings as $o => $t) {
148
-            fwrite($fh,
149
-                'msgid "'  . parent::prepare($o, true) . '"' . "\n" .
150
-                'msgstr "' . parent::prepare($t, true) . '"' . "\n\n"
151
-            );
152
-        }
153
-
154
-        //done
155
-        @flock($fh, LOCK_UN);
156
-        @fclose($fh);
157
-        chmod($file,PRADO_CHMOD);
158
-        return true;
159
-    }
54
+	/**
55
+	 * Constructor
56
+	 *
57
+	 * @access  public
58
+	 * @return  object      File_Gettext_PO
59
+	 * @param   string      path to GNU PO file
60
+	 */
61
+	function __construct($file = '')
62
+	{
63
+		$this->file = $file;
64
+	}
65
+
66
+	/**
67
+	 * Load PO file
68
+	 *
69
+	 * @access  public
70
+	 * @return  mixed   Returns true on success or PEAR_Error on failure.
71
+	 * @param   string  $file
72
+	 */
73
+	function load($file = null)
74
+	{
75
+		if (!isset($file)) {
76
+			$file = $this->file;
77
+		}
78
+
79
+		// load file
80
+		if (!$contents = @file($file)) {
81
+			return false;
82
+		}
83
+		$contents = implode('', $contents);
84
+
85
+		// match all msgid/msgstr entries
86
+		$matched = preg_match_all(
87
+			'/(msgid\s+("([^"]|\\\\")*?"\s*)+)\s+' .
88
+			'(msgstr\s+("([^"]|\\\\")*?"\s*)+)/',
89
+			$contents, $matches
90
+		);
91
+		unset($contents);
92
+
93
+		if (!$matched) {
94
+			return false;
95
+		}
96
+
97
+		// get all msgids and msgtrs
98
+		for ($i = 0; $i < $matched; $i++) {
99
+			$msgid = preg_replace(
100
+				'/\s*msgid\s*"(.*)"\s*/s', '\\1', $matches[1][$i]);
101
+			$msgstr= preg_replace(
102
+				'/\s*msgstr\s*"(.*)"\s*/s', '\\1', $matches[4][$i]);
103
+			$this->strings[parent::prepare($msgid)] = parent::prepare($msgstr);
104
+		}
105
+
106
+		// check for meta info
107
+		if (isset($this->strings[''])) {
108
+			$this->meta = parent::meta2array($this->strings['']);
109
+			unset($this->strings['']);
110
+		}
111
+
112
+		return true;
113
+	}
114
+
115
+	/**
116
+	 * Save PO file
117
+	 *
118
+	 * @access  public
119
+	 * @return  mixed   Returns true on success or PEAR_Error on failure.
120
+	 * @param   string  $file
121
+	 */
122
+	function save($file = null)
123
+	{
124
+		if (!isset($file)) {
125
+			$file = $this->file;
126
+		}
127
+
128
+		// open PO file
129
+		if (!is_resource($fh = @fopen($file, 'w'))) {
130
+			return false;
131
+		}
132
+
133
+		// lock PO file exclusively
134
+		if (!flock($fh, LOCK_EX)) {
135
+			fclose($fh);
136
+			return false;
137
+		}
138
+		// write meta info
139
+		if (count($this->meta)) {
140
+			$meta = 'msgid ""' . "\nmsgstr " . '""' . "\n";
141
+			foreach ($this->meta as $k => $v) {
142
+				$meta .= '"' . $k . ': ' . $v . '\n"' . "\n";
143
+			}
144
+			fwrite($fh, $meta . "\n");
145
+		}
146
+		// write strings
147
+		foreach ($this->strings as $o => $t) {
148
+			fwrite($fh,
149
+				'msgid "'  . parent::prepare($o, true) . '"' . "\n" .
150
+				'msgstr "' . parent::prepare($t, true) . '"' . "\n\n"
151
+			);
152
+		}
153
+
154
+		//done
155
+		@flock($fh, LOCK_UN);
156
+		@fclose($fh);
157
+		chmod($file,PRADO_CHMOD);
158
+		return true;
159
+	}
160 160
 }
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
      * @return  object      File_Gettext_PO
59 59
      * @param   string      path to GNU PO file
60 60
      */
61
-    function __construct($file = '')
61
+    function __construct($file='')
62 62
     {
63
-        $this->file = $file;
63
+        $this->file=$file;
64 64
     }
65 65
 
66 66
     /**
@@ -70,42 +70,42 @@  discard block
 block discarded – undo
70 70
      * @return  mixed   Returns true on success or PEAR_Error on failure.
71 71
      * @param   string  $file
72 72
      */
73
-    function load($file = null)
73
+    function load($file=null)
74 74
     {
75
-        if (!isset($file)) {
76
-            $file = $this->file;
75
+        if(!isset($file)) {
76
+            $file=$this->file;
77 77
         }
78 78
 
79 79
         // load file
80
-        if (!$contents = @file($file)) {
80
+        if(!$contents=@file($file)) {
81 81
             return false;
82 82
         }
83
-        $contents = implode('', $contents);
83
+        $contents=implode('', $contents);
84 84
 
85 85
         // match all msgid/msgstr entries
86
-        $matched = preg_match_all(
87
-            '/(msgid\s+("([^"]|\\\\")*?"\s*)+)\s+' .
86
+        $matched=preg_match_all(
87
+            '/(msgid\s+("([^"]|\\\\")*?"\s*)+)\s+'.
88 88
             '(msgstr\s+("([^"]|\\\\")*?"\s*)+)/',
89 89
             $contents, $matches
90 90
         );
91 91
         unset($contents);
92 92
 
93
-        if (!$matched) {
93
+        if(!$matched) {
94 94
             return false;
95 95
         }
96 96
 
97 97
         // get all msgids and msgtrs
98
-        for ($i = 0; $i < $matched; $i++) {
99
-            $msgid = preg_replace(
98
+        for($i=0; $i < $matched; $i++) {
99
+            $msgid=preg_replace(
100 100
                 '/\s*msgid\s*"(.*)"\s*/s', '\\1', $matches[1][$i]);
101
-            $msgstr= preg_replace(
101
+            $msgstr=preg_replace(
102 102
                 '/\s*msgstr\s*"(.*)"\s*/s', '\\1', $matches[4][$i]);
103
-            $this->strings[parent::prepare($msgid)] = parent::prepare($msgstr);
103
+            $this->strings[parent::prepare($msgid)]=parent::prepare($msgstr);
104 104
         }
105 105
 
106 106
         // check for meta info
107
-        if (isset($this->strings[''])) {
108
-            $this->meta = parent::meta2array($this->strings['']);
107
+        if(isset($this->strings[''])) {
108
+            $this->meta=parent::meta2array($this->strings['']);
109 109
             unset($this->strings['']);
110 110
         }
111 111
 
@@ -119,42 +119,42 @@  discard block
 block discarded – undo
119 119
      * @return  mixed   Returns true on success or PEAR_Error on failure.
120 120
      * @param   string  $file
121 121
      */
122
-    function save($file = null)
122
+    function save($file=null)
123 123
     {
124
-        if (!isset($file)) {
125
-            $file = $this->file;
124
+        if(!isset($file)) {
125
+            $file=$this->file;
126 126
         }
127 127
 
128 128
         // open PO file
129
-        if (!is_resource($fh = @fopen($file, 'w'))) {
129
+        if(!is_resource($fh=@fopen($file, 'w'))) {
130 130
             return false;
131 131
         }
132 132
 
133 133
         // lock PO file exclusively
134
-        if (!flock($fh, LOCK_EX)) {
134
+        if(!flock($fh, LOCK_EX)) {
135 135
             fclose($fh);
136 136
             return false;
137 137
         }
138 138
         // write meta info
139
-        if (count($this->meta)) {
140
-            $meta = 'msgid ""' . "\nmsgstr " . '""' . "\n";
141
-            foreach ($this->meta as $k => $v) {
142
-                $meta .= '"' . $k . ': ' . $v . '\n"' . "\n";
139
+        if(count($this->meta)) {
140
+            $meta='msgid ""'."\nmsgstr ".'""'."\n";
141
+            foreach($this->meta as $k => $v) {
142
+                $meta.='"'.$k.': '.$v.'\n"'."\n";
143 143
             }
144
-            fwrite($fh, $meta . "\n");
144
+            fwrite($fh, $meta."\n");
145 145
         }
146 146
         // write strings
147
-        foreach ($this->strings as $o => $t) {
147
+        foreach($this->strings as $o => $t) {
148 148
             fwrite($fh,
149
-                'msgid "'  . parent::prepare($o, true) . '"' . "\n" .
150
-                'msgstr "' . parent::prepare($t, true) . '"' . "\n\n"
149
+                'msgid "'.parent::prepare($o, true).'"'."\n".
150
+                'msgstr "'.parent::prepare($t, true).'"'."\n\n"
151 151
             );
152 152
         }
153 153
 
154 154
         //done
155 155
         @flock($fh, LOCK_UN);
156 156
         @fclose($fh);
157
-        chmod($file,PRADO_CHMOD);
157
+        chmod($file, PRADO_CHMOD);
158 158
         return true;
159 159
     }
160 160
 }
Please login to merge, or discard this patch.