Completed
Push — php-cs-fixer ( b6f93e...b9836a )
by Fabio
07:15
created
framework/I18N/core/CultureInfo.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -204,6 +204,7 @@  discard block
 block discarded – undo
204 204
 
205 205
 	/**
206 206
 	 * Gets the CultureInfo that for this culture string
207
+	 * @param string $culture
207 208
 	 * @return CultureInfo invariant culture info is "en".
208 209
 	 */
209 210
 	public static function getInstance($culture)
@@ -232,6 +233,7 @@  discard block
 block discarded – undo
232 233
 	 * Set the culture for the current instance. The culture indentifier
233 234
 	 * must be of the form "<language>_(country/region)".
234 235
 	 * @param string culture identifier, e.g. "fr_FR_EURO".
236
+	 * @param string $culture
235 237
 	 */
236 238
 	protected function setCulture($culture)
237 239
 	{
@@ -247,6 +249,7 @@  discard block
 block discarded – undo
247 249
 	/**
248 250
 	 * Load the ICU culture data for the specific culture identifier.
249 251
 	 * @param string the culture identifier.
252
+	 * @param string $culture
250 253
 	 */
251 254
 	protected function loadCultureData($culture)
252 255
 	{
@@ -287,6 +290,7 @@  discard block
 block discarded – undo
287 290
 	 * The data files are cached in a static variable inside
288 291
 	 * this function.
289 292
 	 * @param string the ICU data filename
293
+	 * @param string $filename
290 294
 	 * @return array ICU data
291 295
 	 */
292 296
 	protected function &getData($filename)
@@ -390,6 +394,7 @@  discard block
 block discarded – undo
390 394
 	/**
391 395
 	 * Set the date time format information.
392 396
 	 * @param DateTimeFormatInfo the new date time format info.
397
+	 * @param DateTimeFormatInfo $dateTimeFormat
393 398
 	 */
394 399
 	public function setDateTimeFormat($dateTimeFormat)
395 400
 	{
@@ -497,6 +502,7 @@  discard block
 block discarded – undo
497 502
 	/**
498 503
 	 * Set the number format information.
499 504
 	 * @param NumberFormatInfo the new number format info.
505
+	 * @param NumberFormatInfo $numberFormat
500 506
 	 */
501 507
 	public function setNumberFormat($numberFormat)
502 508
 	{
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
 	 * ICU data filename extension.
56 56
 	 * @var string
57 57
 	 */
58
-	private $dataFileExt = '.dat';
58
+	private $dataFileExt='.dat';
59 59
 
60 60
 	/**
61 61
 	 * The ICU data array.
62 62
 	 * @var array
63 63
 	 */
64
-	private $data = [];
64
+	private $data=[];
65 65
 
66 66
 	/**
67 67
 	 * The current culture.
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * A list of ICU date files loaded.
80 80
 	 * @var array
81 81
 	 */
82
-	private $dataFiles = [];
82
+	private $dataFiles=[];
83 83
 
84 84
 	/**
85 85
 	 * The current date time format info.
@@ -97,28 +97,28 @@  discard block
 block discarded – undo
97 97
 	 * A list of properties that are accessable/writable.
98 98
 	 * @var array
99 99
 	 */
100
-	protected $properties = [];
100
+	protected $properties=[];
101 101
 
102 102
 	/**
103 103
 	 * Culture type, all.
104 104
 	 * @see getCultures()
105 105
 	 * @var int
106 106
 	 */
107
-	const ALL = 0;
107
+	const ALL=0;
108 108
 
109 109
 	/**
110 110
 	 * Culture type, neutral.
111 111
 	 * @see getCultures()
112 112
 	 * @var int
113 113
 	 */
114
-	const NEUTRAL = 1;
114
+	const NEUTRAL=1;
115 115
 
116 116
 	/**
117 117
 	 * Culture type, specific.
118 118
 	 * @see getCultures()
119 119
 	 * @var int
120 120
 	 */
121
-	const SPECIFIC = 2;
121
+	const SPECIFIC=2;
122 122
 
123 123
 	/**
124 124
 	 * Display the culture name.
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function __get($name)
140 140
 	{
141
-		$getProperty = 'get' . $name;
141
+		$getProperty='get'.$name;
142 142
 		if(in_array($getProperty, $this->properties))
143 143
 			return $this->$getProperty();
144 144
 		else
145
-			throw new Exception('Property ' . $name . ' does not exists.');
145
+			throw new Exception('Property '.$name.' does not exists.');
146 146
 	}
147 147
 
148 148
 	/**
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function __set($name, $value)
153 153
 	{
154
-		$setProperty = 'set' . $name;
154
+		$setProperty='set'.$name;
155 155
 		if(in_array($setProperty, $this->properties))
156 156
 			$this->$setProperty($value);
157 157
 		else
158
-			throw new Exception('Property ' . $name . ' can not be set.');
158
+			throw new Exception('Property '.$name.' can not be set.');
159 159
 	}
160 160
 
161 161
 
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
 	 * @param string a culture name, e.g. "en_AU".
168 168
 	 * @return return new CultureInfo.
169 169
 	 */
170
-	public function __construct($culture = 'en')
170
+	public function __construct($culture='en')
171 171
 	{
172
-		$this->properties = get_class_methods($this);
172
+		$this->properties=get_class_methods($this);
173 173
 
174 174
 		if(empty($culture))
175
-			$culture = 'en';
175
+			$culture='en';
176 176
 
177
-		$this->dataDir = $this->dataDir();
178
-		$this->dataFileExt = $this->fileExt();
177
+		$this->dataDir=$this->dataDir();
178
+		$this->dataFileExt=$this->fileExt();
179 179
 
180 180
 		$this->setCulture($culture);
181 181
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	protected static function dataDir()
192 192
 	{
193
-		return dirname(__FILE__) . '/data/';
193
+		return dirname(__FILE__).'/data/';
194 194
 	}
195 195
 
196 196
 	/**
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public static function getInstance($culture)
210 210
 	{
211
-		static $instances = [];
211
+		static $instances=[];
212 212
 		if(!isset($instances[$culture]))
213
-			$instances[$culture] = new CultureInfo($culture);
213
+			$instances[$culture]=new CultureInfo($culture);
214 214
 		return $instances[$culture];
215 215
 	}
216 216
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	public static function validCulture($culture)
224 224
 	{
225 225
 		if(preg_match('/^[_\\w]+$/', $culture))
226
-			return is_file(self::dataDir() . $culture . self::fileExt());
226
+			return is_file(self::dataDir().$culture.self::fileExt());
227 227
 
228 228
 		return false;
229 229
 	}
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
 	{
238 238
 		if(!empty($culture))
239 239
 		{
240
-			if (!preg_match('/^[_\\w]+$/', $culture))
241
-				throw new Exception('Invalid culture supplied: ' . $culture);
240
+			if(!preg_match('/^[_\\w]+$/', $culture))
241
+				throw new Exception('Invalid culture supplied: '.$culture);
242 242
 		}
243 243
 
244
-		$this->culture = $culture;
244
+		$this->culture=$culture;
245 245
 	}
246 246
 
247 247
 	/**
@@ -250,30 +250,30 @@  discard block
 block discarded – undo
250 250
 	 */
251 251
 	protected function loadCultureData($culture)
252 252
 	{
253
-		$file_parts = explode('_', $culture);
254
-		$current_part = $file_parts[0];
253
+		$file_parts=explode('_', $culture);
254
+		$current_part=$file_parts[0];
255 255
 
256
-		$files = [$current_part];
256
+		$files=[$current_part];
257 257
 
258
-		for($i = 1, $k = count($file_parts); $i < $k; ++$i)
258
+		for($i=1, $k=count($file_parts); $i < $k; ++$i)
259 259
 		{
260
-			$current_part .= '_' . $file_parts[$i];
261
-			$files[] = $current_part;
260
+			$current_part.='_'.$file_parts[$i];
261
+			$files[]=$current_part;
262 262
 		}
263 263
 
264 264
 		foreach($files as $file)
265 265
 		{
266
-			$filename = $this->dataDir . $file . $this->dataFileExt;
266
+			$filename=$this->dataDir.$file.$this->dataFileExt;
267 267
 
268
-			if(is_file($filename) == false)
269
-				throw new Exception('Data file for "' . $file . '" was not found.');
268
+			if(is_file($filename)==false)
269
+				throw new Exception('Data file for "'.$file.'" was not found.');
270 270
 
271
-			if(in_array($filename, $this->dataFiles) === false)
271
+			if(in_array($filename, $this->dataFiles)===false)
272 272
 			{
273 273
 				array_unshift($this->dataFiles, $file);
274 274
 
275
-				$data = &$this->getData($filename);
276
-				$this->data[$file] = &$data;
275
+				$data=&$this->getData($filename);
276
+				$this->data[$file]=&$data;
277 277
 
278 278
 				if(isset($data['__ALIAS']))
279 279
 					$this->loadCultureData($data['__ALIAS'][0]);
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
 	 */
292 292
 	protected function &getData($filename)
293 293
 	{
294
-		static $data = [];
295
-		static $files = [];
294
+		static $data=[];
295
+		static $files=[];
296 296
 
297 297
 		if(!in_array($filename, $files))
298 298
 		{
299
-			$data[$filename] = unserialize(file_get_contents($filename));
300
-			$files[] = $filename;
299
+			$data[$filename]=unserialize(file_get_contents($filename));
300
+			$files[]=$filename;
301 301
 		}
302 302
 
303 303
 		return $data[$filename];
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
 	 * @param boolean merge the data from its parents.
318 318
 	 * @return mixed the specific ICU data.
319 319
 	 */
320
-	protected function findInfo($path = '/', $merge = false)
320
+	protected function findInfo($path='/', $merge=false)
321 321
 	{
322
-		$result = [];
322
+		$result=[];
323 323
 		foreach($this->dataFiles as $section)
324 324
 		{
325
-			$info = $this->searchArray($this->data[$section], $path);
325
+			$info=$this->searchArray($this->data[$section], $path);
326 326
 
327 327
 			if($info)
328 328
 			{
329 329
 				if($merge)
330
-					$result = array_merge($info, $result);
330
+					$result=array_merge($info, $result);
331 331
 				else
332 332
 					return $info;
333 333
 			}
@@ -344,18 +344,18 @@  discard block
 block discarded – undo
344 344
 	 * @param string slash "/" separated array path.
345 345
 	 * @return mixed the value array using the path
346 346
 	 */
347
-	private function searchArray($info, $path = '/')
347
+	private function searchArray($info, $path='/')
348 348
 	{
349
-		$index = explode('/', $path);
349
+		$index=explode('/', $path);
350 350
 
351
-		$array = $info;
351
+		$array=$info;
352 352
 
353
-		for($i = 0, $k = count($index); $i < $k; ++$i)
353
+		for($i=0, $k=count($index); $i < $k; ++$i)
354 354
 		{
355
-			$value = $index[$i];
355
+			$value=$index[$i];
356 356
 			if($i < $k - 1 && isset($array[$value]))
357
-				$array = $array[$value];
358
-			elseif ($i == $k - 1 && isset($array[$value]))
357
+				$array=$array[$value];
358
+			elseif($i==$k - 1 && isset($array[$value]))
359 359
 				return $array[$value];
360 360
 		}
361 361
 	}
@@ -377,10 +377,10 @@  discard block
 block discarded – undo
377 377
 	 */
378 378
 	public function getDateTimeFormat()
379 379
 	{
380
-		if($this->dateTimeFormat === null)
380
+		if($this->dateTimeFormat===null)
381 381
 		{
382
-			$calendar = $this->getCalendar();
383
-			$info = $this->findInfo("calendar/{$calendar}", true);
382
+			$calendar=$this->getCalendar();
383
+			$info=$this->findInfo("calendar/{$calendar}", true);
384 384
 			$this->setDateTimeFormat(new DateTimeFormatInfo($info));
385 385
 		}
386 386
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 	 */
394 394
 	public function setDateTimeFormat($dateTimeFormat)
395 395
 	{
396
-		$this->dateTimeFormat = $dateTimeFormat;
396
+		$this->dateTimeFormat=$dateTimeFormat;
397 397
 	}
398 398
 
399 399
 	/**
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 */
403 403
 	public function getCalendar()
404 404
 	{
405
-		$info = $this->findInfo('calendar/default');
405
+		$info=$this->findInfo('calendar/default');
406 406
 		return $info[0];
407 407
 	}
408 408
 
@@ -414,12 +414,12 @@  discard block
 block discarded – undo
414 414
 	 */
415 415
 	public function getNativeName()
416 416
 	{
417
-		$lang = substr($this->culture, 0, 2);
418
-		$reg = substr($this->culture, 3, 2);
419
-		$language = $this->findInfo("Languages/{$lang}");
420
-		$region = $this->findInfo("Countries/{$reg}");
417
+		$lang=substr($this->culture, 0, 2);
418
+		$reg=substr($this->culture, 3, 2);
419
+		$language=$this->findInfo("Languages/{$lang}");
420
+		$region=$this->findInfo("Countries/{$reg}");
421 421
 		if($region)
422
-			return $language[0] . ' (' . $region[0] . ')';
422
+			return $language[0].' ('.$region[0].')';
423 423
 		else
424 424
 			return $language[0];
425 425
 	}
@@ -432,17 +432,17 @@  discard block
 block discarded – undo
432 432
 	 */
433 433
 	public function getEnglishName()
434 434
 	{
435
-		$lang = substr($this->culture, 0, 2);
436
-		$reg = substr($this->culture, 3, 2);
437
-		$culture = $this->getInvariantCulture();
435
+		$lang=substr($this->culture, 0, 2);
436
+		$reg=substr($this->culture, 3, 2);
437
+		$culture=$this->getInvariantCulture();
438 438
 
439
-		$language = $culture->findInfo("Languages/{$lang}");
440
-		if(count($language) == 0)
439
+		$language=$culture->findInfo("Languages/{$lang}");
440
+		if(count($language)==0)
441 441
 			return $this->culture;
442 442
 
443
-		$region = $culture->findInfo("Countries/{$reg}");
443
+		$region=$culture->findInfo("Countries/{$reg}");
444 444
 		if($region)
445
-			return $language[0] . ' (' . $region[0] . ')';
445
+			return $language[0].' ('.$region[0].')';
446 446
 		else
447 447
 			return $language[0];
448 448
 	}
@@ -457,8 +457,8 @@  discard block
 block discarded – undo
457 457
 	public static function getInvariantCulture()
458 458
 	{
459 459
 		static $invariant;
460
-		if($invariant === null)
461
-			$invariant = new CultureInfo();
460
+		if($invariant===null)
461
+			$invariant=new CultureInfo();
462 462
 		return $invariant;
463 463
 	}
464 464
 
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 	 */
471 471
 	public function getIsNeutralCulture()
472 472
 	{
473
-		return strlen($this->culture) == 2;
473
+		return strlen($this->culture)==2;
474 474
 	}
475 475
 
476 476
 	/**
@@ -480,12 +480,12 @@  discard block
 block discarded – undo
480 480
 	 */
481 481
 	public function getNumberFormat()
482 482
 	{
483
-		if($this->numberFormat === null)
483
+		if($this->numberFormat===null)
484 484
 		{
485
-			$elements = $this->findInfo('NumberElements');
486
-			$patterns = $this->findInfo('NumberPatterns');
487
-			$currencies = $this->getCurrencies();
488
-			$data = [	'NumberElements' => $elements,
485
+			$elements=$this->findInfo('NumberElements');
486
+			$patterns=$this->findInfo('NumberPatterns');
487
+			$currencies=$this->getCurrencies();
488
+			$data=['NumberElements' => $elements,
489 489
 							'NumberPatterns' => $patterns,
490 490
 							'Currencies' => $currencies];
491 491
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 	 */
501 501
 	public function setNumberFormat($numberFormat)
502 502
 	{
503
-		$this->numberFormat = $numberFormat;
503
+		$this->numberFormat=$numberFormat;
504 504
 	}
505 505
 
506 506
 	/**
@@ -510,10 +510,10 @@  discard block
 block discarded – undo
510 510
 	 */
511 511
 	public function getParent()
512 512
 	{
513
-		if(strlen($this->culture) == 2)
513
+		if(strlen($this->culture)==2)
514 514
 			return $this->getInvariantCulture();
515 515
 
516
-		$lang = substr($this->culture, 0, 2);
516
+		$lang=substr($this->culture, 0, 2);
517 517
 			return new CultureInfo($lang);
518 518
 	}
519 519
 
@@ -526,26 +526,26 @@  discard block
 block discarded – undo
526 526
 	 * or CultureInfo::SPECIFIC.
527 527
 	 * @return array list of culture information available.
528 528
 	 */
529
-	public static function getCultures($type = CultureInfo::ALL)
529
+	public static function getCultures($type=CultureInfo::ALL)
530 530
 	{
531
-		$dataDir = CultureInfo::dataDir();
532
-		$dataExt = CultureInfo::fileExt();
533
-		$dir = dir($dataDir);
531
+		$dataDir=CultureInfo::dataDir();
532
+		$dataExt=CultureInfo::fileExt();
533
+		$dir=dir($dataDir);
534 534
 
535
-		$neutral = [];
536
-		$specific = [];
535
+		$neutral=[];
536
+		$specific=[];
537 537
 
538
-		while (false !== ($entry = $dir->read()))
538
+		while(false!==($entry=$dir->read()))
539 539
 		{
540
-			if(is_file($dataDir . $entry)
541
-				&& substr($entry, -4) == $dataExt
542
-				&& $entry != 'root' . $dataExt)
540
+			if(is_file($dataDir.$entry)
541
+				&& substr($entry, -4)==$dataExt
542
+				&& $entry!='root'.$dataExt)
543 543
 			{
544
-				$culture = substr($entry, 0, -4);
545
-				if(strlen($culture) == 2)
546
-					$neutral[] = $culture;
544
+				$culture=substr($entry, 0, -4);
545
+				if(strlen($culture)==2)
546
+					$neutral[]=$culture;
547 547
 				else
548
-					$specific[] = $culture;
548
+					$specific[]=$culture;
549 549
 			}
550 550
 		}
551 551
 		$dir->close();
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 		switch($type)
554 554
 		{
555 555
 			case CultureInfo::ALL :
556
-				$all = array_merge($neutral, $specific);
556
+				$all=array_merge($neutral, $specific);
557 557
 				sort($all);
558 558
 				return $all;
559 559
 				break;
@@ -575,12 +575,12 @@  discard block
 block discarded – undo
575 575
 	 */
576 576
 	private function simplify($array)
577 577
 	{
578
-		for($i = 0, $k = count($array); $i < $k; ++$i)
578
+		for($i=0, $k=count($array); $i < $k; ++$i)
579 579
 		{
580
-			$key = key($array);
580
+			$key=key($array);
581 581
 			if(is_array($array[$key])
582
-				&& count($array[$key]) == 1)
583
-				$array[$key] = $array[$key][0];
582
+				&& count($array[$key])==1)
583
+				$array[$key]=$array[$key][0];
584 584
 			next($array);
585 585
 		}
586 586
 		return $array;
Please login to merge, or discard this patch.
framework/I18N/core/Gettext/TGettext.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 *
120 120
 	 * @static
121 121
 	 * @access  public
122
-	 * @return  mixed   Returns true on success or PEAR_Error on failure.
122
+	 * @return  boolean   Returns true on success or PEAR_Error on failure.
123 123
 	 * @param   string  $pofile path to GNU PO file
124 124
 	 * @param   string  $mofile path to GNU MO file
125 125
 	 */
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 * toMO
262 262
 	 *
263 263
 	 * @access  protected
264
-	 * @return  object  File_Gettext_MO
264
+	 * @return  TGettext_MO  File_Gettext_MO
265 265
 	 */
266 266
 	public function toMO()
267 267
 	{
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 * toPO
276 276
 	 *
277 277
 	 * @access  protected
278
-	 * @return  object      File_Gettext_PO
278
+	 * @return  TGettext_PO      File_Gettext_PO
279 279
 	 */
280 280
 	public function toPO()
281 281
 	{
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @access  protected
68 68
 	 * @var     array
69 69
 	 */
70
-	protected $strings = [];
70
+	protected $strings=[];
71 71
 
72 72
 	/**
73 73
 	 * meta
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @access  protected
79 79
 	 * @var     array
80 80
 	 */
81
-	protected $meta = [];
81
+	protected $meta=[];
82 82
 
83 83
 	/**
84 84
 	 * file path
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @access  protected
87 87
 	 * @var     string
88 88
 	 */
89
-	protected $file = '';
89
+	protected $file='';
90 90
 
91 91
 	/**
92 92
 	 * Factory
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 	 * @param   string  $format MO or PO
99 99
 	 * @param   string  $file   path to GNU gettext file
100 100
 	 */
101
-	public static function factory($format, $file = '')
101
+	public static function factory($format, $file='')
102 102
 	{
103
-		$format = strToUpper($format);
104
-		$filename = dirname(__FILE__) . '/' . $format . '.php';
105
-		if(is_file($filename) == false)
103
+		$format=strToUpper($format);
104
+		$filename=dirname(__FILE__).'/'.$format.'.php';
105
+		if(is_file($filename)==false)
106 106
 			throw new Exception("Class file $file not found");
107 107
 
108 108
 		include_once $filename;
109
-		$class = 'TGettext_' . $format;
109
+		$class='TGettext_'.$format;
110 110
 
111 111
 		return new $class($file);
112 112
 	}
@@ -125,19 +125,19 @@  discard block
 block discarded – undo
125 125
 	 */
126 126
 	public static function poFile2moFile($pofile, $mofile)
127 127
 	{
128
-		if (!is_file($pofile)) {
128
+		if(!is_file($pofile)) {
129 129
 			throw new Exception("File $pofile doesn't exist.");
130 130
 		}
131 131
 
132
-		include_once dirname(__FILE__) . '/PO.php';
132
+		include_once dirname(__FILE__).'/PO.php';
133 133
 
134
-		$PO = new TGettext_PO($pofile);
135
-		if (true !== ($e = $PO->load())) {
134
+		$PO=new TGettext_PO($pofile);
135
+		if(true!==($e=$PO->load())) {
136 136
 			return $e;
137 137
 		}
138 138
 
139
-		$MO = $PO->toMO();
140
-		if (true !== ($e = $MO->save($mofile))) {
139
+		$MO=$PO->toMO();
140
+		if(true!==($e=$MO->save($mofile))) {
141 141
 			return $e;
142 142
 		}
143 143
 		unset($PO, $MO);
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
 	 * @param   string  $string
155 155
 	 * @param   bool    $reverse
156 156
 	 */
157
-	public static function prepare($string, $reverse = false)
157
+	public static function prepare($string, $reverse=false)
158 158
 	{
159
-		if ($reverse) {
160
-			$smap = ['"', "\n", "\t", "\r"];
161
-			$rmap = ['\"', '\\n"' . "\n" . '"', '\\t', '\\r'];
159
+		if($reverse) {
160
+			$smap=['"', "\n", "\t", "\r"];
161
+			$rmap=['\"', '\\n"'."\n".'"', '\\t', '\\r'];
162 162
 			return (string) str_replace($smap, $rmap, $string);
163 163
 		} else {
164
-			$string = preg_replace('/"\s+"/', '', $string);
165
-			$smap = ['\\n', '\\r', '\\t', '\"'];
166
-			$rmap = ["\n", "\r", "\t", '"'];
164
+			$string=preg_replace('/"\s+"/', '', $string);
165
+			$smap=['\\n', '\\r', '\\t', '\"'];
166
+			$rmap=["\n", "\r", "\t", '"'];
167 167
 			return (string) str_replace($smap, $rmap, $string);
168 168
 		}
169 169
 	}
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public static function meta2array($meta)
180 180
 	{
181
-		$array = [];
182
-		foreach (explode("\n", $meta) as $info) {
183
-			if ($info = trim($info)) {
184
-				list($key, $value) = explode(':', $info, 2);
185
-				$array[trim($key)] = trim($value);
181
+		$array=[];
182
+		foreach(explode("\n", $meta) as $info) {
183
+			if($info=trim($info)) {
184
+				list($key, $value)=explode(':', $info, 2);
185
+				$array[trim($key)]=trim($value);
186 186
 			}
187 187
 		}
188 188
 		return $array;
@@ -244,15 +244,15 @@  discard block
 block discarded – undo
244 244
 	 */
245 245
 	public function fromArray($array)
246 246
 	{
247
-		if (!array_key_exists('strings', $array)) {
248
-			if (count($array) != 2) {
247
+		if(!array_key_exists('strings', $array)) {
248
+			if(count($array)!=2) {
249 249
 				return false;
250 250
 			} else {
251
-				list($this->meta, $this->strings) = $array;
251
+				list($this->meta, $this->strings)=$array;
252 252
 			}
253 253
 		} else {
254
-			$this->meta = @$array['meta'];
255
-			$this->strings = @$array['strings'];
254
+			$this->meta=@$array['meta'];
255
+			$this->strings=@$array['strings'];
256 256
 		}
257 257
 		return true;
258 258
 	}
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 	 */
266 266
 	public function toMO()
267 267
 	{
268
-		include_once dirname(__FILE__) . '/MO.php';
269
-		$MO = new TGettext_MO;
268
+		include_once dirname(__FILE__).'/MO.php';
269
+		$MO=new TGettext_MO;
270 270
 		$MO->fromArray($this->toArray());
271 271
 		return $MO;
272 272
 	}
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function toPO()
281 281
 	{
282
-		include_once dirname(__FILE__) . '/PO.php';
283
-		$PO = new TGettext_PO;
282
+		include_once dirname(__FILE__).'/PO.php';
283
+		$PO=new TGettext_PO;
284 284
 		$PO->fromArray($this->toArray());
285 285
 		return $PO;
286 286
 	}
Please login to merge, or discard this patch.
framework/I18N/core/Gettext/TGettext_MO.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 * _read
86 86
 	 *
87 87
 	 * @access  private
88
-	 * @return  mixed
88
+	 * @return  string|null
89 89
 	 * @param   int     $bytes
90 90
 	 */
91 91
 	public function _read($bytes = 1)
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 	 * Load MO file
165 165
 	 *
166 166
 	 * @access   public
167
-	 * @return   mixed   Returns true on success or PEAR_Error on failure.
167
+	 * @return   boolean   Returns true on success or PEAR_Error on failure.
168 168
 	 * @param    string  $file
169 169
 	 */
170 170
 	public function load($file = null)
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * Save MO file
261 261
 	 *
262 262
 	 * @access  public
263
-	 * @return  mixed   Returns true on success or PEAR_Error on failure.
263
+	 * @return  boolean   Returns true on success or PEAR_Error on failure.
264 264
 	 * @param   string  $file
265 265
 	 */
266 266
 	public function save($file = null)
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @license     PHP License
39 39
  */
40 40
 
41
-require_once dirname(__FILE__) . '/TGettext.php';
41
+require_once dirname(__FILE__).'/TGettext.php';
42 42
 
43 43
 /**
44 44
  * File_Gettext_MO
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @access  public
68 68
 	 * @var     bool
69 69
 	 */
70
-	protected $writeBigEndian = false;
70
+	protected $writeBigEndian=false;
71 71
 
72 72
 	/**
73 73
 	 * Constructor
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 	 * @return  object      File_Gettext_MO
77 77
 	 * @param   string      $file   path to GNU MO file
78 78
 	 */
79
-	public function __construct($file = '')
79
+	public function __construct($file='')
80 80
 	{
81
-		$this->file = $file;
81
+		$this->file=$file;
82 82
 	}
83 83
 
84 84
 	/**
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 	 * @return  mixed
89 89
 	 * @param   int     $bytes
90 90
 	 */
91
-	public function _read($bytes = 1)
91
+	public function _read($bytes=1)
92 92
 	{
93
-		if (0 < $bytes = abs($bytes)) {
93
+		if(0 < $bytes=abs($bytes)) {
94 94
 			return fread($this->_handle, $bytes);
95 95
 		}
96 96
 		return null;
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 	 * @return  int
104 104
 	 * @param   bool    $bigendian
105 105
 	 */
106
-	public function _readInt($bigendian = false)
106
+	public function _readInt($bigendian=false)
107 107
 	{
108 108
 		//unpack returns a reference????
109
-		$unpacked = unpack($bigendian ? 'N' : 'V', $this->_read(4));
109
+		$unpacked=unpack($bigendian ? 'N' : 'V', $this->_read(4));
110 110
 		return array_shift($unpacked);
111 111
 	}
112 112
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public function _writeStr($string)
145 145
 	{
146
-		return $this->_write($string . "\0");
146
+		return $this->_write($string."\0");
147 147
 	}
148 148
 
149 149
 	/**
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
 	 * @return   mixed   Returns true on success or PEAR_Error on failure.
168 168
 	 * @param    string  $file
169 169
 	 */
170
-	public function load($file = null)
170
+	public function load($file=null)
171 171
 	{
172
-		if (!isset($file)) {
173
-			$file = $this->file;
172
+		if(!isset($file)) {
173
+			$file=$this->file;
174 174
 		}
175 175
 
176 176
 		// open MO file
177
-		if (!is_resource($this->_handle = @fopen($file, 'rb'))) {
177
+		if(!is_resource($this->_handle=@fopen($file, 'rb'))) {
178 178
 			return false;
179 179
 		}
180 180
 		// lock MO file shared
181
-		if (!@flock($this->_handle, LOCK_SH)) {
181
+		if(!@flock($this->_handle, LOCK_SH)) {
182 182
 			@fclose($this->_handle);
183 183
 			return false;
184 184
 		}
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
 		// read (part of) magic number from MO file header and define endianess
187 187
 
188 188
 		//unpack returns a reference????
189
-		$unpacked = unpack('c', $this->_read(4));
190
-		switch ($magic = array_shift($unpacked))
189
+		$unpacked=unpack('c', $this->_read(4));
190
+		switch($magic=array_shift($unpacked))
191 191
 		{
192 192
 			case -34:
193
-				$be = false;
193
+				$be=false;
194 194
 			break;
195 195
 
196 196
 			case -107:
197
-				$be = true;
197
+				$be=true;
198 198
 			break;
199 199
 
200 200
 			default:
@@ -202,24 +202,24 @@  discard block
 block discarded – undo
202 202
 		}
203 203
 
204 204
 		// check file format revision - we currently only support 0
205
-		if (0 !== ($_rev = $this->_readInt($be))) {
205
+		if(0!==($_rev=$this->_readInt($be))) {
206 206
 			return false;
207 207
 		}
208 208
 
209 209
 		// count of strings in this file
210
-		$count = $this->_readInt($be);
210
+		$count=$this->_readInt($be);
211 211
 
212 212
 		// offset of hashing table of the msgids
213
-		$offset_original = $this->_readInt($be);
213
+		$offset_original=$this->_readInt($be);
214 214
 		// offset of hashing table of the msgstrs
215
-		$offset_translat = $this->_readInt($be);
215
+		$offset_translat=$this->_readInt($be);
216 216
 
217 217
 		// move to msgid hash table
218 218
 		fseek($this->_handle, $offset_original);
219 219
 		// read lengths and offsets of msgids
220
-		$original = [];
221
-		for ($i = 0; $i < $count; $i++) {
222
-			$original[$i] = [
220
+		$original=[];
221
+		for($i=0; $i < $count; $i++) {
222
+			$original[$i]=[
223 223
 				'length' => $this->_readInt($be),
224 224
 				'offset' => $this->_readInt($be)
225 225
 			];
@@ -228,28 +228,28 @@  discard block
 block discarded – undo
228 228
 		// move to msgstr hash table
229 229
 		fseek($this->_handle, $offset_translat);
230 230
 		// read lengths and offsets of msgstrs
231
-		$translat = [];
232
-		for ($i = 0; $i < $count; $i++) {
233
-			$translat[$i] = [
231
+		$translat=[];
232
+		for($i=0; $i < $count; $i++) {
233
+			$translat[$i]=[
234 234
 				'length' => $this->_readInt($be),
235 235
 				'offset' => $this->_readInt($be)
236 236
 			];
237 237
 		}
238 238
 
239 239
 		// read all
240
-		for ($i = 0; $i < $count; $i++) {
241
-			$this->strings[$this->_readStr($original[$i])] =
240
+		for($i=0; $i < $count; $i++) {
241
+			$this->strings[$this->_readStr($original[$i])]=
242 242
 				$this->_readStr($translat[$i]);
243 243
 		}
244 244
 
245 245
 		// done
246 246
 		@flock($this->_handle, LOCK_UN);
247 247
 		@fclose($this->_handle);
248
-		$this->_handle = null;
248
+		$this->_handle=null;
249 249
 
250 250
 		// check for meta info
251
-		if (isset($this->strings[''])) {
252
-			$this->meta = parent::meta2array($this->strings['']);
251
+		if(isset($this->strings[''])) {
252
+			$this->meta=parent::meta2array($this->strings['']);
253 253
 			unset($this->strings['']);
254 254
 		}
255 255
 
@@ -263,24 +263,24 @@  discard block
 block discarded – undo
263 263
 	 * @return  mixed   Returns true on success or PEAR_Error on failure.
264 264
 	 * @param   string  $file
265 265
 	 */
266
-	public function save($file = null)
266
+	public function save($file=null)
267 267
 	{
268
-		if (!isset($file)) {
269
-			$file = $this->file;
268
+		if(!isset($file)) {
269
+			$file=$this->file;
270 270
 		}
271 271
 
272 272
 		// open MO file
273
-		if (!is_resource($this->_handle = @fopen($file, 'wb'))) {
273
+		if(!is_resource($this->_handle=@fopen($file, 'wb'))) {
274 274
 			return false;
275 275
 		}
276 276
 		// lock MO file exclusively
277
-		if (!@flock($this->_handle, LOCK_EX)) {
277
+		if(!@flock($this->_handle, LOCK_EX)) {
278 278
 			@fclose($this->_handle);
279 279
 			return false;
280 280
 		}
281 281
 
282 282
 		// write magic number
283
-		if ($this->writeBigEndian) {
283
+		if($this->writeBigEndian) {
284 284
 			$this->_write(pack('c*', 0x95, 0x04, 0x12, 0xde));
285 285
 		} else {
286 286
 			$this->_write(pack('c*', 0xde, 0x12, 0x04, 0x95));
@@ -289,59 +289,59 @@  discard block
 block discarded – undo
289 289
 		// write file format revision
290 290
 		$this->_writeInt(0);
291 291
 
292
-		$count = count($this->strings) + ($meta = (count($this->meta) ? 1 : 0));
292
+		$count=count($this->strings) + ($meta=(count($this->meta) ? 1 : 0));
293 293
 		// write count of strings
294 294
 		$this->_writeInt($count);
295 295
 
296
-		$offset = 28;
296
+		$offset=28;
297 297
 		// write offset of orig. strings hash table
298 298
 		$this->_writeInt($offset);
299 299
 
300
-		$offset += ($count * 8);
300
+		$offset+=($count * 8);
301 301
 		// write offset transl. strings hash table
302 302
 		$this->_writeInt($offset);
303 303
 
304 304
 		// write size of hash table (we currently ommit the hash table)
305 305
 		$this->_writeInt(0);
306 306
 
307
-		$offset += ($count * 8);
307
+		$offset+=($count * 8);
308 308
 		// write offset of hash table
309 309
 		$this->_writeInt($offset);
310 310
 
311 311
 		// unshift meta info
312
-		if ($this->meta) {
313
-			$meta = '';
314
-			foreach ($this->meta as $key => $val) {
315
-				$meta .= $key . ': ' . $val . "\n";
312
+		if($this->meta) {
313
+			$meta='';
314
+			foreach($this->meta as $key => $val) {
315
+				$meta.=$key.': '.$val."\n";
316 316
 			}
317
-			$strings = ['' => $meta] + $this->strings;
317
+			$strings=['' => $meta] + $this->strings;
318 318
 		} else {
319
-			$strings = $this->strings;
319
+			$strings=$this->strings;
320 320
 		}
321 321
 
322 322
 		// write offsets for original strings
323
-		foreach (array_keys($strings) as $o) {
324
-			$len = strlen($o);
323
+		foreach(array_keys($strings) as $o) {
324
+			$len=strlen($o);
325 325
 			$this->_writeInt($len);
326 326
 			$this->_writeInt($offset);
327
-			$offset += $len + 1;
327
+			$offset+=$len + 1;
328 328
 		}
329 329
 
330 330
 		// write offsets for translated strings
331
-		foreach ($strings as $t) {
332
-			$len = strlen($t);
331
+		foreach($strings as $t) {
332
+			$len=strlen($t);
333 333
 			$this->_writeInt($len);
334 334
 			$this->_writeInt($offset);
335
-			$offset += $len + 1;
335
+			$offset+=$len + 1;
336 336
 		}
337 337
 
338 338
 		// write original strings
339
-		foreach (array_keys($strings) as $o) {
339
+		foreach(array_keys($strings) as $o) {
340 340
 			$this->_writeStr($o);
341 341
 		}
342 342
 
343 343
 		// write translated strings
344
-		foreach ($strings as $t) {
344
+		foreach($strings as $t) {
345 345
 			$this->_writeStr($t);
346 346
 		}
347 347
 
Please login to merge, or discard this patch.
framework/I18N/core/Gettext/TGettext_PO.php 2 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
 	public 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
 	public function save($file = null)
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
  * @license     PHP License
39 39
  */
40 40
 
41
-require_once dirname(__FILE__) . '/TGettext.php';
41
+require_once dirname(__FILE__).'/TGettext.php';
42 42
 
43 43
 /**
44 44
  * File_Gettext_PO
@@ -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
-	public function __construct($file = '')
61
+	public 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
-	public function load($file = null)
73
+	public 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,35 +119,35 @@  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
-	public function save($file = null)
122
+	public 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
 
Please login to merge, or discard this patch.
framework/I18N/core/IMessageSource.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -109,6 +109,7 @@
 block discarded – undo
109 109
 	/**
110 110
 	 * Set the culture for this particular message source.
111 111
 	 * @param string the Culture name.
112
+	 * @return void
112 113
 	 */
113 114
 	public function setCulture($culture);
114 115
 	
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param string a catalogue to load
48 48
 	 * @return boolean true if loaded, false otherwise.
49 49
 	 */
50
-	public function load($catalogue = 'messages');
50
+	public function load($catalogue='messages');
51 51
 	
52 52
 	/**
53 53
 	 * Get the translation table. This includes all the loaded sections.
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * @param string the catalogue to add to
73 73
 	 * @return boolean true if saved successfuly, false otherwise.
74 74
 	 */
75
-	public function save($catalogue = 'messages');
75
+	public function save($catalogue='messages');
76 76
 	
77 77
 	/**
78 78
 	 * Add a untranslated message to the source. Need to call save()
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * @param string the catalogue to delete from.
89 89
 	 * @return boolean true if deleted, false otherwise.
90 90
 	 */
91
-	public function delete($message, $catalogue = 'messages');
91
+	public function delete($message, $catalogue='messages');
92 92
 		
93 93
 	/**
94 94
 	 * Update the translation.
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @param string the catalogue of the translation.
99 99
 	 * @return boolean true if translation was updated, false otherwise.
100 100
 	 */
101
-	public function update($text, $target, $comments, $catalogue = 'messages');
101
+	public function update($text, $target, $comments, $catalogue='messages');
102 102
 	
103 103
 	/**
104 104
 	 * Returns a list of catalogue as key and all it variants as value.
Please login to merge, or discard this patch.
framework/I18N/core/MessageFormat.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -106,6 +106,7 @@
 block discarded – undo
106 106
 	/**
107 107
 	 * Sets the charset for message output.
108 108
 	 * @param string charset, default is UTF-8
109
+	 * @param string $charset
109 110
 	 */
110 111
 	public function setCharset($charset)
111 112
 	{
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -208,8 +208,7 @@
 block discarded – undo
208 208
 						return 	$this->postscript[0] .
209 209
 								strtr($string, $args) .
210 210
 								$this->postscript[1];
211
-					}
212
-					else
211
+					} else
213 212
 						return strtr($target, $args);
214 213
 				}
215 214
 			}
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 /**
22 22
  * Get the encoding utilities
23 23
  */
24
-require_once(dirname(__FILE__) . '/util.php');
24
+require_once(dirname(__FILE__).'/util.php');
25 25
 
26 26
 /**
27 27
  * MessageFormat class.
@@ -58,25 +58,25 @@  discard block
 block discarded – undo
58 58
 	 * A list of loaded message catalogues.
59 59
 	 * @var array
60 60
 	 */
61
-	protected $catagloues = [];
61
+	protected $catagloues=[];
62 62
 	
63 63
 	/**
64 64
 	 * The translation messages.
65 65
 	 * @var array
66 66
 	 */
67
-	protected $messages = [];
67
+	protected $messages=[];
68 68
 	
69 69
 	/**
70 70
 	 * A list of untranslated messages.
71 71
 	 * @var array
72 72
 	 */
73
-	protected $untranslated = [];
73
+	protected $untranslated=[];
74 74
 	
75 75
 	/**
76 76
 	 * The prefix and suffix to append to untranslated messages.
77 77
 	 * @var array
78 78
 	 */
79
-	protected $postscript = ['',''];
79
+	protected $postscript=['', ''];
80 80
 	
81 81
 	/**
82 82
 	 * Set the default catalogue.
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 * Output encoding charset
89 89
 	 * @var string
90 90
 	 */
91
-	protected $charset = 'UTF-8';
91
+	protected $charset='UTF-8';
92 92
 
93 93
 	/**
94 94
 	 * Constructor.
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 	 * @param MessageSource the source of translation messages.
98 98
 	 * @param string charset for the message output.
99 99
 	 */
100
-	public function __construct(IMessageSource $source, $charset = 'UTF-8')
100
+	public function __construct(IMessageSource $source, $charset='UTF-8')
101 101
 	{
102
-		$this->source = $source;
102
+		$this->source=$source;
103 103
 		$this->setCharset($charset);
104 104
 	}
105 105
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 */
110 110
 	public function setCharset($charset)
111 111
 	{
112
-		$this->charset = $charset;
112
+		$this->charset=$charset;
113 113
 	}
114 114
 
115 115
 	/**
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 			
136 136
 		if($this->source->load($catalogue))
137 137
 		{
138
-			$this->messages[$catalogue] = $this->source->read();
139
-			$this->catagloues[] = $catalogue;
138
+			$this->messages[$catalogue]=$this->source->read();
139
+			$this->catagloues[]=$catalogue;
140 140
 		}
141 141
 	}
142 142
 
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 	 * catalogue.
154 154
 	 * @return string translated string.
155 155
 	 */
156
-	public function format($string, $args = [], $catalogue = null, $charset = null)
156
+	public function format($string, $args=[], $catalogue=null, $charset=null)
157 157
 	{
158
-		if(empty($charset)) $charset = $this->getCharset();
158
+		if(empty($charset)) $charset=$this->getCharset();
159 159
 		
160 160
 		//force args as UTF-8
161 161
 		foreach($args as $k => $v)
162
-			$args[$k] = I18N_toUTF8($v, $charset);
163
-		$s = $this->formatString(I18N_toUTF8($string, $charset), $args, $catalogue);
162
+			$args[$k]=I18N_toUTF8($v, $charset);
163
+		$s=$this->formatString(I18N_toUTF8($string, $charset), $args, $catalogue);
164 164
 		return I18N_toEncoding($s, $charset);
165 165
 	}
166 166
 
@@ -172,20 +172,20 @@  discard block
 block discarded – undo
172 172
 	 * catalogue.
173 173
 	 * @return string translated string.
174 174
 	 */
175
-	protected function formatString($string, $args = [], $catalogue = null)
175
+	protected function formatString($string, $args=[], $catalogue=null)
176 176
 	{
177 177
 		if(empty($catalogue))
178 178
 		{
179 179
 			if(empty($this->Catalogue))
180
-				$catalogue = 'messages';
180
+				$catalogue='messages';
181 181
 			else
182
-				$catalogue = $this->Catalogue;
182
+				$catalogue=$this->Catalogue;
183 183
 		}
184 184
 				
185 185
 		$this->loadCatalogue($catalogue);
186 186
 		
187 187
 		if(empty($args))
188
-			$args = [];
188
+			$args=[];
189 189
 		
190 190
 		foreach($this->messages[$catalogue] as $variant)
191 191
 		{
@@ -193,20 +193,20 @@  discard block
 block discarded – undo
193 193
 			foreach($variant as $source => $result)
194 194
 			{
195 195
 				// we found it, so return the target translation
196
-				if($source == $string)
196
+				if($source==$string)
197 197
 				{
198 198
 					//check if it contains only strings.
199 199
 					if(is_string($result))
200
-						$target = $result;
200
+						$target=$result;
201 201
 					else
202 202
 					{
203
-						$target = $result[0];
203
+						$target=$result[0];
204 204
 					}
205 205
 					//found, but untranslated
206 206
 					if(empty($target))
207 207
 					{
208
-						return 	$this->postscript[0] .
209
-								strtr($string, $args) .
208
+						return 	$this->postscript[0].
209
+								strtr($string, $args).
210 210
 								$this->postscript[1];
211 211
 					}
212 212
 					else
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 		// well we did not find the translation string.
219 219
 		$this->source->append($string);
220 220
 		
221
-		return 	$this->postscript[0] .
222
-				strtr($string, $args) .
221
+		return 	$this->postscript[0].
222
+				strtr($string, $args).
223 223
 				$this->postscript[1];
224 224
 	}
225 225
 	
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
 	{
243 243
 		if(is_array($postscript) && count($postscript) >= 2)
244 244
 		{
245
-			$this->postscript[0] = $postscript[0];
246
-			$this->postscript[1] = $postscript[1];
245
+			$this->postscript[0]=$postscript[0];
246
+			$this->postscript[1]=$postscript[1];
247 247
 		}
248 248
 	}
249 249
 }
Please login to merge, or discard this patch.
framework/I18N/core/MessageSource.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -250,6 +250,7 @@  discard block
 block discarded – undo
250 250
 	/**
251 251
 	 * Set the culture for this message source.
252 252
 	 * @param string culture name
253
+	 * @param string $culture
253 254
 	 */
254 255
 	public function setCulture($culture)
255 256
 	{
@@ -268,6 +269,7 @@  discard block
 block discarded – undo
268 269
 	/**
269 270
 	 * Get the last modified unix-time for this particular catalogue+variant.
270 271
 	 * @param string catalogue+variant
272
+	 * @param string $source
271 273
 	 * @return int last modified in unix-time format.
272 274
 	 */
273 275
 	protected function getLastModified($source)
@@ -279,6 +281,7 @@  discard block
 block discarded – undo
279 281
 	 * Load the message for a particular catalogue+variant.
280 282
 	 * This methods needs to implemented by subclasses.
281 283
 	 * @param string catalogue+variant.
284
+	 * @param string $variant
282 285
 	 * @return array of translation messages.
283 286
 	 */
284 287
 	protected function &loadData($variant)
@@ -299,6 +302,7 @@  discard block
 block discarded – undo
299 302
 	/**
300 303
 	 * Determine if the source is valid.
301 304
 	 * @param string catalogue+variant
305
+	 * @param string $source
302 306
 	 * @return boolean true if valid, false otherwise.
303 307
 	 */
304 308
 	protected function isValidSource($source)
@@ -310,6 +314,7 @@  discard block
 block discarded – undo
310 314
 	 * Get all the variants of a particular catalogue.
311 315
 	 * This method must be implemented by subclasses.
312 316
 	 * @param string catalogue name
317
+	 * @param string $catalogue
313 318
 	 * @return array list of all variants for this catalogue.
314 319
 	 */
315 320
 	protected function getCatalogueList($catalogue)
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
  */
23 23
 use Exception;
24 24
 
25
-require_once(dirname(__FILE__) . '/IMessageSource.php');
25
+require_once(dirname(__FILE__).'/IMessageSource.php');
26 26
 
27 27
 /**
28 28
  * Get the MessageCache class file.
29 29
  */
30
-require_once(dirname(__FILE__) . '/MessageCache.php');
30
+require_once(dirname(__FILE__).'/MessageCache.php');
31 31
 
32 32
 /**
33 33
  * Abstract MessageSource class.
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * Array of translation messages.
83 83
 	 * @var array
84 84
 	 */
85
-	protected $messages = [];
85
+	protected $messages=[];
86 86
 
87 87
 	/**
88 88
 	 * The source of message translations.
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	protected $cache;
98 98
 	
99
-	protected $untranslated = [];
99
+	protected $untranslated=[];
100 100
 
101 101
 	/**
102 102
 	 * Private constructor. MessageSource must be initialized using
@@ -124,25 +124,25 @@  discard block
 block discarded – undo
124 124
 	 * @return MessageSource a new message source of the specified type.
125 125
 	 * @throws InvalidMessageSourceTypeException
126 126
 	 */
127
-	public static function &factory($type, $source = '.', $filename = '')
127
+	public static function &factory($type, $source='.', $filename='')
128 128
 	{
129
-		$types = ['XLIFF','PHP','gettext','Database'];
129
+		$types=['XLIFF', 'PHP', 'gettext', 'Database'];
130 130
 
131 131
 		if(empty($filename) && !in_array($type, $types))
132
-			throw new Exception('Invalid type "' . $type . '", valid types are ' .
132
+			throw new Exception('Invalid type "'.$type.'", valid types are '.
133 133
 				implode(', ', $types));
134 134
 		
135
-		$class = 'MessageSource_' . $type;
135
+		$class='MessageSource_'.$type;
136 136
 		
137 137
 		if(empty($filename))
138
-			$filename = dirname(__FILE__) . '/' . $class . '.php';
138
+			$filename=dirname(__FILE__).'/'.$class.'.php';
139 139
 						
140
-		if(is_file($filename) == false)
140
+		if(is_file($filename)==false)
141 141
 			throw new Exception("File $filename not found");
142 142
 						
143 143
 		include_once $filename;
144 144
 		
145
-		$obj = new $class($source);
145
+		$obj=new $class($source);
146 146
 		
147 147
 		return $obj;
148 148
 	}
@@ -166,38 +166,38 @@  discard block
 block discarded – undo
166 166
 	 * @return boolean true if loaded, false otherwise.
167 167
 	 * @see read()
168 168
 	 */
169
-	public function load($catalogue = 'messages')
169
+	public function load($catalogue='messages')
170 170
 	{
171
-		$variants = $this->getCatalogueList($catalogue);
171
+		$variants=$this->getCatalogueList($catalogue);
172 172
 		
173
-		$this->messages = [];
173
+		$this->messages=[];
174 174
 		
175 175
 		foreach($variants as $variant)
176 176
 		{
177
-			$source = $this->getSource($variant);
177
+			$source=$this->getSource($variant);
178 178
 			
179
-			if($this->isValidSource($source) == false) continue;
179
+			if($this->isValidSource($source)==false) continue;
180 180
 
181
-			$loadData = true;
181
+			$loadData=true;
182 182
 			
183 183
 			if($this->cache)
184 184
 			{
185
-				$data = $this->cache->get($variant,
185
+				$data=$this->cache->get($variant,
186 186
 					$this->culture, $this->getLastModified($source));
187 187
 				
188 188
 				if(is_array($data))
189 189
 				{
190
-					$this->messages[$variant] = $data;
191
-					$loadData = false;
190
+					$this->messages[$variant]=$data;
191
+					$loadData=false;
192 192
 				}
193 193
 				unset($data);
194 194
 			}
195 195
 			if($loadData)
196 196
 			{
197
-				$data = &$this->loadData($source);
197
+				$data=&$this->loadData($source);
198 198
 				if(is_array($data))
199 199
 				{
200
-					$this->messages[$variant] = $data;
200
+					$this->messages[$variant]=$data;
201 201
 					if($this->cache)
202 202
 						$this->cache->save($data, $variant, $this->culture);
203 203
 				}
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function setCache(MessageCache $cache)
235 235
 	{
236
-		$this->cache = $cache;
236
+		$this->cache=$cache;
237 237
 	}
238 238
 	
239 239
 	/**
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	public function append($message)
245 245
 	{
246 246
 		if(!in_array($message, $this->untranslated))
247
-			$this->untranslated[] = $message;
247
+			$this->untranslated[]=$message;
248 248
 	}
249 249
 	
250 250
 	/**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 */
254 254
 	public function setCulture($culture)
255 255
 	{
256
-		$this->culture = $culture;
256
+		$this->culture=$culture;
257 257
 	}
258 258
 	
259 259
 	/**
Please login to merge, or discard this patch.
framework/I18N/core/NumberFormatInfo.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -172,6 +172,7 @@
 block discarded – undo
172 172
 	 * @param int the number formatting type, it should be
173 173
 	 * NumberFormatInfo::DECIMAL, NumberFormatInfo::CURRENCY,
174 174
 	 * NumberFormatInfo::PERCENTAGE, or NumberFormatInfo::SCIENTIFIC
175
+	 * @param integer $type
175 176
 	 * @return NumberFormatInfo NumberFormatInfo for the specified
176 177
 	 * culture.
177 178
 	 * @see getCurrencyInstance();
Please login to merge, or discard this patch.
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 use Exception;
25 25
 
26
-require_once(dirname(__FILE__) . '/CultureInfo.php');
26
+require_once(dirname(__FILE__).'/CultureInfo.php');
27 27
 
28 28
 /**
29 29
  * NumberFormatInfo class
@@ -54,24 +54,24 @@  discard block
 block discarded – undo
54 54
 	 * ICU number formatting data.
55 55
 	 * @var array
56 56
 	 */
57
-	private $data = [];
57
+	private $data=[];
58 58
 
59 59
 	/**
60 60
 	 * A list of properties that are accessable/writable.
61 61
 	 * @var array
62 62
 	 */
63
-	protected $properties = [];
63
+	protected $properties=[];
64 64
 
65 65
 	/**
66 66
 	 * The number pattern.
67 67
 	 * @var array
68 68
 	 */
69
-	protected $pattern = [];
69
+	protected $pattern=[];
70 70
 
71
-	const DECIMAL = 0;
72
-	const CURRENCY = 1;
73
-	const PERCENTAGE = 2;
74
-	const SCIENTIFIC = 3;
71
+	const DECIMAL=0;
72
+	const CURRENCY=1;
73
+	const PERCENTAGE=2;
74
+	const SCIENTIFIC=3;
75 75
 
76 76
 	/**
77 77
 	 * Allow functions that begins with 'set' to be called directly
@@ -80,11 +80,11 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function __get($name)
82 82
 	{
83
-		$getProperty = 'get' . $name;
83
+		$getProperty='get'.$name;
84 84
 		if(in_array($getProperty, $this->properties))
85 85
 			return $this->$getProperty();
86 86
 		else
87
-			throw new Exception('Property ' . $name . ' does not exists.');
87
+			throw new Exception('Property '.$name.' does not exists.');
88 88
 	}
89 89
 
90 90
 	/**
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function __set($name, $value)
95 95
 	{
96
-		$setProperty = 'set' . $name;
96
+		$setProperty='set'.$name;
97 97
 		if(in_array($setProperty, $this->properties))
98 98
 			$this->$setProperty($value);
99 99
 		else
100
-			throw new Exception('Property ' . $name . ' can not be set.');
100
+			throw new Exception('Property '.$name.' can not be set.');
101 101
 	}
102 102
 
103 103
 	/**
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
 	 * @param array ICU data for date time formatting.
110 110
 	 * @see getInstance()
111 111
 	 */
112
-	public function __construct($data = [], $type = NumberFormatInfo::DECIMAL)
112
+	public function __construct($data=[], $type=NumberFormatInfo::DECIMAL)
113 113
 	{
114
-		$this->properties = get_class_methods($this);
114
+		$this->properties=get_class_methods($this);
115 115
 
116 116
 		if(empty($data))
117 117
 			throw new Exception('Please provide the ICU data to initialize.');
118 118
 
119
-		$this->data = $data;
119
+		$this->data=$data;
120 120
 
121 121
 		$this->setPattern($type);
122 122
 	}
@@ -127,20 +127,20 @@  discard block
 block discarded – undo
127 127
 	 * NumberFormatInfo::PERCENTAGE, or NumberFormatInfo::SCIENTIFIC
128 128
 	 * @param int pattern type.
129 129
 	 */
130
-	public function setPattern($type = NumberFormatInfo::DECIMAL)
130
+	public function setPattern($type=NumberFormatInfo::DECIMAL)
131 131
 	{
132 132
 		if(is_int($type))
133
-			$this->pattern =
133
+			$this->pattern=
134 134
 				$this->parsePattern($this->data['NumberPatterns'][$type]);
135 135
 		else
136
-			$this->pattern = $this->parsePattern($type);
136
+			$this->pattern=$this->parsePattern($type);
137 137
 
138
-		$this->pattern['negInfty'] =
139
-			$this->data['NumberElements'][6] .
138
+		$this->pattern['negInfty']=
139
+			$this->data['NumberElements'][6].
140 140
 			$this->data['NumberElements'][9];
141 141
 
142
-		$this->pattern['posInfty'] =
143
-			$this->data['NumberElements'][11] .
142
+		$this->pattern['posInfty']=
143
+			$this->data['NumberElements'][11].
144 144
 			$this->data['NumberElements'][9];
145 145
 	}
146 146
 
@@ -154,13 +154,13 @@  discard block
 block discarded – undo
154 154
 	 * (invariant).
155 155
 	 * @return NumberFormatInfo default NumberFormatInfo.
156 156
 	 */
157
-	public static function getInvariantInfo($type = NumberFormatInfo::DECIMAL)
157
+	public static function getInvariantInfo($type=NumberFormatInfo::DECIMAL)
158 158
 	{
159 159
 		static $invariant;
160
-		if($invariant === null)
160
+		if($invariant===null)
161 161
 		{
162
-			$culture = CultureInfo::getInvariantCulture();
163
-			$invariant = $culture->NumberFormat;
162
+			$culture=CultureInfo::getInvariantCulture();
163
+			$invariant=$culture->NumberFormat;
164 164
 			$invariant->setPattern($type);
165 165
 		}
166 166
 		return $invariant;
@@ -178,26 +178,26 @@  discard block
 block discarded – undo
178 178
 	 * @see getPercentageInstance();
179 179
 	 * @see getScientificInstance();
180 180
 	 */
181
-	public static function getInstance($culture = null,
182
-									   $type = NumberFormatInfo::DECIMAL)
181
+	public static function getInstance($culture=null,
182
+									   $type=NumberFormatInfo::DECIMAL)
183 183
 	{
184
-		if ($culture instanceof CultureInfo)
184
+		if($culture instanceof CultureInfo)
185 185
 		{
186
-			$formatInfo = $culture->NumberFormat;
186
+			$formatInfo=$culture->NumberFormat;
187 187
 			$formatInfo->setPattern($type);
188 188
 			return $formatInfo;
189 189
 		}
190 190
 		   elseif(is_string($culture))
191 191
 		   {
192
-			   $cultureInfo = new CultureInfo($culture);
193
-			   $formatInfo = $cultureInfo->NumberFormat;
192
+			   $cultureInfo=new CultureInfo($culture);
193
+			   $formatInfo=$cultureInfo->NumberFormat;
194 194
 			   $formatInfo->setPattern($type);
195 195
 			   return $formatInfo;
196 196
 		   }
197 197
 		   else
198 198
 		   {
199
-			$cultureInfo = new CultureInfo();
200
-			   $formatInfo = $cultureInfo->NumberFormat;
199
+			$cultureInfo=new CultureInfo();
200
+			   $formatInfo=$cultureInfo->NumberFormat;
201 201
 			   $formatInfo->setPattern($type);
202 202
 			   return $formatInfo;
203 203
 		   }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	 * @return NumberFormatInfo NumberFormatInfo for the specified
210 210
 	 * culture.
211 211
 	 */
212
-	public static function getCurrencyInstance($culture = null)
212
+	public static function getCurrencyInstance($culture=null)
213 213
 	{
214 214
 		return self::getInstance($culture, self::CURRENCY);
215 215
 	}
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 * @return NumberFormatInfo NumberFormatInfo for the specified
221 221
 	 * culture.
222 222
 	 */
223
-	public static function getPercentageInstance($culture = null)
223
+	public static function getPercentageInstance($culture=null)
224 224
 	{
225 225
 		return self::getInstance($culture, self::PERCENTAGE);
226 226
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @return NumberFormatInfo NumberFormatInfo for the specified
232 232
 	 * culture.
233 233
 	 */
234
-	public static function getScientificInstance($culture = null)
234
+	public static function getScientificInstance($culture=null)
235 235
 	{
236 236
 		return self::getInstance($culture, self::SCIENTIFIC);
237 237
 	}
@@ -243,67 +243,67 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	protected function parsePattern($pattern)
245 245
 	{
246
-		$pattern = explode(';', $pattern);
246
+		$pattern=explode(';', $pattern);
247 247
 
248
-		$negative = null;
248
+		$negative=null;
249 249
 		if(count($pattern) > 1)
250
-			$negative = $pattern[1];
251
-		$pattern = $pattern[0];
250
+			$negative=$pattern[1];
251
+		$pattern=$pattern[0];
252 252
 
253
-		$comma = ',';
254
-		$dot = '.';
255
-		$digit = '0';
256
-		$hash = '#';
253
+		$comma=',';
254
+		$dot='.';
255
+		$digit='0';
256
+		$hash='#';
257 257
 
258 258
 		//find the first group point, and decimal point
259
-		$groupPos1 = strrpos($pattern, $comma);
260
-		$decimalPos = strrpos($pattern, $dot);
259
+		$groupPos1=strrpos($pattern, $comma);
260
+		$decimalPos=strrpos($pattern, $dot);
261 261
 
262
-		$groupPos2 = false;
263
-		$groupSize1 = false;
264
-		$groupSize2 = false;
265
-		$decimalPoints = is_int($decimalPos)?-1:false;
262
+		$groupPos2=false;
263
+		$groupSize1=false;
264
+		$groupSize2=false;
265
+		$decimalPoints=is_int($decimalPos) ?-1 : false;
266 266
 
267
-		$info['negPref'] = $this->data['NumberElements'][6];
268
-		$info['negPost'] = '';
267
+		$info['negPref']=$this->data['NumberElements'][6];
268
+		$info['negPost']='';
269 269
 
270
-		$info['negative'] = $negative;
271
-		$info['positive'] = $pattern;
270
+		$info['negative']=$negative;
271
+		$info['positive']=$pattern;
272 272
 
273 273
 		//find the negative prefix and postfix
274 274
 		if($negative)
275 275
 		{
276
-			$prefixPostfix = $this->getPrePostfix($negative);
277
-			$info['negPref'] = $prefixPostfix[0];
278
-			$info['negPost'] = $prefixPostfix[1];
276
+			$prefixPostfix=$this->getPrePostfix($negative);
277
+			$info['negPref']=$prefixPostfix[0];
278
+			$info['negPost']=$prefixPostfix[1];
279 279
 		}
280 280
 
281
-		$posfix = $this->getPrePostfix($pattern);
282
-		$info['posPref'] = $posfix[0];
283
-		$info['posPost'] = $posfix[1];
281
+		$posfix=$this->getPrePostfix($pattern);
282
+		$info['posPref']=$posfix[0];
283
+		$info['posPost']=$posfix[1];
284 284
 
285 285
 		//var_dump($pattern);
286 286
 		//var_dump($decimalPos);
287 287
 		if(is_int($groupPos1))
288 288
 		{
289 289
 			//get the second group
290
-			$groupPos2 = strrpos(substr($pattern, 0, $groupPos1), $comma);
290
+			$groupPos2=strrpos(substr($pattern, 0, $groupPos1), $comma);
291 291
 
292 292
 			//get the number of decimal digits
293 293
 			if(is_int($decimalPos))
294 294
 			{
295
-				$groupSize1 = $decimalPos - $groupPos1 - 1;
295
+				$groupSize1=$decimalPos - $groupPos1 - 1;
296 296
 
297 297
 			}
298 298
 			else
299 299
 			{
300 300
 				//no decimal point, so traverse from the back
301 301
 				//to find the groupsize 1.
302
-				for($i = strlen($pattern) - 1; $i >= 0; $i--)
302
+				for($i=strlen($pattern) - 1; $i >= 0; $i--)
303 303
 				{
304
-					if($pattern{$i} == $digit || $pattern{$i} == $hash)
304
+					if($pattern{$i}==$digit || $pattern{$i}==$hash)
305 305
 					{
306
-						$groupSize1 = $i - $groupPos1;
306
+						$groupSize1=$i - $groupPos1;
307 307
 						break;
308 308
 					}
309 309
 				}
@@ -311,36 +311,36 @@  discard block
 block discarded – undo
311 311
 
312 312
 			//get the second group size
313 313
 			if(is_int($groupPos2))
314
-				$groupSize2 = $groupPos1 - $groupPos2 - 1;
314
+				$groupSize2=$groupPos1 - $groupPos2 - 1;
315 315
 		}
316 316
 
317 317
 		if(is_int($decimalPos))
318 318
 		{
319
-			for($i = strlen($pattern) - 1; $i >= 0; $i--)
319
+			for($i=strlen($pattern) - 1; $i >= 0; $i--)
320 320
 			{
321
-				if($pattern{$i} == $dot) break;
322
-				if($pattern{$i} == $digit)
321
+				if($pattern{$i}==$dot) break;
322
+				if($pattern{$i}==$digit)
323 323
 				{
324
-					$decimalPoints = $i - $decimalPos;
324
+					$decimalPoints=$i - $decimalPos;
325 325
 					break;
326 326
 				}
327 327
 			}
328 328
 		}
329 329
 
330 330
 		if(is_int($decimalPos))
331
-			$digitPattern = substr($pattern, 0, $decimalPos);
331
+			$digitPattern=substr($pattern, 0, $decimalPos);
332 332
 		else
333
-			$digitPattern = $pattern;
333
+			$digitPattern=$pattern;
334 334
 
335
-		$digitPattern = preg_replace('/[^0]/', '', $digitPattern);
335
+		$digitPattern=preg_replace('/[^0]/', '', $digitPattern);
336 336
 
337
-		$info['groupPos1'] = $groupPos1;
338
-		$info['groupSize1'] = $groupSize1;
339
-		$info['groupPos2'] = $groupPos2;
340
-		$info['groupSize2'] = $groupSize2;
341
-		$info['decimalPos'] = $decimalPos;
342
-		$info['decimalPoints'] = $decimalPoints;
343
-		$info['digitSize'] = strlen($digitPattern);
337
+		$info['groupPos1']=$groupPos1;
338
+		$info['groupSize1']=$groupSize1;
339
+		$info['groupPos2']=$groupPos2;
340
+		$info['groupSize2']=$groupSize2;
341
+		$info['decimalPos']=$decimalPos;
342
+		$info['decimalPoints']=$decimalPoints;
343
+		$info['digitSize']=strlen($digitPattern);
344 344
 		return $info;
345 345
 	}
346 346
 
@@ -351,9 +351,9 @@  discard block
 block discarded – undo
351 351
 	 */
352 352
 	protected function getPrePostfix($pattern)
353 353
 	{
354
-		$regexp = '/[#,\.0]+/';
355
-		$result = preg_split($regexp, $pattern);
356
-		return [$result[0],$result[1]];
354
+		$regexp='/[#,\.0]+/';
355
+		$result=preg_split($regexp, $pattern);
356
+		return [$result[0], $result[1]];
357 357
 	}
358 358
 
359 359
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	public function setDecimalDigits($value)
374 374
 	{
375
-		return $this->pattern['decimalPoints'] = $value;
375
+		return $this->pattern['decimalPoints']=$value;
376 376
 	}
377 377
 
378 378
 	public function getDigitSize()
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 
383 383
 	public function setDigitSize($value)
384 384
 	{
385
-		$this->pattern['digitSize'] = $value;
385
+		$this->pattern['digitSize']=$value;
386 386
 	}
387 387
 
388 388
 	/**
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	 */
401 401
 	public function setDecimalSeparator($value)
402 402
 	{
403
-		return $this->data['NumberElements'][0] = $value;
403
+		return $this->data['NumberElements'][0]=$value;
404 404
 	}
405 405
 
406 406
 	/**
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	 */
421 421
 	public function setGroupSeparator($value)
422 422
 	{
423
-		return $this->data['NumberElements'][1] = $value;
423
+		return $this->data['NumberElements'][1]=$value;
424 424
 	}
425 425
 
426 426
 	/**
@@ -432,8 +432,8 @@  discard block
 block discarded – undo
432 432
 	 */
433 433
 	public function getGroupSizes()
434 434
 	{
435
-		$group1 = $this->pattern['groupSize1'];
436
-		$group2 = $this->pattern['groupSize2'];
435
+		$group1=$this->pattern['groupSize1'];
436
+		$group2=$this->pattern['groupSize2'];
437 437
 
438 438
 		return [$group1, $group2];
439 439
 	}
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	public function setGroupSizes($groupSize)
449 449
 	{
450
-		$this->pattern['groupSize1'] = $groupSize[0];
451
-		$this->pattern['groupSize2'] = $groupSize[1];
450
+		$this->pattern['groupSize1']=$groupSize[0];
451
+		$this->pattern['groupSize2']=$groupSize[1];
452 452
 	}
453 453
 
454 454
 	/**
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 	 */
460 460
 	public function getNegativePattern()
461 461
 	{
462
-		$prefix = $this->pattern['negPref'];
463
-		$postfix = $this->pattern['negPost'];
462
+		$prefix=$this->pattern['negPref'];
463
+		$postfix=$this->pattern['negPost'];
464 464
 		return [$prefix, $postfix];
465 465
 	}
466 466
 
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 	 */
473 473
 	public function setNegativePattern($pattern)
474 474
 	{
475
-		$this->pattern['negPref'] = $pattern[0];
476
-		$this->pattern['negPost'] = $pattern[1];
475
+		$this->pattern['negPref']=$pattern[0];
476
+		$this->pattern['negPost']=$pattern[1];
477 477
 	}
478 478
 
479 479
 	/**
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	public function getPositivePattern()
486 486
 	{
487
-		$prefix = $this->pattern['posPref'];
488
-		$postfix = $this->pattern['posPost'];
487
+		$prefix=$this->pattern['posPref'];
488
+		$postfix=$this->pattern['posPost'];
489 489
 		return [$prefix, $postfix];
490 490
 	}
491 491
 
@@ -497,15 +497,15 @@  discard block
 block discarded – undo
497 497
 	 */
498 498
 	public function setPositivePattern($pattern)
499 499
 	{
500
-		$this->pattern['posPref'] = $pattern[0];
501
-		$this->pattern['posPost'] = $pattern[1];
500
+		$this->pattern['posPref']=$pattern[0];
501
+		$this->pattern['posPost']=$pattern[1];
502 502
 	}
503 503
 
504 504
 	/**
505 505
 	 * Gets the string to use as the currency symbol.
506 506
 	 * @return string currency symbol.
507 507
 	 */
508
-	public function getCurrencySymbol($currency = 'USD')
508
+	public function getCurrencySymbol($currency='USD')
509 509
 	{
510 510
 		if(isset($this->pattern['symbol']))
511 511
 			return $this->pattern['symbol'];
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 */
521 521
 	public function setCurrencySymbol($symbol)
522 522
 	{
523
-		$this->pattern['symbol'] = $symbol;
523
+		$this->pattern['symbol']=$symbol;
524 524
 	}
525 525
 
526 526
 	/**
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	public function setNegativeInfinitySymbol($value)
540 540
 	{
541
-		$this->pattern['negInfty'] = $value;
541
+		$this->pattern['negInfty']=$value;
542 542
 	}
543 543
 
544 544
 	/**
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 	 */
557 557
 	public function setPositiveInfinitySymbol($value)
558 558
 	{
559
-		$this->pattern['posInfty'] = $value;
559
+		$this->pattern['posInfty']=$value;
560 560
 	}
561 561
 
562 562
 	/**
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	 */
575 575
 	public function setNegativeSign($value)
576 576
 	{
577
-		$this->data['NumberElements'][6] = $value;
577
+		$this->data['NumberElements'][6]=$value;
578 578
 	}
579 579
 
580 580
 	/**
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	 */
593 593
 	public function setPositiveSign($value)
594 594
 	{
595
-		$this->data['NumberElements'][11] = $value;
595
+		$this->data['NumberElements'][11]=$value;
596 596
 	}
597 597
 
598 598
 	/**
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 	 */
611 611
 	public function setNaNSymbol($value)
612 612
 	{
613
-		$this->data['NumberElements'][10] = $value;
613
+		$this->data['NumberElements'][10]=$value;
614 614
 	}
615 615
 
616 616
 	/**
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	 */
629 629
 	public function setPercentSymbol($value)
630 630
 	{
631
-		$this->data['NumberElements'][3] = $value;
631
+		$this->data['NumberElements'][3]=$value;
632 632
 	}
633 633
 
634 634
 	/**
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 	 */
647 647
 	public function setPerMilleSymbol($value)
648 648
 	{
649
-		$this->data['NumberElements'][8] = $value;
649
+		$this->data['NumberElements'][8]=$value;
650 650
 	}
651 651
 }
652 652
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -186,15 +186,13 @@  discard block
 block discarded – undo
186 186
 			$formatInfo = $culture->NumberFormat;
187 187
 			$formatInfo->setPattern($type);
188 188
 			return $formatInfo;
189
-		}
190
-		   elseif(is_string($culture))
189
+		} elseif(is_string($culture))
191 190
 		   {
192 191
 			   $cultureInfo = new CultureInfo($culture);
193 192
 			   $formatInfo = $cultureInfo->NumberFormat;
194 193
 			   $formatInfo->setPattern($type);
195 194
 			   return $formatInfo;
196
-		   }
197
-		   else
195
+		   } else
198 196
 		   {
199 197
 			$cultureInfo = new CultureInfo();
200 198
 			   $formatInfo = $cultureInfo->NumberFormat;
@@ -294,8 +292,7 @@  discard block
 block discarded – undo
294 292
 			{
295 293
 				$groupSize1 = $decimalPos - $groupPos1 - 1;
296 294
 
297
-			}
298
-			else
295
+			} else
299 296
 			{
300 297
 				//no decimal point, so traverse from the back
301 298
 				//to find the groupsize 1.
Please login to merge, or discard this patch.
framework/I18N/core/TCache_Lite.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -488,6 +488,8 @@
 block discarded – undo
488 488
 	/**
489 489
 	 *
490 490
 	 * @access private
491
+	 * @param string $id
492
+	 * @param string $data
491 493
 	 */
492 494
 	public function _memoryCacheAdd($id, $data)
493 495
 	{
Please login to merge, or discard this patch.
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -607,15 +607,15 @@
 block discarded – undo
607 607
 	public function _hash($data, $controlType)
608 608
 	{
609 609
 		switch ($controlType) {
610
-		case 'md5':
611
-			return md5($data);
612
-		case 'crc32':
613
-			return sprintf('% 32d', crc32($data));
614
-		case 'strlen':
615
-			return sprintf('% 32d', strlen($data));
616
-		default:
617
-			$this->raiseError('Unknown controlType ! ' .
618
-			'(available values are only \'md5\', \'crc32\', \'strlen\')', -5);
610
+			case 'md5':
611
+				return md5($data);
612
+			case 'crc32':
613
+				return sprintf('% 32d', crc32($data));
614
+			case 'strlen':
615
+				return sprintf('% 32d', strlen($data));
616
+			default:
617
+				$this->raiseError('Unknown controlType ! ' .
618
+				'(available values are only \'md5\', \'crc32\', \'strlen\')', -5);
619 619
 		}
620 620
 	}
621 621
 
Please login to merge, or discard this patch.
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * @var string $_cacheDir
59 59
 	 */
60
-	protected $_cacheDir = '/tmp/';
60
+	protected $_cacheDir='/tmp/';
61 61
 
62 62
 	/**
63 63
 	 * Enable / disable caching
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 	 *
67 67
 	 * @var boolean $_caching
68 68
 	 */
69
-	protected $_caching = true;
69
+	protected $_caching=true;
70 70
 
71 71
 	/**
72 72
 	 * Cache lifetime (in seconds)
73 73
 	 *
74 74
 	 * @var int $_lifeTime
75 75
 	 */
76
-	protected $_lifeTime = 3600;
76
+	protected $_lifeTime=3600;
77 77
 
78 78
 	/**
79 79
 	 * Enable / disable fileLocking
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @var boolean $_fileLocking
84 84
 	 */
85
-	protected $_fileLocking = true;
85
+	protected $_fileLocking=true;
86 86
 
87 87
 	/**
88 88
 	 * Timestamp of the last valid cache
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @var boolean $_writeControl
110 110
 	 */
111
-	protected $_writeControl = true;
111
+	protected $_writeControl=true;
112 112
 
113 113
 	/**
114 114
 	 * Enable / disable read control
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 *
119 119
 	 * @var boolean $_writeControl
120 120
 	 */
121
-	protected $_readControl = true;
121
+	protected $_readControl=true;
122 122
 
123 123
 	/**
124 124
 	 * Type of read control (only if read control is enabled)
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @var boolean $_readControlType
133 133
 	 */
134
-	protected $_readControlType = 'crc32';
134
+	protected $_readControlType='crc32';
135 135
 
136 136
 	/**
137 137
 	 * Current cache id
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 *
155 155
 	 * @var boolean $_memoryCaching
156 156
 	 */
157
-	protected $_memoryCaching = false;
157
+	protected $_memoryCaching=false;
158 158
 
159 159
 	/**
160 160
 	 * Enable / Disable "Only Memory Caching"
@@ -162,28 +162,28 @@  discard block
 block discarded – undo
162 162
 	 *
163 163
 	 * @var boolean $_onlyMemoryCaching
164 164
 	 */
165
-	protected $_onlyMemoryCaching = false;
165
+	protected $_onlyMemoryCaching=false;
166 166
 
167 167
 	/**
168 168
 	 * Memory caching array
169 169
 	 *
170 170
 	 * @var array $_memoryCachingArray
171 171
 	 */
172
-	protected $_memoryCachingArray = [];
172
+	protected $_memoryCachingArray=[];
173 173
 
174 174
 	/**
175 175
 	 * Memory caching counter
176 176
 	 *
177 177
 	 * @var int $memoryCachingCounter
178 178
 	 */
179
-	protected $_memoryCachingCounter = 0;
179
+	protected $_memoryCachingCounter=0;
180 180
 
181 181
 	/**
182 182
 	 * Memory caching limit
183 183
 	 *
184 184
 	 * @var int $memoryCachingLimit
185 185
 	 */
186
-	protected $_memoryCachingLimit = 1000;
186
+	protected $_memoryCachingLimit=1000;
187 187
 
188 188
 	/**
189 189
 	 * File Name protection
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 *
196 196
 	 * @var boolean $fileNameProtection
197 197
 	 */
198
-	protected $_fileNameProtection = true;
198
+	protected $_fileNameProtection=true;
199 199
 
200 200
 	/**
201 201
 	 * Enable / disable automatic serialization
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	 *
206 206
 	 * @var boolean $_serialize
207 207
 	 */
208
-	protected $_automaticSerialization = false;
208
+	protected $_automaticSerialization=false;
209 209
 
210 210
 	// --- Public methods ---
211 211
 
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 	 * @param array $options options
232 232
 	 * @access public
233 233
 	 */
234
-	public function __construct($options = [null])
234
+	public function __construct($options=[null])
235 235
 	{
236
-		$availableOptions = [	'automaticSerialization',
236
+		$availableOptions=['automaticSerialization',
237 237
 									'fileNameProtection',
238 238
 									'memoryCaching',
239 239
 									'onlyMemoryCaching',
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 									'readControlType'];
248 248
 		foreach($options as $key => $value) {
249 249
 			if(in_array($key, $availableOptions)) {
250
-				$property = '_' . $key;
251
-				$this->$property = $value;
250
+				$property='_'.$key;
251
+				$this->$property=$value;
252 252
 			}
253 253
 		}
254
-		$this->_refreshTime = time() - $this->_lifeTime;
254
+		$this->_refreshTime=time() - $this->_lifeTime;
255 255
 	}
256 256
 
257 257
 	/**
@@ -264,41 +264,41 @@  discard block
 block discarded – undo
264 264
 	 * @return string data of the cache (or false if no cache available)
265 265
 	 * @access public
266 266
 	 */
267
-	public function get($id, $group = 'default', $doNotTestCacheValidity = false)
267
+	public function get($id, $group='default', $doNotTestCacheValidity=false)
268 268
 	{
269
-		$this->_id = $id;
270
-		$this->_group = $group;
271
-		$data = false;
272
-		if ($this->_caching) {
269
+		$this->_id=$id;
270
+		$this->_group=$group;
271
+		$data=false;
272
+		if($this->_caching) {
273 273
 			$this->_setFileName($id, $group);
274
-			if ($this->_memoryCaching) {
275
-				if (isset($this->_memoryCachingArray[$this->_file])) {
276
-					if ($this->_automaticSerialization) {
274
+			if($this->_memoryCaching) {
275
+				if(isset($this->_memoryCachingArray[$this->_file])) {
276
+					if($this->_automaticSerialization) {
277 277
 						return unserialize(
278 278
 									$this->_memoryCachingArray[$this->_file]);
279 279
 					} else {
280 280
 						return $this->_memoryCachingArray[$this->_file];
281 281
 					}
282 282
 				} else {
283
-					if ($this->_onlyMemoryCaching) {
283
+					if($this->_onlyMemoryCaching) {
284 284
 						return false;
285 285
 					}
286 286
 				}
287 287
 			}
288
-			if ($doNotTestCacheValidity) {
289
-				if (file_exists($this->_file)) {
290
-					$data = $this->_read();
288
+			if($doNotTestCacheValidity) {
289
+				if(file_exists($this->_file)) {
290
+					$data=$this->_read();
291 291
 				}
292 292
 			} else {
293
-				if (@filemtime($this->_file) > $this->_refreshTime) {
294
-					$data = $this->_read();
293
+				if(@filemtime($this->_file) > $this->_refreshTime) {
294
+					$data=$this->_read();
295 295
 				}
296 296
 			}
297
-			if (($data) and ($this->_memoryCaching)) {
297
+			if(($data) and ($this->_memoryCaching)) {
298 298
 				$this->_memoryCacheAdd($this->_file, $data);
299 299
 			}
300
-			if ($this->_automaticSerialization && is_string($data)) {
301
-				$data = unserialize($data);
300
+			if($this->_automaticSerialization && is_string($data)) {
301
+				$data=unserialize($data);
302 302
 			}
303 303
 			return $data;
304 304
 		}
@@ -315,23 +315,23 @@  discard block
 block discarded – undo
315 315
 	 * @return boolean true if no problem
316 316
 	 * @access public
317 317
 	 */
318
-	public function save($data, $id = null, $group = 'default')
318
+	public function save($data, $id=null, $group='default')
319 319
 	{
320
-		if ($this->_caching) {
321
-			if ($this->_automaticSerialization) {
322
-				$data = serialize($data);
320
+		if($this->_caching) {
321
+			if($this->_automaticSerialization) {
322
+				$data=serialize($data);
323 323
 			}
324
-			if (isset($id)) {
324
+			if(isset($id)) {
325 325
 				$this->_setFileName($id, $group);
326 326
 			}
327
-			if ($this->_memoryCaching) {
327
+			if($this->_memoryCaching) {
328 328
 				$this->_memoryCacheAdd($this->_file, $data);
329
-				if ($this->_onlyMemoryCaching) {
329
+				if($this->_onlyMemoryCaching) {
330 330
 					return true;
331 331
 				}
332 332
 			}
333
-			if ($this->_writeControl) {
334
-				if (!$this->_writeAndControl($data)) {
333
+			if($this->_writeControl) {
334
+				if(!$this->_writeAndControl($data)) {
335 335
 					@touch($this->_file, time() - 2 * abs($this->_lifeTime));
336 336
 					return false;
337 337
 				} else {
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 	 * @return boolean true if no problem
353 353
 	 * @access public
354 354
 	 */
355
-	public function remove($id, $group = 'default')
355
+	public function remove($id, $group='default')
356 356
 	{
357 357
 		$this->_setFileName($id, $group);
358
-		if (!@unlink($this->_file)) {
358
+		if(!@unlink($this->_file)) {
359 359
 			$this->raiseError('TCache_Lite : Unable to remove cache !', -3);
360 360
 			return false;
361 361
 		}
@@ -372,35 +372,35 @@  discard block
 block discarded – undo
372 372
 	 * @return boolean true if no problem
373 373
 	 * @access public
374 374
 	 */
375
-	public function clean($group = false)
375
+	public function clean($group=false)
376 376
 	{
377
-		if ($this->_fileNameProtection) {
378
-			$motif = ($group) ? 'cache_' . md5($group) . '_' : 'cache_';
377
+		if($this->_fileNameProtection) {
378
+			$motif=($group) ? 'cache_'.md5($group).'_' : 'cache_';
379 379
 		} else {
380
-			$motif = ($group) ? 'cache_' . $group . '_' : 'cache_';
380
+			$motif=($group) ? 'cache_'.$group.'_' : 'cache_';
381 381
 		}
382
-		if ($this->_memoryCaching) {
383
-			while (list($key, $value) = each($this->_memoryCaching)) {
384
-				if (strpos($key, $motif, 0)) {
382
+		if($this->_memoryCaching) {
383
+			while(list($key, $value)=each($this->_memoryCaching)) {
384
+				if(strpos($key, $motif, 0)) {
385 385
 					unset($this->_memoryCaching[$key]);
386
-					$this->_memoryCachingCounter =
386
+					$this->_memoryCachingCounter=
387 387
 							$this->_memoryCachingCounter - 1;
388 388
 				}
389 389
 			}
390
-			if ($this->_onlyMemoryCaching) {
390
+			if($this->_onlyMemoryCaching) {
391 391
 				return true;
392 392
 			}
393 393
 		}
394
-		if (!($dh = opendir($this->_cacheDir))) {
394
+		if(!($dh=opendir($this->_cacheDir))) {
395 395
 			$this->raiseError('TCache_Lite : Unable to open cache directory !');
396 396
 			return false;
397 397
 		}
398
-		while ($file = readdir($dh)) {
399
-			if (($file != '.') && ($file != '..')) {
400
-				$file = $this->_cacheDir . $file;
401
-				if (is_file($file)) {
402
-					if (strpos($file, $motif, 0)) {
403
-						if (!@unlink($file)) {
398
+		while($file=readdir($dh)) {
399
+			if(($file!='.') && ($file!='..')) {
400
+				$file=$this->_cacheDir.$file;
401
+				if(is_file($file)) {
402
+					if(strpos($file, $motif, 0)) {
403
+						if(!@unlink($file)) {
404 404
 			 $this->raiseError('Cache_Lite : Unable to remove cache !', -3);
405 405
 							return false;
406 406
 						}
@@ -419,22 +419,22 @@  discard block
 block discarded – undo
419 419
 		 */
420 420
 	public function setLifeTime($newLifeTime)
421 421
 	{
422
-		$this->_lifeTime = $newLifeTime;
423
-		$this->_refreshTime = time() - $newLifeTime;
422
+		$this->_lifeTime=$newLifeTime;
423
+		$this->_refreshTime=time() - $newLifeTime;
424 424
 	}
425 425
 
426 426
 	/**
427 427
 	 *
428 428
 	 * @access public
429 429
 	 */
430
-	public function saveMemoryCachingState($id, $group = 'default')
430
+	public function saveMemoryCachingState($id, $group='default')
431 431
 	{
432
-		if ($this->_caching) {
433
-			$array = [
432
+		if($this->_caching) {
433
+			$array=[
434 434
 				'counter' => $this->_memoryCachingCounter,
435 435
 				'array' => $this->_memoryCachingState
436 436
 			];
437
-			$data = serialize($array);
437
+			$data=serialize($array);
438 438
 			$this->save($data, $id, $group);
439 439
 		}
440 440
 	}
@@ -443,15 +443,15 @@  discard block
 block discarded – undo
443 443
 	 *
444 444
 	 * @access public
445 445
 	 */
446
-	public function getMemoryCachingState($id, $group = 'default',
447
-									$doNotTestCacheValidity = false)
446
+	public function getMemoryCachingState($id, $group='default',
447
+									$doNotTestCacheValidity=false)
448 448
 	{
449
-		if ($this->_caching) {
450
-			if ($data = $this->get($id, $group, $doNotTestCacheValidity))
449
+		if($this->_caching) {
450
+			if($data=$this->get($id, $group, $doNotTestCacheValidity))
451 451
 			{
452
-				$array = unserialize($data);
453
-				$this->_memoryCachingCounter = $array['counter'];
454
-				$this->_memoryCachingArray = $array['array'];
452
+				$array=unserialize($data);
453
+				$this->_memoryCachingCounter=$array['counter'];
454
+				$this->_memoryCachingArray=$array['array'];
455 455
 			}
456 456
 		}
457 457
 	}
@@ -491,12 +491,12 @@  discard block
 block discarded – undo
491 491
 	 */
492 492
 	public function _memoryCacheAdd($id, $data)
493 493
 	{
494
-		$this->_memoryCachingArray[$this->_file] = $data;
495
-		if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
496
-			list($key, $value) = each($this->_memoryCachingArray);
494
+		$this->_memoryCachingArray[$this->_file]=$data;
495
+		if($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
496
+			list($key, $value)=each($this->_memoryCachingArray);
497 497
 			unset($this->_memoryCachingArray[$key]);
498 498
 		} else {
499
-			$this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
499
+			$this->_memoryCachingCounter=$this->_memoryCachingCounter + 1;
500 500
 		}
501 501
 	}
502 502
 
@@ -509,11 +509,11 @@  discard block
 block discarded – undo
509 509
 	 */
510 510
 	public function _setFileName($id, $group)
511 511
 	{
512
-		if ($this->_fileNameProtection) {
513
-			$this->_file = ($this->_cacheDir . 'cache_' . md5($group) . '_'
512
+		if($this->_fileNameProtection) {
513
+			$this->_file=($this->_cacheDir.'cache_'.md5($group).'_'
514 514
 									. md5($id));
515 515
 		} else {
516
-			$this->_file = $this->_cacheDir . 'cache_' . $group . '_' . $id;
516
+			$this->_file=$this->_cacheDir.'cache_'.$group.'_'.$id;
517 517
 		}
518 518
 	}
519 519
 
@@ -530,22 +530,22 @@  discard block
 block discarded – undo
530 530
 	 */
531 531
 	public function _read()
532 532
 	{
533
-		$fp = @fopen($this->_file, "rb");
534
-		if ($this->_fileLocking) @flock($fp, LOCK_SH);
535
-		if ($fp) {
533
+		$fp=@fopen($this->_file, "rb");
534
+		if($this->_fileLocking) @flock($fp, LOCK_SH);
535
+		if($fp) {
536 536
 			// because the filesize can be cached by PHP itself...
537 537
 			clearstatcache();
538
-			$length = @filesize($this->_file);
539
-			if ($this->_readControl) {
540
-				$hashControl = @fread($fp, 32);
541
-				$length = $length - 32;
538
+			$length=@filesize($this->_file);
539
+			if($this->_readControl) {
540
+				$hashControl=@fread($fp, 32);
541
+				$length=$length - 32;
542 542
 			}
543
-			$data = @fread($fp, $length);
544
-			if ($this->_fileLocking) @flock($fp, LOCK_UN);
543
+			$data=@fread($fp, $length);
544
+			if($this->_fileLocking) @flock($fp, LOCK_UN);
545 545
 			@fclose($fp);
546
-			if ($this->_readControl) {
547
-				$hashData = $this->_hash($data, $this->_readControlType);
548
-				if ($hashData != $hashControl) {
546
+			if($this->_readControl) {
547
+				$hashData=$this->_hash($data, $this->_readControlType);
548
+				if($hashData!=$hashControl) {
549 549
 					@touch($this->_file, time() - 2 * abs($this->_lifeTime));
550 550
 					return false;
551 551
 				}
@@ -565,15 +565,15 @@  discard block
 block discarded – undo
565 565
 	 */
566 566
 	public function _write($data)
567 567
 	{
568
-		$fp = @fopen($this->_file, "wb");
569
-		if ($fp) {
570
-			if ($this->_fileLocking) @flock($fp, LOCK_EX);
571
-			if ($this->_readControl) {
568
+		$fp=@fopen($this->_file, "wb");
569
+		if($fp) {
570
+			if($this->_fileLocking) @flock($fp, LOCK_EX);
571
+			if($this->_readControl) {
572 572
 				@fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
573 573
 			}
574
-			$len = strlen($data);
574
+			$len=strlen($data);
575 575
 			@fwrite($fp, $data, $len);
576
-			if ($this->_fileLocking) @flock($fp, LOCK_UN);
576
+			if($this->_fileLocking) @flock($fp, LOCK_UN);
577 577
 			@fclose($fp);
578 578
 			return true;
579 579
 		}
@@ -592,8 +592,8 @@  discard block
 block discarded – undo
592 592
 	public function _writeAndControl($data)
593 593
 	{
594 594
 		$this->_write($data);
595
-		$dataRead = $this->_read($data);
596
-		return ($dataRead == $data);
595
+		$dataRead=$this->_read($data);
596
+		return ($dataRead==$data);
597 597
 	}
598 598
 
599 599
 	/**
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 	 */
607 607
 	public function _hash($data, $controlType)
608 608
 	{
609
-		switch ($controlType) {
609
+		switch($controlType) {
610 610
 		case 'md5':
611 611
 			return md5($data);
612 612
 		case 'crc32':
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 		case 'strlen':
615 615
 			return sprintf('% 32d', strlen($data));
616 616
 		default:
617
-			$this->raiseError('Unknown controlType ! ' .
617
+			$this->raiseError('Unknown controlType ! '.
618 618
 			'(available values are only \'md5\', \'crc32\', \'strlen\')', -5);
619 619
 		}
620 620
 	}
Please login to merge, or discard this patch.