Completed
Push — master ( 9528ad...369c90 )
by Michael
03:33
created
class/wideimage/Operation/Crop.php 2 patches
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
 				$left = 0;
52 52
 			}
53 53
 			
54
-			if ($width > $img->getWidth() - $left)
55
-				$width = $img->getWidth() - $left;
54
+			if ($width > $img->getWidth() - $left) {
55
+							$width = $img->getWidth() - $left;
56
+			}
56 57
 			
57 58
 			if ($top < 0)
58 59
 			{
@@ -60,8 +61,9 @@  discard block
 block discarded – undo
60 61
 				$top = 0;
61 62
 			}
62 63
 			
63
-			if ($height > $img->getHeight() - $top)
64
-				$height = $img->getHeight() - $top;
64
+			if ($height > $img->getHeight() - $top) {
65
+							$height = $img->getHeight() - $top;
66
+			}
65 67
 			
66 68
 			$new = $img->doCreate($width, $height);
67 69
 			
@@ -71,8 +73,7 @@  discard block
 block discarded – undo
71 73
 				imagecopyresized(
72 74
 					$new->getHandle(), $img->getHandle(), 0, 0, $left, $top, $width, $height, $width, $height
73 75
 					);
74
-			}
75
-			else
76
+			} else
76 77
 			{
77 78
 				$new->alphaBlending(false);
78 79
 				$new->saveAlpha(true);
Please login to merge, or discard this patch.
Indentation   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	/**
3
- * @author Gasper Kozak
4
- * @copyright 2007, 2008, 2009
3
+	 * @author Gasper Kozak
4
+	 * @copyright 2007, 2008, 2009
5 5
 
6 6
     This file is part of WideImage.
7 7
 		
@@ -18,9 +18,8 @@  discard block
 block discarded – undo
18 18
     You should have received a copy of the GNU Lesser General Public License
19 19
     along with WideImage; if not, write to the Free Software
20 20
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21
-
22
-    * @package Internal/Operations
23
-  **/
21
+	 * @package Internal/Operations
22
+	 **/
24 23
 	
25 24
 	/**
26 25
 	 * An Exception for when an invalid fit method is passed
Please login to merge, or discard this patch.
class/wideimage/Operation/Rotate.php 2 patches
Braces   +16 added lines, -13 removed lines patch added patch discarded remove patch
@@ -41,32 +41,35 @@
 block discarded – undo
41 41
 		function execute($image, $angle, $bgColor, $ignoreTransparent)
42 42
 		{
43 43
 			$angle = -floatval($angle);
44
-			if ($angle < 0)
45
-				$angle = 360 + $angle;
44
+			if ($angle < 0) {
45
+							$angle = 360 + $angle;
46
+			}
46 47
 			$angle = $angle % 360;
47 48
 			
48
-			if ($angle == 0)
49
-				return $image->copy();
49
+			if ($angle == 0) {
50
+							return $image->copy();
51
+			}
50 52
 			
51 53
 			if ($bgColor === null)
52 54
 			{
53
-				if ($image->isTransparent())
54
-					$bgColor = $image->getTransparentColor();
55
-				else
55
+				if ($image->isTransparent()) {
56
+									$bgColor = $image->getTransparentColor();
57
+				} else
56 58
 				{
57 59
 					$tc = array('red' => 255, 'green' => 255, 'blue' => 255, 'alpha' => 127);
58 60
 					
59 61
 					if ($image->isTrueColor())
60 62
 					{
61 63
 						$bgColor = $image->getExactColorAlpha($tc);
62
-						if ($bgColor == -1)
63
-							$bgColor = $image->allocateColorAlpha($tc);
64
-					}
65
-					else
64
+						if ($bgColor == -1) {
65
+													$bgColor = $image->allocateColorAlpha($tc);
66
+						}
67
+					} else
66 68
 					{
67 69
 						$bgColor = $image->getExactColor($tc);
68
-						if ($bgColor == -1)
69
-							$bgColor = $image->allocateColor($tc);
70
+						if ($bgColor == -1) {
71
+													$bgColor = $image->allocateColor($tc);
72
+						}
70 73
 					}
71 74
 				}
72 75
 			}
Please login to merge, or discard this patch.
Indentation   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	/**
3
- * @author Gasper Kozak
4
- * @copyright 2007, 2008, 2009
3
+	 * @author Gasper Kozak
4
+	 * @copyright 2007, 2008, 2009
5 5
 
6 6
     This file is part of WideImage.
7 7
 		
@@ -18,9 +18,8 @@  discard block
 block discarded – undo
18 18
     You should have received a copy of the GNU Lesser General Public License
19 19
     along with WideImage; if not, write to the Free Software
20 20
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21
-
22
-    * @package Internal/Operations
23
-  **/
21
+	 * @package Internal/Operations
22
+	 **/
24 23
 	
25 24
 	/**
26 25
 	 * An Exception for when an invalid fit method is passed
Please login to merge, or discard this patch.
class/wideimage/Operation/Resize.php 2 patches
Indentation   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	/**
3
- * @author Gasper Kozak
4
- * @copyright 2007, 2008, 2009
3
+	 * @author Gasper Kozak
4
+	 * @copyright 2007, 2008, 2009
5 5
 
6 6
     This file is part of WideImage.
7 7
 		
@@ -18,9 +18,8 @@  discard block
 block discarded – undo
18 18
     You should have received a copy of the GNU Lesser General Public License
19 19
     along with WideImage; if not, write to the Free Software
20 20
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21
-
22
-    * @package Internal/Operations
23
-  **/
21
+	 * @package Internal/Operations
22
+	 **/
24 23
 	
25 24
 	/**
26 25
 	 * An Exception for when an invalid fit method is passed
Please login to merge, or discard this patch.
Braces   +21 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,33 +54,35 @@  discard block
 block discarded – undo
54 54
 		protected function prepareDimensions($img, $width, $height, $fit)
55 55
 		{
56 56
 			list($width, $height) = WideImage_Coordinate::fixForResize($img, $width, $height);
57
-			if ($width === 0 || $height === 0)
58
-				return array('width' => 0, 'height' => 0);
57
+			if ($width === 0 || $height === 0) {
58
+							return array('width' => 0, 'height' => 0);
59
+			}
59 60
 			
60
-			if ($fit == null)
61
-				$fit = 'inside';
61
+			if ($fit == null) {
62
+							$fit = 'inside';
63
+			}
62 64
 			
63 65
 			$dim = array();
64 66
 			if ($fit == 'fill')
65 67
 			{
66 68
 				$dim['width'] = $width;
67 69
 				$dim['height'] = $height;
68
-			}
69
-			elseif ($fit == 'inside' || $fit == 'outside')
70
+			} elseif ($fit == 'inside' || $fit == 'outside')
70 71
 			{
71 72
 				$rx = $img->getWidth() / $width;
72 73
 				$ry = $img->getHeight() / $height;
73 74
 				
74
-				if ($fit == 'inside')
75
-					$ratio = ($rx > $ry) ? $rx : $ry;
76
-				else
77
-					$ratio = ($rx < $ry) ? $rx : $ry;
75
+				if ($fit == 'inside') {
76
+									$ratio = ($rx > $ry) ? $rx : $ry;
77
+				} else {
78
+									$ratio = ($rx < $ry) ? $rx : $ry;
79
+				}
78 80
 				
79 81
 				$dim['width'] = round($img->getWidth() / $ratio);
80 82
 				$dim['height'] = round($img->getHeight() / $ratio);
83
+			} else {
84
+							throw new WideImage_Operation_InvalidFitMethodException("{$fit} is not a valid resize-fit method.");
81 85
 			}
82
-			else
83
-				throw new WideImage_Operation_InvalidFitMethodException("{$fit} is not a valid resize-fit method.");
84 86
 			
85 87
 			return $dim;
86 88
 		}
@@ -99,11 +101,13 @@  discard block
 block discarded – undo
99 101
 		{
100 102
 			$dim = $this->prepareDimensions($img, $width, $height, $fit);
101 103
 			if (($scale === 'down' && ($dim['width'] >= $img->getWidth() && $dim['height'] >= $img->getHeight())) ||
102
-				($scale === 'up' && ($dim['width'] <= $img->getWidth() && $dim['height'] <= $img->getHeight())))
103
-				$dim = array('width' => $img->getWidth(), 'height' => $img->getHeight());
104
+				($scale === 'up' && ($dim['width'] <= $img->getWidth() && $dim['height'] <= $img->getHeight()))) {
105
+							$dim = array('width' => $img->getWidth(), 'height' => $img->getHeight());
106
+			}
104 107
 			
105
-			if ($dim['width'] <= 0 || $dim['height'] <= 0)
106
-				throw new WideImage_Operation_InvalidResizeDimensionException("Both dimensions must be larger than 0.");
108
+			if ($dim['width'] <= 0 || $dim['height'] <= 0) {
109
+							throw new WideImage_Operation_InvalidResizeDimensionException("Both dimensions must be larger than 0.");
110
+			}
107 111
 			
108 112
 			$new = WideImage_TrueColorImage::create($dim['width'], $dim['height']);
109 113
 			
@@ -119,8 +123,7 @@  discard block
 block discarded – undo
119 123
 						$img->getWidth(), 
120 124
 						$img->getHeight()
121 125
 					);
122
-			}
123
-			else
126
+			} else
124 127
 			{
125 128
 				$new->alphaBlending(false);
126 129
 				$new->saveAlpha(true);
Please login to merge, or discard this patch.
class/lite.php 4 patches
Indentation   +791 added lines, -791 removed lines patch added patch discarded remove patch
@@ -29,798 +29,798 @@
 block discarded – undo
29 29
 class references_Cache_Lite
30 30
 {
31 31
 
32
-    // --- Private properties ---
33
-
34
-    /**
35
-    * Directory where to put the cache files
36
-    * (make sure to add a trailing slash)
37
-    *
38
-    * @var string $_cacheDir
39
-    */
40
-    public $_cacheDir = '/tmp/';
41
-
42
-    /**
43
-    * Enable / disable caching
44
-    *
45
-    * (can be very usefull for the debug of cached scripts)
46
-    *
47
-    * @var boolean $_caching
48
-    */
49
-    public $_caching = true;
50
-
51
-    /**
52
-    * Cache lifetime (in seconds)
53
-    *
54
-    * If null, the cache is valid forever.
55
-    *
56
-    * @var int $_lifeTime
57
-    */
58
-    public $_lifeTime = 3600;
59
-
60
-    /**
61
-    * Enable / disable fileLocking
62
-    *
63
-    * (can avoid cache corruption under bad circumstances)
64
-    *
65
-    * @var boolean $_fileLocking
66
-    */
67
-    public $_fileLocking = true;
68
-
69
-    /**
70
-    * Timestamp of the last valid cache
71
-    *
72
-    * @var int $_refreshTime
73
-    */
74
-    public $_refreshTime;
75
-
76
-    /**
77
-    * File name (with path)
78
-    *
79
-    * @var string $_file
80
-    */
81
-    public $_file;
82
-
83
-    /**
84
-    * File name (without path)
85
-    *
86
-    * @var string $_fileName
87
-    */
88
-    public $_fileName;
89
-
90
-    /**
91
-    * Enable / disable write control (the cache is read just after writing to detect corrupt entries)
92
-    *
93
-    * Enable write control will lightly slow the cache writing but not the cache reading
94
-    * Write control can detect some corrupt cache files but maybe it's not a perfect control
95
-    *
96
-    * @var boolean $_writeControl
97
-    */
98
-    public $_writeControl = true;
99
-
100
-    /**
101
-    * Enable / disable read control
102
-    *
103
-    * If enabled, a control key is embeded in cache file and this key is compared with the one
104
-    * calculated after the reading.
105
-    *
106
-    * @var boolean $_writeControl
107
-    */
108
-    public $_readControl = true;
109
-
110
-    /**
111
-    * Type of read control (only if read control is enabled)
112
-    *
113
-    * Available values are :
114
-    * 'md5' for a md5 hash control (best but slowest)
115
-    * 'crc32' for a crc32 hash control (lightly less safe but faster, better choice)
116
-    * 'strlen' for a length only test (fastest)
117
-    *
118
-    * @var boolean $_readControlType
119
-    */
120
-    public $_readControlType = 'crc32';
121
-
122
-    /**
123
-    * Pear error mode (when raiseError is called)
124
-    *
125
-    * (see PEAR doc)
126
-    *
127
-    * @see setToDebug()
128
-    * @var int $_pearErrorMode
129
-    */
130
-    public $_pearErrorMode = REFERENCES_CACHE_LITE_ERROR_RETURN;
131
-
132
-    /**
133
-    * Current cache id
134
-    *
135
-    * @var string $_id
136
-    */
137
-    public $_id;
138
-
139
-    /**
140
-    * Current cache group
141
-    *
142
-    * @var string $_group
143
-    */
144
-    public $_group;
145
-
146
-    /**
147
-    * Enable / Disable "Memory Caching"
148
-    *
149
-    * NB : There is no lifetime for memory caching !
150
-    *
151
-    * @var boolean $_memoryCaching
152
-    */
153
-    public $_memoryCaching = false;
154
-
155
-    /**
156
-    * Enable / Disable "Only Memory Caching"
157
-    * (be carefull, memory caching is "beta quality")
158
-    *
159
-    * @var boolean $_onlyMemoryCaching
160
-    */
161
-    public $_onlyMemoryCaching = false;
162
-
163
-    /**
164
-    * Memory caching array
165
-    *
166
-    * @var array $_memoryCachingArray
167
-    */
168
-    public $_memoryCachingArray = array();
169
-
170
-    /**
171
-    * Memory caching counter
172
-    *
173
-    * @var int $memoryCachingCounter
174
-    */
175
-    public $_memoryCachingCounter = 0;
176
-
177
-    /**
178
-    * Memory caching limit
179
-    *
180
-    * @var int $memoryCachingLimit
181
-    */
182
-    public $_memoryCachingLimit = 1000;
183
-
184
-    /**
185
-    * File Name protection
186
-    *
187
-    * if set to true, you can use any cache id or group name
188
-    * if set to false, it can be faster but cache ids and group names
189
-    * will be used directly in cache file names so be carefull with
190
-    * special characters...
191
-    *
192
-    * @var boolean $fileNameProtection
193
-    */
194
-    public $_fileNameProtection = true;
195
-
196
-    /**
197
-    * Enable / disable automatic serialization
198
-    *
199
-    * it can be used to save directly datas which aren't strings
200
-    * (but it's slower)
201
-    *
202
-    * @var boolean $_serialize
203
-    */
204
-    public $_automaticSerialization = false;
205
-
206
-    /**
207
-    * Disable / Tune the automatic cleaning process
208
-    *
209
-    * The automatic cleaning process destroy too old (for the given life time)
210
-    * cache files when a new cache file is written.
211
-    * 0               => no automatic cache cleaning
212
-    * 1               => systematic cache cleaning
213
-    * x (integer) > 1 => automatic cleaning randomly 1 times on x cache write
214
-    *
215
-    * @var int $_automaticCleaning
216
-    */
217
-    public $_automaticCleaningFactor = 0;
218
-
219
-    /**
220
-    * Nested directory level
221
-    *
222
-    * Set the hashed directory structure level. 0 means "no hashed directory
223
-    * structure", 1 means "one level of directory", 2 means "two levels"...
224
-    * This option can speed up Cache_Lite only when you have many thousands of
225
-    * cache file. Only specific benchs can help you to choose the perfect value
226
-    * for you. Maybe, 1 or 2 is a good start.
227
-    *
228
-    * @var int $_hashedDirectoryLevel
229
-    */
230
-    public $_hashedDirectoryLevel = 0;
231
-
232
-    /**
233
-    * Umask for hashed directory structure
234
-    *
235
-    * @var int $_hashedDirectoryUmask
236
-    */
237
-    public $_hashedDirectoryUmask = 0700;
238
-
239
-    /**
240
-     * API break for error handling in REFERENCES_CACHE_LITE_ERROR_RETURN mode
241
-     *
242
-     * In REFERENCES_CACHE_LITE_ERROR_RETURN mode, error handling was not good because
243
-     * for example save() method always returned a boolean (a PEAR_Error object
244
-     * would be better in REFERENCES_CACHE_LITE_ERROR_RETURN mode). To correct this without
245
-     * breaking the API, this option (false by default) can change this handling.
246
-     *
247
-     * @var boolean
248
-     */
249
-    public $_errorHandlingAPIBreak = false;
250
-
251
-    // --- Public methods ---
252
-
253
-    /**
254
-    * Constructor
255
-    *
256
-    * $options is an assoc. Available options are :
257
-    * $options = array(
258
-    *     'cacheDir' => directory where to put the cache files (string),
259
-    *     'caching' => enable / disable caching (boolean),
260
-    *     'lifeTime' => cache lifetime in seconds (int),
261
-    *     'fileLocking' => enable / disable fileLocking (boolean),
262
-    *     'writeControl' => enable / disable write control (boolean),
263
-    *     'readControl' => enable / disable read control (boolean),
264
-    *     'readControlType' => type of read control 'crc32', 'md5', 'strlen' (string),
265
-    *     'pearErrorMode' => pear error mode (when raiseError is called) (cf PEAR doc) (int),
266
-    *     'memoryCaching' => enable / disable memory caching (boolean),
267
-    *     'onlyMemoryCaching' => enable / disable only memory caching (boolean),
268
-    *     'memoryCachingLimit' => max nbr of records to store into memory caching (int),
269
-    *     'fileNameProtection' => enable / disable automatic file name protection (boolean),
270
-    *     'automaticSerialization' => enable / disable automatic serialization (boolean),
271
-    *     'automaticCleaningFactor' => distable / tune automatic cleaning process (int),
272
-    *     'hashedDirectoryLevel' => level of the hashed directory system (int),
273
-    *     'hashedDirectoryUmask' => umask for hashed directory structure (int),
274
-    *     'errorHandlingAPIBreak' => API break for better error handling ? (boolean)
275
-    * );
276
-    *
277
-    * @param array $options options
278
-    * @access public
279
-    */
280
-    function __construct($options = array(NULL))
281
-    {
282
-        foreach($options as $key => $value) {
283
-            $this->setOption($key, $value);
284
-        }
285
-    }
286
-
287
-    /**
288
-    * Generic way to set a Cache_Lite option
289
-    *
290
-    * see Cache_Lite constructor for available options
291
-    *
292
-    * @var string $name name of the option
293
-    * @var mixed $value value of the option
294
-    * @access public
295
-    */
296
-    function setOption($name, $value)
297
-    {
298
-        $availableOptions = array('errorHandlingAPIBreak', 'hashedDirectoryUmask', 'hashedDirectoryLevel', 'automaticCleaningFactor', 'automaticSerialization', 'fileNameProtection', 'memoryCaching', 'onlyMemoryCaching', 'memoryCachingLimit', 'cacheDir', 'caching', 'lifeTime', 'fileLocking', 'writeControl', 'readControl', 'readControlType', 'pearErrorMode');
299
-        if (in_array($name, $availableOptions)) {
300
-            $property = '_'.$name;
301
-            $this->$property = $value;
302
-        }
303
-    }
304
-
305
-    /**
306
-    * Test if a cache is available and (if yes) return it
307
-    *
308
-    * @param string $id cache id
309
-    * @param string $group name of the cache group
310
-    * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
311
-    * @return string data of the cache (else : false)
312
-    * @access public
313
-    */
314
-    function get($id, $group = 'default', $doNotTestCacheValidity = false)
315
-    {
316
-        $this->_id = $id;
317
-        $this->_group = $group;
318
-        $data = false;
319
-        if ($this->_caching) {
320
-            $this->_setRefreshTime();
321
-            $this->_setFileName($id, $group);
322
-            clearstatcache();
323
-            if ($this->_memoryCaching) {
324
-                if (isset($this->_memoryCachingArray[$this->_file])) {
325
-                    if ($this->_automaticSerialization) {
326
-                        return unserialize($this->_memoryCachingArray[$this->_file]);
327
-                    }
328
-                    return $this->_memoryCachingArray[$this->_file];
329
-                }
330
-                if ($this->_onlyMemoryCaching) {
331
-                    return false;
332
-                }
333
-            }
334
-            if (($doNotTestCacheValidity) || (is_null($this->_refreshTime))) {
335
-                if (file_exists($this->_file)) {
336
-                    $data = $this->_read();
337
-                }
338
-            } else {
339
-                if ((file_exists($this->_file)) && (@filemtime($this->_file) > $this->_refreshTime)) {
340
-                    $data = $this->_read();
341
-                }
342
-            }
343
-            if (($data) and ($this->_memoryCaching)) {
344
-                $this->_memoryCacheAdd($data);
345
-            }
346
-            if (($this->_automaticSerialization) and (is_string($data))) {
347
-                $data = unserialize($data);
348
-            }
349
-            return $data;
350
-        }
351
-        return false;
352
-    }
353
-
354
-    /**
355
-    * Save some data in a cache file
356
-    *
357
-    * @param string $data data to put in cache (can be another type than strings if automaticSerialization is on)
358
-    * @param string $id cache id
359
-    * @param string $group name of the cache group
360
-    * @return boolean true if no problem (else : false or a PEAR_Error object)
361
-    * @access public
362
-    */
363
-    function save($data, $id = NULL, $group = 'default')
364
-    {
365
-        if ($this->_caching) {
366
-            if ($this->_automaticSerialization) {
367
-                $data = serialize($data);
368
-            }
369
-            if (isset($id)) {
370
-                $this->_setFileName($id, $group);
371
-            }
372
-            if ($this->_memoryCaching) {
373
-                $this->_memoryCacheAdd($data);
374
-                if ($this->_onlyMemoryCaching) {
375
-                    return true;
376
-                }
377
-            }
378
-            if ($this->_automaticCleaningFactor>0 && ($this->_automaticCleaningFactor==1 || mt_rand(1, $this->_automaticCleaningFactor)==1)) {
379
-                    $this->clean(false, 'old');
380
-                }
381
-            if ($this->_writeControl) {
382
-                $res = $this->_writeAndControl($data);
383
-                if (is_bool($res)) {
384
-                    if ($res) {
385
-                        return true;
386
-                    }
387
-                    // if $res if false, we need to invalidate the cache
388
-                    @touch($this->_file, time() - 2*abs($this->_lifeTime));
389
-                    return false;
390
-                }
391
-            } else {
392
-                $res = $this->_write($data);
393
-            }
394
-            if (is_object($res)) {
395
-	        	// $res is a PEAR_Error object
396
-                if (!($this->_errorHandlingAPIBreak)) {
397
-	                return false; // we return false (old API)
398
-	            }
399
-	        }
400
-            return $res;
401
-        }
402
-        return false;
403
-    }
404
-
405
-    /**
406
-    * Remove a cache file
407
-    *
408
-    * @param string $id cache id
409
-    * @param string $group name of the cache group
410
-    * @param boolean $checkbeforeunlink check if file exists before removing it
411
-    * @return boolean true if no problem
412
-    * @access public
413
-    */
414
-    function remove($id, $group = 'default', $checkbeforeunlink = false)
415
-    {
416
-        $this->_setFileName($id, $group);
417
-        if ($this->_memoryCaching) {
418
-            if (isset($this->_memoryCachingArray[$this->_file])) {
419
-                unset($this->_memoryCachingArray[$this->_file]);
420
-                $this->_memoryCachingCounter = $this->_memoryCachingCounter - 1;
421
-            }
422
-            if ($this->_onlyMemoryCaching) {
423
-                return true;
424
-            }
425
-        }
426
-        if ( $checkbeforeunlink ) {
427
-            if (!file_exists($this->_file)) return true;
428
-        }
429
-        return $this->_unlink($this->_file);
430
-    }
431
-
432
-    /**
433
-    * Clean the cache
434
-    *
435
-    * if no group is specified all cache files will be destroyed
436
-    * else only cache files of the specified group will be destroyed
437
-    *
438
-    * @param string $group name of the cache group
439
-    * @param string $mode flush cache mode : 'old', 'ingroup', 'notingroup',
440
-    *                                        'callback_myFunction'
441
-    * @return boolean true if no problem
442
-    * @access public
443
-    */
444
-    function clean($group = false, $mode = 'ingroup')
445
-    {
446
-        return $this->_cleanDir($this->_cacheDir, $group, $mode);
447
-    }
448
-
449
-    /**
450
-    * Set to debug mode
451
-    *
452
-    * When an error is found, the script will stop and the message will be displayed
453
-    * (in debug mode only).
454
-    *
455
-    * @access public
456
-    */
457
-    function setToDebug()
458
-    {
459
-        $this->setOption('pearErrorMode', REFERENCES_CACHE_LITE_ERROR_DIE);
460
-    }
461
-
462
-    /**
463
-    * Set a new life time
464
-    *
465
-    * @param int $newLifeTime new life time (in seconds)
466
-    * @access public
467
-    */
468
-    function setLifeTime($newLifeTime)
469
-    {
470
-        $this->_lifeTime = $newLifeTime;
471
-        $this->_setRefreshTime();
472
-    }
473
-
474
-    /**
475
-    * Save the state of the caching memory array into a cache file cache
476
-    *
477
-    * @param string $id cache id
478
-    * @param string $group name of the cache group
479
-    * @access public
480
-    */
481
-    function saveMemoryCachingState($id, $group = 'default')
482
-    {
483
-        if ($this->_caching) {
484
-            $array = array(
485
-                'counter' => $this->_memoryCachingCounter,
486
-                'array' => $this->_memoryCachingArray
487
-            );
488
-            $data = serialize($array);
489
-            $this->save($data, $id, $group);
490
-        }
491
-    }
492
-
493
-    /**
494
-    * Load the state of the caching memory array from a given cache file cache
495
-    *
496
-    * @param string $id cache id
497
-    * @param string $group name of the cache group
498
-    * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
499
-    * @access public
500
-    */
501
-    function getMemoryCachingState($id, $group = 'default', $doNotTestCacheValidity = false)
502
-    {
503
-        if ($this->_caching) {
504
-            if ($data = $this->get($id, $group, $doNotTestCacheValidity)) {
505
-                $array = unserialize($data);
506
-                $this->_memoryCachingCounter = $array['counter'];
507
-                $this->_memoryCachingArray = $array['array'];
508
-            }
509
-        }
510
-    }
511
-
512
-    /**
513
-    * Return the cache last modification time
514
-    *
515
-    * BE CAREFUL : THIS METHOD IS FOR HACKING ONLY !
516
-    *
517
-    * @return int last modification time
518
-    */
519
-    function lastModified()
520
-    {
521
-        return @filemtime($this->_file);
522
-    }
523
-
524
-    /**
525
-    * Trigger a PEAR error
526
-    *
527
-    * To improve performances, the PEAR.php file is included dynamically.
528
-    * The file is so included only when an error is triggered. So, in most
529
-    * cases, the file isn't included and perfs are much better.
530
-    *
531
-    * @param string $msg error message
532
-    * @param int $code error code
533
-    * @access public
534
-    */
535
-    function raiseError($msg, $code)
536
-    {
537
-        include_once('PEAR.php');
538
-        return references_PEAR::raiseError($msg, $code, $this->_pearErrorMode);
539
-    }
540
-
541
-    /**
542
-     * Extend the life of a valid cache file
543
-     *
544
-     * see http://pear.php.net/bugs/bug.php?id=6681
545
-     *
546
-     * @access public
547
-     */
548
-    function extendLife()
549
-    {
550
-        @touch($this->_file);
551
-    }
552
-
553
-    // --- Private methods ---
554
-
555
-    /**
556
-    * Compute & set the refresh time
557
-    *
558
-    * @access private
559
-    */
560
-    function _setRefreshTime()
561
-    {
562
-        if (is_null($this->_lifeTime)) {
563
-            $this->_refreshTime = null;
564
-        } else {
565
-            $this->_refreshTime = time() - $this->_lifeTime;
566
-        }
567
-    }
568
-
569
-    /**
570
-    * Remove a file
571
-    *
572
-    * @param string $file complete file path and name
573
-    * @return boolean true if no problem
574
-    * @access private
575
-    */
576
-    function _unlink($file)
577
-    {
578
-        if (!@unlink($file)) {
579
-            return $this->raiseError('Cache_Lite : Unable to remove cache !', -3);
580
-        }
581
-        return true;
582
-    }
583
-
584
-    /**
585
-    * Recursive function for cleaning cache file in the given directory
586
-    *
587
-    * @param string $dir directory complete path (with a trailing slash)
588
-    * @param string $group name of the cache group
589
-    * @param string $mode flush cache mode : 'old', 'ingroup', 'notingroup',
32
+	// --- Private properties ---
33
+
34
+	/**
35
+	 * Directory where to put the cache files
36
+	 * (make sure to add a trailing slash)
37
+	 *
38
+	 * @var string $_cacheDir
39
+	 */
40
+	public $_cacheDir = '/tmp/';
41
+
42
+	/**
43
+	 * Enable / disable caching
44
+	 *
45
+	 * (can be very usefull for the debug of cached scripts)
46
+	 *
47
+	 * @var boolean $_caching
48
+	 */
49
+	public $_caching = true;
50
+
51
+	/**
52
+	 * Cache lifetime (in seconds)
53
+	 *
54
+	 * If null, the cache is valid forever.
55
+	 *
56
+	 * @var int $_lifeTime
57
+	 */
58
+	public $_lifeTime = 3600;
59
+
60
+	/**
61
+	 * Enable / disable fileLocking
62
+	 *
63
+	 * (can avoid cache corruption under bad circumstances)
64
+	 *
65
+	 * @var boolean $_fileLocking
66
+	 */
67
+	public $_fileLocking = true;
68
+
69
+	/**
70
+	 * Timestamp of the last valid cache
71
+	 *
72
+	 * @var int $_refreshTime
73
+	 */
74
+	public $_refreshTime;
75
+
76
+	/**
77
+	 * File name (with path)
78
+	 *
79
+	 * @var string $_file
80
+	 */
81
+	public $_file;
82
+
83
+	/**
84
+	 * File name (without path)
85
+	 *
86
+	 * @var string $_fileName
87
+	 */
88
+	public $_fileName;
89
+
90
+	/**
91
+	 * Enable / disable write control (the cache is read just after writing to detect corrupt entries)
92
+	 *
93
+	 * Enable write control will lightly slow the cache writing but not the cache reading
94
+	 * Write control can detect some corrupt cache files but maybe it's not a perfect control
95
+	 *
96
+	 * @var boolean $_writeControl
97
+	 */
98
+	public $_writeControl = true;
99
+
100
+	/**
101
+	 * Enable / disable read control
102
+	 *
103
+	 * If enabled, a control key is embeded in cache file and this key is compared with the one
104
+	 * calculated after the reading.
105
+	 *
106
+	 * @var boolean $_writeControl
107
+	 */
108
+	public $_readControl = true;
109
+
110
+	/**
111
+	 * Type of read control (only if read control is enabled)
112
+	 *
113
+	 * Available values are :
114
+	 * 'md5' for a md5 hash control (best but slowest)
115
+	 * 'crc32' for a crc32 hash control (lightly less safe but faster, better choice)
116
+	 * 'strlen' for a length only test (fastest)
117
+	 *
118
+	 * @var boolean $_readControlType
119
+	 */
120
+	public $_readControlType = 'crc32';
121
+
122
+	/**
123
+	 * Pear error mode (when raiseError is called)
124
+	 *
125
+	 * (see PEAR doc)
126
+	 *
127
+	 * @see setToDebug()
128
+	 * @var int $_pearErrorMode
129
+	 */
130
+	public $_pearErrorMode = REFERENCES_CACHE_LITE_ERROR_RETURN;
131
+
132
+	/**
133
+	 * Current cache id
134
+	 *
135
+	 * @var string $_id
136
+	 */
137
+	public $_id;
138
+
139
+	/**
140
+	 * Current cache group
141
+	 *
142
+	 * @var string $_group
143
+	 */
144
+	public $_group;
145
+
146
+	/**
147
+	 * Enable / Disable "Memory Caching"
148
+	 *
149
+	 * NB : There is no lifetime for memory caching !
150
+	 *
151
+	 * @var boolean $_memoryCaching
152
+	 */
153
+	public $_memoryCaching = false;
154
+
155
+	/**
156
+	 * Enable / Disable "Only Memory Caching"
157
+	 * (be carefull, memory caching is "beta quality")
158
+	 *
159
+	 * @var boolean $_onlyMemoryCaching
160
+	 */
161
+	public $_onlyMemoryCaching = false;
162
+
163
+	/**
164
+	 * Memory caching array
165
+	 *
166
+	 * @var array $_memoryCachingArray
167
+	 */
168
+	public $_memoryCachingArray = array();
169
+
170
+	/**
171
+	 * Memory caching counter
172
+	 *
173
+	 * @var int $memoryCachingCounter
174
+	 */
175
+	public $_memoryCachingCounter = 0;
176
+
177
+	/**
178
+	 * Memory caching limit
179
+	 *
180
+	 * @var int $memoryCachingLimit
181
+	 */
182
+	public $_memoryCachingLimit = 1000;
183
+
184
+	/**
185
+	 * File Name protection
186
+	 *
187
+	 * if set to true, you can use any cache id or group name
188
+	 * if set to false, it can be faster but cache ids and group names
189
+	 * will be used directly in cache file names so be carefull with
190
+	 * special characters...
191
+	 *
192
+	 * @var boolean $fileNameProtection
193
+	 */
194
+	public $_fileNameProtection = true;
195
+
196
+	/**
197
+	 * Enable / disable automatic serialization
198
+	 *
199
+	 * it can be used to save directly datas which aren't strings
200
+	 * (but it's slower)
201
+	 *
202
+	 * @var boolean $_serialize
203
+	 */
204
+	public $_automaticSerialization = false;
205
+
206
+	/**
207
+	 * Disable / Tune the automatic cleaning process
208
+	 *
209
+	 * The automatic cleaning process destroy too old (for the given life time)
210
+	 * cache files when a new cache file is written.
211
+	 * 0               => no automatic cache cleaning
212
+	 * 1               => systematic cache cleaning
213
+	 * x (integer) > 1 => automatic cleaning randomly 1 times on x cache write
214
+	 *
215
+	 * @var int $_automaticCleaning
216
+	 */
217
+	public $_automaticCleaningFactor = 0;
218
+
219
+	/**
220
+	 * Nested directory level
221
+	 *
222
+	 * Set the hashed directory structure level. 0 means "no hashed directory
223
+	 * structure", 1 means "one level of directory", 2 means "two levels"...
224
+	 * This option can speed up Cache_Lite only when you have many thousands of
225
+	 * cache file. Only specific benchs can help you to choose the perfect value
226
+	 * for you. Maybe, 1 or 2 is a good start.
227
+	 *
228
+	 * @var int $_hashedDirectoryLevel
229
+	 */
230
+	public $_hashedDirectoryLevel = 0;
231
+
232
+	/**
233
+	 * Umask for hashed directory structure
234
+	 *
235
+	 * @var int $_hashedDirectoryUmask
236
+	 */
237
+	public $_hashedDirectoryUmask = 0700;
238
+
239
+	/**
240
+	 * API break for error handling in REFERENCES_CACHE_LITE_ERROR_RETURN mode
241
+	 *
242
+	 * In REFERENCES_CACHE_LITE_ERROR_RETURN mode, error handling was not good because
243
+	 * for example save() method always returned a boolean (a PEAR_Error object
244
+	 * would be better in REFERENCES_CACHE_LITE_ERROR_RETURN mode). To correct this without
245
+	 * breaking the API, this option (false by default) can change this handling.
246
+	 *
247
+	 * @var boolean
248
+	 */
249
+	public $_errorHandlingAPIBreak = false;
250
+
251
+	// --- Public methods ---
252
+
253
+	/**
254
+	 * Constructor
255
+	 *
256
+	 * $options is an assoc. Available options are :
257
+	 * $options = array(
258
+	 *     'cacheDir' => directory where to put the cache files (string),
259
+	 *     'caching' => enable / disable caching (boolean),
260
+	 *     'lifeTime' => cache lifetime in seconds (int),
261
+	 *     'fileLocking' => enable / disable fileLocking (boolean),
262
+	 *     'writeControl' => enable / disable write control (boolean),
263
+	 *     'readControl' => enable / disable read control (boolean),
264
+	 *     'readControlType' => type of read control 'crc32', 'md5', 'strlen' (string),
265
+	 *     'pearErrorMode' => pear error mode (when raiseError is called) (cf PEAR doc) (int),
266
+	 *     'memoryCaching' => enable / disable memory caching (boolean),
267
+	 *     'onlyMemoryCaching' => enable / disable only memory caching (boolean),
268
+	 *     'memoryCachingLimit' => max nbr of records to store into memory caching (int),
269
+	 *     'fileNameProtection' => enable / disable automatic file name protection (boolean),
270
+	 *     'automaticSerialization' => enable / disable automatic serialization (boolean),
271
+	 *     'automaticCleaningFactor' => distable / tune automatic cleaning process (int),
272
+	 *     'hashedDirectoryLevel' => level of the hashed directory system (int),
273
+	 *     'hashedDirectoryUmask' => umask for hashed directory structure (int),
274
+	 *     'errorHandlingAPIBreak' => API break for better error handling ? (boolean)
275
+	 * );
276
+	 *
277
+	 * @param array $options options
278
+	 * @access public
279
+	 */
280
+	function __construct($options = array(NULL))
281
+	{
282
+		foreach($options as $key => $value) {
283
+			$this->setOption($key, $value);
284
+		}
285
+	}
286
+
287
+	/**
288
+	 * Generic way to set a Cache_Lite option
289
+	 *
290
+	 * see Cache_Lite constructor for available options
291
+	 *
292
+	 * @var string $name name of the option
293
+	 * @var mixed $value value of the option
294
+	 * @access public
295
+	 */
296
+	function setOption($name, $value)
297
+	{
298
+		$availableOptions = array('errorHandlingAPIBreak', 'hashedDirectoryUmask', 'hashedDirectoryLevel', 'automaticCleaningFactor', 'automaticSerialization', 'fileNameProtection', 'memoryCaching', 'onlyMemoryCaching', 'memoryCachingLimit', 'cacheDir', 'caching', 'lifeTime', 'fileLocking', 'writeControl', 'readControl', 'readControlType', 'pearErrorMode');
299
+		if (in_array($name, $availableOptions)) {
300
+			$property = '_'.$name;
301
+			$this->$property = $value;
302
+		}
303
+	}
304
+
305
+	/**
306
+	 * Test if a cache is available and (if yes) return it
307
+	 *
308
+	 * @param string $id cache id
309
+	 * @param string $group name of the cache group
310
+	 * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
311
+	 * @return string data of the cache (else : false)
312
+	 * @access public
313
+	 */
314
+	function get($id, $group = 'default', $doNotTestCacheValidity = false)
315
+	{
316
+		$this->_id = $id;
317
+		$this->_group = $group;
318
+		$data = false;
319
+		if ($this->_caching) {
320
+			$this->_setRefreshTime();
321
+			$this->_setFileName($id, $group);
322
+			clearstatcache();
323
+			if ($this->_memoryCaching) {
324
+				if (isset($this->_memoryCachingArray[$this->_file])) {
325
+					if ($this->_automaticSerialization) {
326
+						return unserialize($this->_memoryCachingArray[$this->_file]);
327
+					}
328
+					return $this->_memoryCachingArray[$this->_file];
329
+				}
330
+				if ($this->_onlyMemoryCaching) {
331
+					return false;
332
+				}
333
+			}
334
+			if (($doNotTestCacheValidity) || (is_null($this->_refreshTime))) {
335
+				if (file_exists($this->_file)) {
336
+					$data = $this->_read();
337
+				}
338
+			} else {
339
+				if ((file_exists($this->_file)) && (@filemtime($this->_file) > $this->_refreshTime)) {
340
+					$data = $this->_read();
341
+				}
342
+			}
343
+			if (($data) and ($this->_memoryCaching)) {
344
+				$this->_memoryCacheAdd($data);
345
+			}
346
+			if (($this->_automaticSerialization) and (is_string($data))) {
347
+				$data = unserialize($data);
348
+			}
349
+			return $data;
350
+		}
351
+		return false;
352
+	}
353
+
354
+	/**
355
+	 * Save some data in a cache file
356
+	 *
357
+	 * @param string $data data to put in cache (can be another type than strings if automaticSerialization is on)
358
+	 * @param string $id cache id
359
+	 * @param string $group name of the cache group
360
+	 * @return boolean true if no problem (else : false or a PEAR_Error object)
361
+	 * @access public
362
+	 */
363
+	function save($data, $id = NULL, $group = 'default')
364
+	{
365
+		if ($this->_caching) {
366
+			if ($this->_automaticSerialization) {
367
+				$data = serialize($data);
368
+			}
369
+			if (isset($id)) {
370
+				$this->_setFileName($id, $group);
371
+			}
372
+			if ($this->_memoryCaching) {
373
+				$this->_memoryCacheAdd($data);
374
+				if ($this->_onlyMemoryCaching) {
375
+					return true;
376
+				}
377
+			}
378
+			if ($this->_automaticCleaningFactor>0 && ($this->_automaticCleaningFactor==1 || mt_rand(1, $this->_automaticCleaningFactor)==1)) {
379
+					$this->clean(false, 'old');
380
+				}
381
+			if ($this->_writeControl) {
382
+				$res = $this->_writeAndControl($data);
383
+				if (is_bool($res)) {
384
+					if ($res) {
385
+						return true;
386
+					}
387
+					// if $res if false, we need to invalidate the cache
388
+					@touch($this->_file, time() - 2*abs($this->_lifeTime));
389
+					return false;
390
+				}
391
+			} else {
392
+				$res = $this->_write($data);
393
+			}
394
+			if (is_object($res)) {
395
+				// $res is a PEAR_Error object
396
+				if (!($this->_errorHandlingAPIBreak)) {
397
+					return false; // we return false (old API)
398
+				}
399
+			}
400
+			return $res;
401
+		}
402
+		return false;
403
+	}
404
+
405
+	/**
406
+	 * Remove a cache file
407
+	 *
408
+	 * @param string $id cache id
409
+	 * @param string $group name of the cache group
410
+	 * @param boolean $checkbeforeunlink check if file exists before removing it
411
+	 * @return boolean true if no problem
412
+	 * @access public
413
+	 */
414
+	function remove($id, $group = 'default', $checkbeforeunlink = false)
415
+	{
416
+		$this->_setFileName($id, $group);
417
+		if ($this->_memoryCaching) {
418
+			if (isset($this->_memoryCachingArray[$this->_file])) {
419
+				unset($this->_memoryCachingArray[$this->_file]);
420
+				$this->_memoryCachingCounter = $this->_memoryCachingCounter - 1;
421
+			}
422
+			if ($this->_onlyMemoryCaching) {
423
+				return true;
424
+			}
425
+		}
426
+		if ( $checkbeforeunlink ) {
427
+			if (!file_exists($this->_file)) return true;
428
+		}
429
+		return $this->_unlink($this->_file);
430
+	}
431
+
432
+	/**
433
+	 * Clean the cache
434
+	 *
435
+	 * if no group is specified all cache files will be destroyed
436
+	 * else only cache files of the specified group will be destroyed
437
+	 *
438
+	 * @param string $group name of the cache group
439
+	 * @param string $mode flush cache mode : 'old', 'ingroup', 'notingroup',
440
+	 *                                        'callback_myFunction'
441
+	 * @return boolean true if no problem
442
+	 * @access public
443
+	 */
444
+	function clean($group = false, $mode = 'ingroup')
445
+	{
446
+		return $this->_cleanDir($this->_cacheDir, $group, $mode);
447
+	}
448
+
449
+	/**
450
+	 * Set to debug mode
451
+	 *
452
+	 * When an error is found, the script will stop and the message will be displayed
453
+	 * (in debug mode only).
454
+	 *
455
+	 * @access public
456
+	 */
457
+	function setToDebug()
458
+	{
459
+		$this->setOption('pearErrorMode', REFERENCES_CACHE_LITE_ERROR_DIE);
460
+	}
461
+
462
+	/**
463
+	 * Set a new life time
464
+	 *
465
+	 * @param int $newLifeTime new life time (in seconds)
466
+	 * @access public
467
+	 */
468
+	function setLifeTime($newLifeTime)
469
+	{
470
+		$this->_lifeTime = $newLifeTime;
471
+		$this->_setRefreshTime();
472
+	}
473
+
474
+	/**
475
+	 * Save the state of the caching memory array into a cache file cache
476
+	 *
477
+	 * @param string $id cache id
478
+	 * @param string $group name of the cache group
479
+	 * @access public
480
+	 */
481
+	function saveMemoryCachingState($id, $group = 'default')
482
+	{
483
+		if ($this->_caching) {
484
+			$array = array(
485
+				'counter' => $this->_memoryCachingCounter,
486
+				'array' => $this->_memoryCachingArray
487
+			);
488
+			$data = serialize($array);
489
+			$this->save($data, $id, $group);
490
+		}
491
+	}
492
+
493
+	/**
494
+	 * Load the state of the caching memory array from a given cache file cache
495
+	 *
496
+	 * @param string $id cache id
497
+	 * @param string $group name of the cache group
498
+	 * @param boolean $doNotTestCacheValidity if set to true, the cache validity won't be tested
499
+	 * @access public
500
+	 */
501
+	function getMemoryCachingState($id, $group = 'default', $doNotTestCacheValidity = false)
502
+	{
503
+		if ($this->_caching) {
504
+			if ($data = $this->get($id, $group, $doNotTestCacheValidity)) {
505
+				$array = unserialize($data);
506
+				$this->_memoryCachingCounter = $array['counter'];
507
+				$this->_memoryCachingArray = $array['array'];
508
+			}
509
+		}
510
+	}
511
+
512
+	/**
513
+	 * Return the cache last modification time
514
+	 *
515
+	 * BE CAREFUL : THIS METHOD IS FOR HACKING ONLY !
516
+	 *
517
+	 * @return int last modification time
518
+	 */
519
+	function lastModified()
520
+	{
521
+		return @filemtime($this->_file);
522
+	}
523
+
524
+	/**
525
+	 * Trigger a PEAR error
526
+	 *
527
+	 * To improve performances, the PEAR.php file is included dynamically.
528
+	 * The file is so included only when an error is triggered. So, in most
529
+	 * cases, the file isn't included and perfs are much better.
530
+	 *
531
+	 * @param string $msg error message
532
+	 * @param int $code error code
533
+	 * @access public
534
+	 */
535
+	function raiseError($msg, $code)
536
+	{
537
+		include_once('PEAR.php');
538
+		return references_PEAR::raiseError($msg, $code, $this->_pearErrorMode);
539
+	}
540
+
541
+	/**
542
+	 * Extend the life of a valid cache file
543
+	 *
544
+	 * see http://pear.php.net/bugs/bug.php?id=6681
545
+	 *
546
+	 * @access public
547
+	 */
548
+	function extendLife()
549
+	{
550
+		@touch($this->_file);
551
+	}
552
+
553
+	// --- Private methods ---
554
+
555
+	/**
556
+	 * Compute & set the refresh time
557
+	 *
558
+	 * @access private
559
+	 */
560
+	function _setRefreshTime()
561
+	{
562
+		if (is_null($this->_lifeTime)) {
563
+			$this->_refreshTime = null;
564
+		} else {
565
+			$this->_refreshTime = time() - $this->_lifeTime;
566
+		}
567
+	}
568
+
569
+	/**
570
+	 * Remove a file
571
+	 *
572
+	 * @param string $file complete file path and name
573
+	 * @return boolean true if no problem
574
+	 * @access private
575
+	 */
576
+	function _unlink($file)
577
+	{
578
+		if (!@unlink($file)) {
579
+			return $this->raiseError('Cache_Lite : Unable to remove cache !', -3);
580
+		}
581
+		return true;
582
+	}
583
+
584
+	/**
585
+	 * Recursive function for cleaning cache file in the given directory
586
+	 *
587
+	 * @param string $dir directory complete path (with a trailing slash)
588
+	 * @param string $group name of the cache group
589
+	 * @param string $mode flush cache mode : 'old', 'ingroup', 'notingroup',
590 590
                                              'callback_myFunction'
591
-    * @return boolean true if no problem
592
-    * @access private
593
-    */
594
-    function _cleanDir($dir, $group = false, $mode = 'ingroup')
595
-    {
596
-        if ($this->_fileNameProtection) {
597
-            $motif = ($group) ? 'cache_'.md5($group).'_' : 'cache_';
598
-        } else {
599
-            $motif = ($group) ? 'cache_'.$group.'_' : 'cache_';
600
-        }
601
-        if ($this->_memoryCaching) {
602
-	    foreach($this->_memoryCachingArray as $key => $v) {
603
-                if (strpos($key, $motif) !== false) {
604
-                    unset($this->_memoryCachingArray[$key]);
605
-                    $this->_memoryCachingCounter = $this->_memoryCachingCounter - 1;
606
-                }
607
-            }
608
-            if ($this->_onlyMemoryCaching) {
609
-                return true;
610
-            }
611
-        }
612
-        if (!($dh = opendir($dir))) {
613
-            return $this->raiseError('Cache_Lite : Unable to open cache directory !', -4);
614
-        }
615
-        $result = true;
616
-        while ($file = readdir($dh)) {
617
-            if (($file != '.') && ($file != '..')) {
618
-                if (substr($file, 0, 6)=='cache_') {
619
-                    $file2 = $dir . $file;
620
-                    if (is_file($file2)) {
621
-                        switch (substr($mode, 0, 9)) {
622
-                            case 'old':
623
-                                // files older than lifeTime get deleted from cache
624
-                                if (!is_null($this->_lifeTime)) {
625
-                                    if ((time() - @filemtime($file2)) > $this->_lifeTime) {
626
-                                        $result = ($result and ($this->_unlink($file2)));
627
-                                    }
628
-                                }
629
-                                break;
630
-                            case 'notingrou':
631
-                                if (strpos($file2, $motif) === false) {
632
-                                    $result = ($result and ($this->_unlink($file2)));
633
-                                }
634
-                                break;
635
-                            case 'callback_':
636
-                                $func = substr($mode, 9, strlen($mode) - 9);
637
-                                if ($func($file2, $group)) {
638
-                                    $result = ($result and ($this->_unlink($file2)));
639
-                                }
640
-                                break;
641
-                            case 'ingroup':
642
-                            default:
643
-                                if (strpos($file2, $motif) !== false) {
644
-                                    $result = ($result and ($this->_unlink($file2)));
645
-                                }
646
-                                break;
647
-                        }
648
-                    }
649
-                    if ((is_dir($file2)) and ($this->_hashedDirectoryLevel>0)) {
650
-                        $result = ($result and ($this->_cleanDir($file2 . '/', $group, $mode)));
651
-                    }
652
-                }
653
-            }
654
-        }
655
-        return $result;
656
-    }
657
-
658
-    /**
659
-    * Add some date in the memory caching array
660
-    *
661
-    * @param string $data data to cache
662
-    * @access private
663
-    */
664
-    function _memoryCacheAdd($data)
665
-    {
666
-        $this->_memoryCachingArray[$this->_file] = $data;
667
-        if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
668
-            list($key, ) = each($this->_memoryCachingArray);
669
-            unset($this->_memoryCachingArray[$key]);
670
-        } else {
671
-            $this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
672
-        }
673
-    }
674
-
675
-    /**
676
-    * Make a file name (with path)
677
-    *
678
-    * @param string $id cache id
679
-    * @param string $group name of the group
680
-    * @access private
681
-    */
682
-    function _setFileName($id, $group)
683
-    {
684
-
685
-        if ($this->_fileNameProtection) {
686
-            $suffix = 'cache_'.md5($group).'_'.md5($id);
687
-        } else {
688
-            $suffix = 'cache_'.$group.'_'.$id;
689
-        }
690
-        $root = $this->_cacheDir;
691
-        if ($this->_hashedDirectoryLevel>0) {
692
-            $hash = md5($suffix);
693
-            for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
694
-                $root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
695
-            }
696
-        }
697
-        $this->_fileName = $suffix;
698
-        $this->_file = $root.$suffix;
699
-    }
700
-
701
-    /**
702
-    * Read the cache file and return the content
703
-    *
704
-    * @return string content of the cache file (else : false or a PEAR_Error object)
705
-    * @access private
706
-    */
707
-    function _read()
708
-    {
709
-        $fp = @fopen($this->_file, "rb");
710
-        if ($this->_fileLocking) @flock($fp, LOCK_SH);
711
-        if ($fp) {
712
-            clearstatcache();
713
-            $length = @filesize($this->_file);
714
-            $mqr = get_magic_quotes_runtime();
715
-            @set_magic_quotes_runtime(0);
716
-            if ($this->_readControl) {
717
-                $hashControl = @fread($fp, 32);
718
-                $length = $length - 32;
719
-            }
720
-            if ($length) {
721
-                $data = @fread($fp, $length);
722
-            } else {
723
-                $data = '';
724
-            }
725
-            @set_magic_quotes_runtime($mqr);
726
-            if ($this->_fileLocking) @flock($fp, LOCK_UN);
727
-            @fclose($fp);
728
-            if ($this->_readControl) {
729
-                $hashData = $this->_hash($data, $this->_readControlType);
730
-                if ($hashData != $hashControl) {
731
-                    if (!(is_null($this->_lifeTime))) {
732
-                        @touch($this->_file, time() - 2*abs($this->_lifeTime));
733
-                    } else {
734
-                        @unlink($this->_file);
735
-                    }
736
-                    return false;
737
-                }
738
-            }
739
-            return $data;
740
-        }
741
-        return $this->raiseError('Cache_Lite : Unable to read cache !', -2);
742
-    }
743
-
744
-    /**
745
-    * Write the given data in the cache file
746
-    *
747
-    * @param string $data data to put in cache
748
-    * @return boolean true if ok (a PEAR_Error object else)
749
-    * @access private
750
-    */
751
-    function _write($data)
752
-    {
753
-        if ($this->_hashedDirectoryLevel > 0) {
754
-            $hash = md5($this->_fileName);
755
-            $root = $this->_cacheDir;
756
-            for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
757
-                $root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
758
-                if (!(@is_dir($root))) {
759
-                    @mkdir($root, $this->_hashedDirectoryUmask);
760
-                }
761
-            }
762
-        }
763
-        $fp = @fopen($this->_file, "wb");
764
-        if ($fp) {
765
-            if ($this->_fileLocking) @flock($fp, LOCK_EX);
766
-            if ($this->_readControl) {
767
-                @fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
768
-            }
769
-            $mqr = get_magic_quotes_runtime();
770
-            @set_magic_quotes_runtime(0);
771
-            @fwrite($fp, $data);
772
-            @set_magic_quotes_runtime($mqr);
773
-            if ($this->_fileLocking) @flock($fp, LOCK_UN);
774
-            @fclose($fp);
775
-            return true;
776
-        }
777
-        return $this->raiseError('Cache_Lite : Unable to write cache file : '.$this->_file, -1);
778
-    }
779
-
780
-    /**
781
-    * Write the given data in the cache file and control it just after to avoir corrupted cache entries
782
-    *
783
-    * @param string $data data to put in cache
784
-    * @return boolean true if the test is ok (else : false or a PEAR_Error object)
785
-    * @access private
786
-    */
787
-    function _writeAndControl($data)
788
-    {
789
-        $result = $this->_write($data);
790
-        if (is_object($result)) {
791
-            return $result; # We return the PEAR_Error object
792
-        }
793
-        $dataRead = $this->_read();
794
-        if (is_object($dataRead)) {
795
-            return $dataRead; # We return the PEAR_Error object
796
-        }
797
-        if ((is_bool($dataRead)) && (!$dataRead)) {
798
-            return false;
799
-        }
800
-        return ($dataRead==$data);
801
-    }
802
-
803
-    /**
804
-    * Make a control key with the string containing datas
805
-    *
806
-    * @param string $data data
807
-    * @param string $controlType type of control 'md5', 'crc32' or 'strlen'
808
-    * @return string control key
809
-    * @access private
810
-    */
811
-    function _hash($data, $controlType)
812
-    {
813
-        switch ($controlType) {
814
-        case 'md5':
815
-            return md5($data);
816
-        case 'crc32':
817
-            return sprintf('% 32d', crc32($data));
818
-        case 'strlen':
819
-            return sprintf('% 32d', strlen($data));
820
-        default:
821
-            return $this->raiseError('Unknown controlType ! (available values are only \'md5\', \'crc32\', \'strlen\')', -5);
822
-        }
823
-    }
591
+	 * @return boolean true if no problem
592
+	 * @access private
593
+	 */
594
+	function _cleanDir($dir, $group = false, $mode = 'ingroup')
595
+	{
596
+		if ($this->_fileNameProtection) {
597
+			$motif = ($group) ? 'cache_'.md5($group).'_' : 'cache_';
598
+		} else {
599
+			$motif = ($group) ? 'cache_'.$group.'_' : 'cache_';
600
+		}
601
+		if ($this->_memoryCaching) {
602
+		foreach($this->_memoryCachingArray as $key => $v) {
603
+				if (strpos($key, $motif) !== false) {
604
+					unset($this->_memoryCachingArray[$key]);
605
+					$this->_memoryCachingCounter = $this->_memoryCachingCounter - 1;
606
+				}
607
+			}
608
+			if ($this->_onlyMemoryCaching) {
609
+				return true;
610
+			}
611
+		}
612
+		if (!($dh = opendir($dir))) {
613
+			return $this->raiseError('Cache_Lite : Unable to open cache directory !', -4);
614
+		}
615
+		$result = true;
616
+		while ($file = readdir($dh)) {
617
+			if (($file != '.') && ($file != '..')) {
618
+				if (substr($file, 0, 6)=='cache_') {
619
+					$file2 = $dir . $file;
620
+					if (is_file($file2)) {
621
+						switch (substr($mode, 0, 9)) {
622
+							case 'old':
623
+								// files older than lifeTime get deleted from cache
624
+								if (!is_null($this->_lifeTime)) {
625
+									if ((time() - @filemtime($file2)) > $this->_lifeTime) {
626
+										$result = ($result and ($this->_unlink($file2)));
627
+									}
628
+								}
629
+								break;
630
+							case 'notingrou':
631
+								if (strpos($file2, $motif) === false) {
632
+									$result = ($result and ($this->_unlink($file2)));
633
+								}
634
+								break;
635
+							case 'callback_':
636
+								$func = substr($mode, 9, strlen($mode) - 9);
637
+								if ($func($file2, $group)) {
638
+									$result = ($result and ($this->_unlink($file2)));
639
+								}
640
+								break;
641
+							case 'ingroup':
642
+							default:
643
+								if (strpos($file2, $motif) !== false) {
644
+									$result = ($result and ($this->_unlink($file2)));
645
+								}
646
+								break;
647
+						}
648
+					}
649
+					if ((is_dir($file2)) and ($this->_hashedDirectoryLevel>0)) {
650
+						$result = ($result and ($this->_cleanDir($file2 . '/', $group, $mode)));
651
+					}
652
+				}
653
+			}
654
+		}
655
+		return $result;
656
+	}
657
+
658
+	/**
659
+	 * Add some date in the memory caching array
660
+	 *
661
+	 * @param string $data data to cache
662
+	 * @access private
663
+	 */
664
+	function _memoryCacheAdd($data)
665
+	{
666
+		$this->_memoryCachingArray[$this->_file] = $data;
667
+		if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
668
+			list($key, ) = each($this->_memoryCachingArray);
669
+			unset($this->_memoryCachingArray[$key]);
670
+		} else {
671
+			$this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
672
+		}
673
+	}
674
+
675
+	/**
676
+	 * Make a file name (with path)
677
+	 *
678
+	 * @param string $id cache id
679
+	 * @param string $group name of the group
680
+	 * @access private
681
+	 */
682
+	function _setFileName($id, $group)
683
+	{
684
+
685
+		if ($this->_fileNameProtection) {
686
+			$suffix = 'cache_'.md5($group).'_'.md5($id);
687
+		} else {
688
+			$suffix = 'cache_'.$group.'_'.$id;
689
+		}
690
+		$root = $this->_cacheDir;
691
+		if ($this->_hashedDirectoryLevel>0) {
692
+			$hash = md5($suffix);
693
+			for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
694
+				$root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
695
+			}
696
+		}
697
+		$this->_fileName = $suffix;
698
+		$this->_file = $root.$suffix;
699
+	}
700
+
701
+	/**
702
+	 * Read the cache file and return the content
703
+	 *
704
+	 * @return string content of the cache file (else : false or a PEAR_Error object)
705
+	 * @access private
706
+	 */
707
+	function _read()
708
+	{
709
+		$fp = @fopen($this->_file, "rb");
710
+		if ($this->_fileLocking) @flock($fp, LOCK_SH);
711
+		if ($fp) {
712
+			clearstatcache();
713
+			$length = @filesize($this->_file);
714
+			$mqr = get_magic_quotes_runtime();
715
+			@set_magic_quotes_runtime(0);
716
+			if ($this->_readControl) {
717
+				$hashControl = @fread($fp, 32);
718
+				$length = $length - 32;
719
+			}
720
+			if ($length) {
721
+				$data = @fread($fp, $length);
722
+			} else {
723
+				$data = '';
724
+			}
725
+			@set_magic_quotes_runtime($mqr);
726
+			if ($this->_fileLocking) @flock($fp, LOCK_UN);
727
+			@fclose($fp);
728
+			if ($this->_readControl) {
729
+				$hashData = $this->_hash($data, $this->_readControlType);
730
+				if ($hashData != $hashControl) {
731
+					if (!(is_null($this->_lifeTime))) {
732
+						@touch($this->_file, time() - 2*abs($this->_lifeTime));
733
+					} else {
734
+						@unlink($this->_file);
735
+					}
736
+					return false;
737
+				}
738
+			}
739
+			return $data;
740
+		}
741
+		return $this->raiseError('Cache_Lite : Unable to read cache !', -2);
742
+	}
743
+
744
+	/**
745
+	 * Write the given data in the cache file
746
+	 *
747
+	 * @param string $data data to put in cache
748
+	 * @return boolean true if ok (a PEAR_Error object else)
749
+	 * @access private
750
+	 */
751
+	function _write($data)
752
+	{
753
+		if ($this->_hashedDirectoryLevel > 0) {
754
+			$hash = md5($this->_fileName);
755
+			$root = $this->_cacheDir;
756
+			for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
757
+				$root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
758
+				if (!(@is_dir($root))) {
759
+					@mkdir($root, $this->_hashedDirectoryUmask);
760
+				}
761
+			}
762
+		}
763
+		$fp = @fopen($this->_file, "wb");
764
+		if ($fp) {
765
+			if ($this->_fileLocking) @flock($fp, LOCK_EX);
766
+			if ($this->_readControl) {
767
+				@fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
768
+			}
769
+			$mqr = get_magic_quotes_runtime();
770
+			@set_magic_quotes_runtime(0);
771
+			@fwrite($fp, $data);
772
+			@set_magic_quotes_runtime($mqr);
773
+			if ($this->_fileLocking) @flock($fp, LOCK_UN);
774
+			@fclose($fp);
775
+			return true;
776
+		}
777
+		return $this->raiseError('Cache_Lite : Unable to write cache file : '.$this->_file, -1);
778
+	}
779
+
780
+	/**
781
+	 * Write the given data in the cache file and control it just after to avoir corrupted cache entries
782
+	 *
783
+	 * @param string $data data to put in cache
784
+	 * @return boolean true if the test is ok (else : false or a PEAR_Error object)
785
+	 * @access private
786
+	 */
787
+	function _writeAndControl($data)
788
+	{
789
+		$result = $this->_write($data);
790
+		if (is_object($result)) {
791
+			return $result; # We return the PEAR_Error object
792
+		}
793
+		$dataRead = $this->_read();
794
+		if (is_object($dataRead)) {
795
+			return $dataRead; # We return the PEAR_Error object
796
+		}
797
+		if ((is_bool($dataRead)) && (!$dataRead)) {
798
+			return false;
799
+		}
800
+		return ($dataRead==$data);
801
+	}
802
+
803
+	/**
804
+	 * Make a control key with the string containing datas
805
+	 *
806
+	 * @param string $data data
807
+	 * @param string $controlType type of control 'md5', 'crc32' or 'strlen'
808
+	 * @return string control key
809
+	 * @access private
810
+	 */
811
+	function _hash($data, $controlType)
812
+	{
813
+		switch ($controlType) {
814
+		case 'md5':
815
+			return md5($data);
816
+		case 'crc32':
817
+			return sprintf('% 32d', crc32($data));
818
+		case 'strlen':
819
+			return sprintf('% 32d', strlen($data));
820
+		default:
821
+			return $this->raiseError('Unknown controlType ! (available values are only \'md5\', \'crc32\', \'strlen\')', -5);
822
+		}
823
+	}
824 824
 
825 825
 }
826 826
 
Please login to merge, or discard this patch.
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -811,14 +811,14 @@
 block discarded – undo
811 811
     function _hash($data, $controlType)
812 812
     {
813 813
         switch ($controlType) {
814
-        case 'md5':
815
-            return md5($data);
816
-        case 'crc32':
817
-            return sprintf('% 32d', crc32($data));
818
-        case 'strlen':
819
-            return sprintf('% 32d', strlen($data));
820
-        default:
821
-            return $this->raiseError('Unknown controlType ! (available values are only \'md5\', \'crc32\', \'strlen\')', -5);
814
+        	case 'md5':
815
+            	return md5($data);
816
+        	case 'crc32':
817
+            	return sprintf('% 32d', crc32($data));
818
+        	case 'strlen':
819
+            	return sprintf('% 32d', strlen($data));
820
+        	default:
821
+            	return $this->raiseError('Unknown controlType ! (available values are only \'md5\', \'crc32\', \'strlen\')', -5);
822 822
         }
823 823
     }
824 824
 
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
     */
280 280
     function __construct($options = array(NULL))
281 281
     {
282
-        foreach($options as $key => $value) {
282
+        foreach ($options as $key => $value) {
283 283
             $this->setOption($key, $value);
284 284
         }
285 285
     }
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
                     return true;
376 376
                 }
377 377
             }
378
-            if ($this->_automaticCleaningFactor>0 && ($this->_automaticCleaningFactor==1 || mt_rand(1, $this->_automaticCleaningFactor)==1)) {
378
+            if ($this->_automaticCleaningFactor > 0 && ($this->_automaticCleaningFactor == 1 || mt_rand(1, $this->_automaticCleaningFactor) == 1)) {
379 379
                     $this->clean(false, 'old');
380 380
                 }
381 381
             if ($this->_writeControl) {
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                         return true;
386 386
                     }
387 387
                     // if $res if false, we need to invalidate the cache
388
-                    @touch($this->_file, time() - 2*abs($this->_lifeTime));
388
+                    @touch($this->_file, time() - 2 * abs($this->_lifeTime));
389 389
                     return false;
390 390
                 }
391 391
             } else {
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
                 return true;
424 424
             }
425 425
         }
426
-        if ( $checkbeforeunlink ) {
426
+        if ($checkbeforeunlink) {
427 427
             if (!file_exists($this->_file)) return true;
428 428
         }
429 429
         return $this->_unlink($this->_file);
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
             $motif = ($group) ? 'cache_'.$group.'_' : 'cache_';
600 600
         }
601 601
         if ($this->_memoryCaching) {
602
-	    foreach($this->_memoryCachingArray as $key => $v) {
602
+	    foreach ($this->_memoryCachingArray as $key => $v) {
603 603
                 if (strpos($key, $motif) !== false) {
604 604
                     unset($this->_memoryCachingArray[$key]);
605 605
                     $this->_memoryCachingCounter = $this->_memoryCachingCounter - 1;
@@ -615,8 +615,8 @@  discard block
 block discarded – undo
615 615
         $result = true;
616 616
         while ($file = readdir($dh)) {
617 617
             if (($file != '.') && ($file != '..')) {
618
-                if (substr($file, 0, 6)=='cache_') {
619
-                    $file2 = $dir . $file;
618
+                if (substr($file, 0, 6) == 'cache_') {
619
+                    $file2 = $dir.$file;
620 620
                     if (is_file($file2)) {
621 621
                         switch (substr($mode, 0, 9)) {
622 622
                             case 'old':
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
                                 break;
647 647
                         }
648 648
                     }
649
-                    if ((is_dir($file2)) and ($this->_hashedDirectoryLevel>0)) {
650
-                        $result = ($result and ($this->_cleanDir($file2 . '/', $group, $mode)));
649
+                    if ((is_dir($file2)) and ($this->_hashedDirectoryLevel > 0)) {
650
+                        $result = ($result and ($this->_cleanDir($file2.'/', $group, $mode)));
651 651
                     }
652 652
                 }
653 653
             }
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
     {
666 666
         $this->_memoryCachingArray[$this->_file] = $data;
667 667
         if ($this->_memoryCachingCounter >= $this->_memoryCachingLimit) {
668
-            list($key, ) = each($this->_memoryCachingArray);
668
+            list($key,) = each($this->_memoryCachingArray);
669 669
             unset($this->_memoryCachingArray[$key]);
670 670
         } else {
671 671
             $this->_memoryCachingCounter = $this->_memoryCachingCounter + 1;
@@ -688,10 +688,10 @@  discard block
 block discarded – undo
688 688
             $suffix = 'cache_'.$group.'_'.$id;
689 689
         }
690 690
         $root = $this->_cacheDir;
691
-        if ($this->_hashedDirectoryLevel>0) {
691
+        if ($this->_hashedDirectoryLevel > 0) {
692 692
             $hash = md5($suffix);
693
-            for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
694
-                $root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
693
+            for ($i = 0; $i < $this->_hashedDirectoryLevel; $i++) {
694
+                $root = $root.'cache_'.substr($hash, 0, $i + 1).'/';
695 695
             }
696 696
         }
697 697
         $this->_fileName = $suffix;
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
                 $hashData = $this->_hash($data, $this->_readControlType);
730 730
                 if ($hashData != $hashControl) {
731 731
                     if (!(is_null($this->_lifeTime))) {
732
-                        @touch($this->_file, time() - 2*abs($this->_lifeTime));
732
+                        @touch($this->_file, time() - 2 * abs($this->_lifeTime));
733 733
                     } else {
734 734
                         @unlink($this->_file);
735 735
                     }
@@ -753,8 +753,8 @@  discard block
 block discarded – undo
753 753
         if ($this->_hashedDirectoryLevel > 0) {
754 754
             $hash = md5($this->_fileName);
755 755
             $root = $this->_cacheDir;
756
-            for ($i=0 ; $i<$this->_hashedDirectoryLevel ; $i++) {
757
-                $root = $root . 'cache_' . substr($hash, 0, $i + 1) . '/';
756
+            for ($i = 0; $i < $this->_hashedDirectoryLevel; $i++) {
757
+                $root = $root.'cache_'.substr($hash, 0, $i + 1).'/';
758 758
                 if (!(@is_dir($root))) {
759 759
                     @mkdir($root, $this->_hashedDirectoryUmask);
760 760
                 }
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
         if ((is_bool($dataRead)) && (!$dataRead)) {
798 798
             return false;
799 799
         }
800
-        return ($dataRead==$data);
800
+        return ($dataRead == $data);
801 801
     }
802 802
 
803 803
     /**
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -424,7 +424,9 @@  discard block
 block discarded – undo
424 424
             }
425 425
         }
426 426
         if ( $checkbeforeunlink ) {
427
-            if (!file_exists($this->_file)) return true;
427
+            if (!file_exists($this->_file)) {
428
+            	return true;
429
+            }
428 430
         }
429 431
         return $this->_unlink($this->_file);
430 432
     }
@@ -707,7 +709,9 @@  discard block
 block discarded – undo
707 709
     function _read()
708 710
     {
709 711
         $fp = @fopen($this->_file, "rb");
710
-        if ($this->_fileLocking) @flock($fp, LOCK_SH);
712
+        if ($this->_fileLocking) {
713
+        	@flock($fp, LOCK_SH);
714
+        }
711 715
         if ($fp) {
712 716
             clearstatcache();
713 717
             $length = @filesize($this->_file);
@@ -723,7 +727,9 @@  discard block
 block discarded – undo
723 727
                 $data = '';
724 728
             }
725 729
             @set_magic_quotes_runtime($mqr);
726
-            if ($this->_fileLocking) @flock($fp, LOCK_UN);
730
+            if ($this->_fileLocking) {
731
+            	@flock($fp, LOCK_UN);
732
+            }
727 733
             @fclose($fp);
728 734
             if ($this->_readControl) {
729 735
                 $hashData = $this->_hash($data, $this->_readControlType);
@@ -762,7 +768,9 @@  discard block
 block discarded – undo
762 768
         }
763 769
         $fp = @fopen($this->_file, "wb");
764 770
         if ($fp) {
765
-            if ($this->_fileLocking) @flock($fp, LOCK_EX);
771
+            if ($this->_fileLocking) {
772
+            	@flock($fp, LOCK_EX);
773
+            }
766 774
             if ($this->_readControl) {
767 775
                 @fwrite($fp, $this->_hash($data, $this->_readControlType), 32);
768 776
             }
@@ -770,7 +778,9 @@  discard block
 block discarded – undo
770 778
             @set_magic_quotes_runtime(0);
771 779
             @fwrite($fp, $data);
772 780
             @set_magic_quotes_runtime($mqr);
773
-            if ($this->_fileLocking) @flock($fp, LOCK_UN);
781
+            if ($this->_fileLocking) {
782
+            	@flock($fp, LOCK_UN);
783
+            }
774 784
             @fclose($fp);
775 785
             return true;
776 786
         }
Please login to merge, or discard this patch.
plugins/actions/twitter/twitter.php 2 patches
Spacing   +265 added lines, -265 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function __destruct()
136 136
 	{
137
-		if($this->curl != null) curl_close($this->curl);
137
+		if ($this->curl != null) curl_close($this->curl);
138 138
 	}
139 139
 
140 140
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	private function buildQuery(array $parameters)
148 148
 	{
149 149
 		// no parameters?
150
-		if(empty($parameters)) return '';
150
+		if (empty($parameters)) return '';
151 151
 
152 152
 		// encode the keys
153 153
 		$keys = self::urlencode_rfc3986(array_keys($parameters));
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 		uksort($parameters, 'strcmp');
163 163
 
164 164
 		// loop parameters
165
-		foreach($parameters as $key => $value)
165
+		foreach ($parameters as $key => $value)
166 166
 		{
167 167
 			// sort by value
168
-			if(is_array($value)) $parameters[$key] = natsort($value);
168
+			if (is_array($value)) $parameters[$key] = natsort($value);
169 169
 		}
170 170
 
171 171
 		// process parameters
172
-		foreach($parameters as $key => $value) $chunks[] = $key .'='. str_replace('%25', '%', $value);
172
+		foreach ($parameters as $key => $value) $chunks[] = $key.'='.str_replace('%25', '%', $value);
173 173
 
174 174
 		// return
175 175
 		return implode('&', $chunks);
@@ -205,21 +205,21 @@  discard block
 block discarded – undo
205 205
 		uksort($parameters, 'strcmp');
206 206
 
207 207
 		// loop parameters
208
-		foreach($parameters as $key => $value)
208
+		foreach ($parameters as $key => $value)
209 209
 		{
210 210
 			// sort by value
211
-			if(is_array($value)) $parameters[$key] = natsort($value);
211
+			if (is_array($value)) $parameters[$key] = natsort($value);
212 212
 		}
213 213
 
214 214
 		// process queries
215
-		foreach($parameters as $key => $value)
215
+		foreach ($parameters as $key => $value)
216 216
 		{
217
-			$chunks[] = self::urlencode_rfc3986($key) .'%3D'. self::urlencode_rfc3986($value);
217
+			$chunks[] = self::urlencode_rfc3986($key).'%3D'.self::urlencode_rfc3986($value);
218 218
 		}
219 219
 
220 220
 		// buils base
221
-		$base = $method .'&';
222
-		$base .= urlencode($url) .'&';
221
+		$base = $method.'&';
222
+		$base .= urlencode($url).'&';
223 223
 		$base .= implode('%26', $chunks);
224 224
 
225 225
 		// return
@@ -246,10 +246,10 @@  discard block
 block discarded – undo
246 246
 		$chunks = array();
247 247
 
248 248
 		// process queries
249
-		foreach($parameters as $key => $value) $chunks[] = str_replace('%25', '%', self::urlencode_rfc3986($key) .'="'. self::urlencode_rfc3986($value) .'"');
249
+		foreach ($parameters as $key => $value) $chunks[] = str_replace('%25', '%', self::urlencode_rfc3986($key).'="'.self::urlencode_rfc3986($value).'"');
250 250
 
251 251
 		// build return
252
-		$return = 'Authorization: OAuth realm="' . $parts['scheme'] . '://' . $parts['host'] . $parts['path'] . '", ';
252
+		$return = 'Authorization: OAuth realm="'.$parts['scheme'].'://'.$parts['host'].$parts['path'].'", ';
253 253
 		$return .= implode(',', $chunks);
254 254
 
255 255
 		// prepend name and OAuth part
@@ -272,22 +272,22 @@  discard block
 block discarded – undo
272 272
 
273 273
 		// append default parameters
274 274
 		$parameters['oauth_consumer_key'] = $this->getConsumerKey();
275
-		$parameters['oauth_nonce'] = md5(microtime() . rand());
275
+		$parameters['oauth_nonce'] = md5(microtime().rand());
276 276
 		$parameters['oauth_timestamp'] = time();
277 277
 		$parameters['oauth_signature_method'] = 'HMAC-SHA1';
278 278
 		$parameters['oauth_version'] = '1.0';
279 279
 
280 280
 		// calculate the base string
281
-		$base = $this->calculateBaseString(self::SECURE_API_URL .'/oauth/'. $method, 'POST', $parameters);
281
+		$base = $this->calculateBaseString(self::SECURE_API_URL.'/oauth/'.$method, 'POST', $parameters);
282 282
 
283 283
 		// add sign into the parameters
284
-		$parameters['oauth_signature'] = $this->hmacsha1($this->getConsumerSecret() .'&' . $this->getOAuthTokenSecret(), $base);
284
+		$parameters['oauth_signature'] = $this->hmacsha1($this->getConsumerSecret().'&'.$this->getOAuthTokenSecret(), $base);
285 285
 
286 286
 		// calculate header
287
-		$header = $this->calculateHeader($parameters, self::SECURE_API_URL .'/oauth/'. $method);
287
+		$header = $this->calculateHeader($parameters, self::SECURE_API_URL.'/oauth/'.$method);
288 288
 
289 289
 		// set options
290
-		$options[CURLOPT_URL] = self::SECURE_API_URL .'/oauth/'. $method;
290
+		$options[CURLOPT_URL] = self::SECURE_API_URL.'/oauth/'.$method;
291 291
 		$options[CURLOPT_PORT] = self::SECURE_API_PORT;
292 292
 		$options[CURLOPT_USERAGENT] = $this->getUserAgent();
293 293
 		$options[CURLOPT_FOLLOWLOCATION] = true;
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 		$options[CURLOPT_POSTFIELDS] = $this->buildQuery($parameters);
301 301
 
302 302
 		// init
303
-		if($this->curl == null) $this->curl = curl_init();
303
+		if ($this->curl == null) $this->curl = curl_init();
304 304
 
305 305
 		// set options
306 306
 		curl_setopt_array($this->curl, $options);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		$errorMessage = curl_error($this->curl);
315 315
 
316 316
 		// error?
317
-		if($errorNumber != '') throw new TwitterException($errorMessage, $errorNumber);
317
+		if ($errorNumber != '') throw new TwitterException($errorMessage, $errorNumber);
318 318
 
319 319
 		// init var
320 320
 		$return = array();
@@ -349,11 +349,11 @@  discard block
 block discarded – undo
349 349
 		$expectJSON = (bool) $expectJSON;
350 350
 
351 351
 		// validate method
352
-		if(!in_array($method, $allowedMethods)) throw new TwitterException('Unknown method ('. $method .'). Allowed methods are: '. implode(', ', $allowedMethods));
352
+		if (!in_array($method, $allowedMethods)) throw new TwitterException('Unknown method ('.$method.'). Allowed methods are: '.implode(', ', $allowedMethods));
353 353
 
354 354
 		// append default parameters
355 355
 		$oauth['oauth_consumer_key'] = $this->getConsumerKey();
356
-		$oauth['oauth_nonce'] = md5(microtime() . rand());
356
+		$oauth['oauth_nonce'] = md5(microtime().rand());
357 357
 		$oauth['oauth_timestamp'] = time();
358 358
 		$oauth['oauth_token'] = $this->getOAuthToken();
359 359
 		$oauth['oauth_signature_method'] = 'HMAC-SHA1';
@@ -361,22 +361,22 @@  discard block
 block discarded – undo
361 361
 
362 362
 		// set data
363 363
 		$data = $oauth;
364
-		if(!empty($parameters)) $data = array_merge($data, $parameters);
364
+		if (!empty($parameters)) $data = array_merge($data, $parameters);
365 365
 
366 366
 		// calculate the base string
367
-		$base = $this->calculateBaseString(self::API_URL .'/'. $url, $method, $data);
367
+		$base = $this->calculateBaseString(self::API_URL.'/'.$url, $method, $data);
368 368
 
369 369
 		// add sign into the parameters
370
-		$oauth['oauth_signature'] = $this->hmacsha1($this->getConsumerSecret() .'&' . $this->getOAuthTokenSecret(), $base);
370
+		$oauth['oauth_signature'] = $this->hmacsha1($this->getConsumerSecret().'&'.$this->getOAuthTokenSecret(), $base);
371 371
 
372
-		$headers[] = $this->calculateHeader($oauth, self::API_URL .'/'. $url);
372
+		$headers[] = $this->calculateHeader($oauth, self::API_URL.'/'.$url);
373 373
 		$headers[] = 'Expect:';
374 374
 
375 375
 		// based on the method, we should handle the parameters in a different way
376
-		if($method == 'POST')
376
+		if ($method == 'POST')
377 377
 		{
378 378
 			// file provided?
379
-			if($filePath != null)
379
+			if ($filePath != null)
380 380
 			{
381 381
 				// build a boundary
382 382
 				$boundary = md5(time());
@@ -386,19 +386,19 @@  discard block
 block discarded – undo
386 386
 
387 387
 				// set mimeType
388 388
 				$mimeType = 'application/octet-stream';
389
-				if($fileInfo['extension'] == 'jpg' || $fileInfo['extension'] == 'jpeg') $mimeType = 'image/jpeg';
390
-				elseif($fileInfo['extension'] == 'gif') $mimeType = 'image/gif';
391
-				elseif($fileInfo['extension'] == 'png') $mimeType = 'image/png';
389
+				if ($fileInfo['extension'] == 'jpg' || $fileInfo['extension'] == 'jpeg') $mimeType = 'image/jpeg';
390
+				elseif ($fileInfo['extension'] == 'gif') $mimeType = 'image/gif';
391
+				elseif ($fileInfo['extension'] == 'png') $mimeType = 'image/png';
392 392
 
393 393
 				// init var
394
-				$content = '--'. $boundary ."\r\n";
394
+				$content = '--'.$boundary."\r\n";
395 395
 
396 396
 				// set file
397
-				$content = 'Content-Disposition: form-data; name="image";filename="'. $fileInfo['basename'] .'"' ."\r\n" . 'Content-Type: '. $mimeType . "\r\n\r\n" . file_get_contents($filePath) ."\r\n--". $boundary ."\r\n";
397
+				$content = 'Content-Disposition: form-data; name="image";filename="'.$fileInfo['basename'].'"'."\r\n".'Content-Type: '.$mimeType."\r\n\r\n".file_get_contents($filePath)."\r\n--".$boundary."\r\n";
398 398
 
399 399
 				// build headers
400
-				$headers[] = 'Content-Type: multipart/form-data; boundary=' . $boundary;
401
-				$headers[] = 'Content-Length: '. strlen($content);
400
+				$headers[] = 'Content-Type: multipart/form-data; boundary='.$boundary;
401
+				$headers[] = 'Content-Length: '.strlen($content);
402 402
 
403 403
 				// set content
404 404
 				$options[CURLOPT_POSTFIELDS] = $content;
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
 		else
415 415
 		{
416 416
 			// add the parameters into the querystring
417
-			if(!empty($parameters)) $url .= '?'. $this->buildQuery($parameters);
417
+			if (!empty($parameters)) $url .= '?'.$this->buildQuery($parameters);
418 418
 		}
419 419
 
420 420
 		// set options
421
-		$options[CURLOPT_URL] = self::API_URL .'/'. $url;
421
+		$options[CURLOPT_URL] = self::API_URL.'/'.$url;
422 422
 		$options[CURLOPT_PORT] = self::API_PORT;
423 423
 		$options[CURLOPT_USERAGENT] = $this->getUserAgent();
424 424
 		$options[CURLOPT_FOLLOWLOCATION] = true;
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 		$options[CURLOPT_HTTPHEADER] = $headers;
431 431
 
432 432
 		// init
433
-		if($this->curl == null) $this->curl = curl_init();
433
+		if ($this->curl == null) $this->curl = curl_init();
434 434
 
435 435
 		// set options
436 436
 		curl_setopt_array($this->curl, $options);
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 		$errorMessage = curl_error($this->curl);
445 445
 
446 446
 		// we don't expext JSON, return the response
447
-		if(!$expectJSON) return $response;
447
+		if (!$expectJSON) return $response;
448 448
 
449 449
 		// replace ids with their string values, added because of some PHP-version can't handle these large values
450 450
 		$response = preg_replace('/id":(\d+)/', 'id":"\1"', $response);
@@ -453,10 +453,10 @@  discard block
 block discarded – undo
453 453
 		$json = @json_decode($response, true);
454 454
 
455 455
 		// validate JSON
456
-		if($json === null)
456
+		if ($json === null)
457 457
 		{
458 458
 			// should we provide debug information
459
-			if(self::DEBUG)
459
+			if (self::DEBUG)
460 460
 			{
461 461
 				// make it output proper
462 462
 				echo '<pre>';
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
 
481 481
 
482 482
 		// any errors
483
-		if(isset($json['errors']))
483
+		if (isset($json['errors']))
484 484
 		{
485 485
 			// should we provide debug information
486
-			if(self::DEBUG)
486
+			if (self::DEBUG)
487 487
 			{
488 488
 				// make it output proper
489 489
 				echo '<pre>';
@@ -502,16 +502,16 @@  discard block
 block discarded – undo
502 502
 			}
503 503
 
504 504
 			// throw exception
505
-			if(isset($json['errors'][0]['message'])) throw new TwitterException($json['errors'][0]['message']);
505
+			if (isset($json['errors'][0]['message'])) throw new TwitterException($json['errors'][0]['message']);
506 506
 			else throw new TwitterException('Invalid response.');
507 507
 		}
508 508
 
509 509
 
510 510
 		// any error
511
-		if(isset($json['error']))
511
+		if (isset($json['error']))
512 512
 		{
513 513
 			// should we provide debug information
514
-			if(self::DEBUG)
514
+			if (self::DEBUG)
515 515
 			{
516 516
 				// make it output proper
517 517
 				echo '<pre>';
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 	 */
599 599
 	public function getUserAgent()
600 600
 	{
601
-		return (string) 'PHP Twitter/'. self::VERSION .' '. $this->userAgent;
601
+		return (string) 'PHP Twitter/'.self::VERSION.' '.$this->userAgent;
602 602
 	}
603 603
 
604 604
 
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 	 */
697 697
 	private static function urlencode_rfc3986($value)
698 698
 	{
699
-		if(is_array($value)) return array_map(array('Twitter', 'urlencode_rfc3986'), $value);
699
+		if (is_array($value)) return array_map(array('Twitter', 'urlencode_rfc3986'), $value);
700 700
 		else
701 701
 		{
702 702
 			$search = array('+', ' ', '%7E', '%');
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 
723 723
 		// build parameters
724 724
 		$parameters = array();
725
-		if($skipUser) $parameters['skip_user'] = 'true';
725
+		if ($skipUser) $parameters['skip_user'] = 'true';
726 726
 
727 727
 		// make the call
728 728
 		return (array) $this->doCall('statuses/public_timeline.json', $parameters);
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
 
747 747
 		// build parameters
748 748
 		$parameters = array();
749
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
750
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
751
-		if($count != null) $parameters['count'] = (int) $count;
752
-		if($page != null) $parameters['page'] = (int) $page;
753
-		if($skipUser) $parameters['skip_user'] = 'true';
749
+		if ($sinceId != null) $parameters['since_id'] = (string) $sinceId;
750
+		if ($maxId != null) $parameters['max_id'] = (string) $maxId;
751
+		if ($count != null) $parameters['count'] = (int) $count;
752
+		if ($page != null) $parameters['page'] = (int) $page;
753
+		if ($skipUser) $parameters['skip_user'] = 'true';
754 754
 
755 755
 		// make the call
756 756
 		return (array) $this->doCall('statuses/home_timeline.json', $parameters, true);
@@ -778,11 +778,11 @@  discard block
 block discarded – undo
778 778
 
779 779
 		// build parameters
780 780
 		$parameters = array();
781
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
782
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
783
-		if($count != null) $parameters['count'] = (int) $count;
784
-		if($page != null) $parameters['page'] = (int) $page;
785
-		if($skipUser) $parameters['skip_user'] = 'true';
781
+		if ($sinceId != null) $parameters['since_id'] = (string) $sinceId;
782
+		if ($maxId != null) $parameters['max_id'] = (string) $maxId;
783
+		if ($count != null) $parameters['count'] = (int) $count;
784
+		if ($page != null) $parameters['page'] = (int) $page;
785
+		if ($skipUser) $parameters['skip_user'] = 'true';
786 786
 
787 787
 		// make the call
788 788
 		return (array) $this->doCall('statuses/friends_timeline.json', $parameters, true);
@@ -813,14 +813,14 @@  discard block
 block discarded – undo
813 813
 
814 814
 		// build parameters
815 815
 		$parameters = array();
816
-		if($id != null) $parameters['id'] = (string) $id;
817
-		if($userId != null) $parameters['user_id'] = (string) $userId;
818
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
819
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
820
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
821
-		if($count != null) $parameters['count'] = (int) $count;
822
-		if($page != null) $parameters['page'] = (int) $page;
823
-		if($skipUser) $parameters['skip_user'] = 'true';
816
+		if ($id != null) $parameters['id'] = (string) $id;
817
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
818
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
819
+		if ($sinceId != null) $parameters['since_id'] = (string) $sinceId;
820
+		if ($maxId != null) $parameters['max_id'] = (string) $maxId;
821
+		if ($count != null) $parameters['count'] = (int) $count;
822
+		if ($page != null) $parameters['page'] = (int) $page;
823
+		if ($skipUser) $parameters['skip_user'] = 'true';
824 824
 
825 825
 		// make the call
826 826
 		return (array) $this->doCall('statuses/user_timeline.json', $parameters, true);
@@ -839,14 +839,14 @@  discard block
 block discarded – undo
839 839
 	public function statusesMentions($sinceId = null, $maxId = null, $count = null, $page = null)
840 840
 	{
841 841
 		// validate
842
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
842
+		if ($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
843 843
 
844 844
 		// build parameters
845 845
 		$parameters = array();
846
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
847
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
848
-		if($count != null) $parameters['count'] = (int) $count;
849
-		if($page != null) $parameters['page'] = (int) $page;
846
+		if ($sinceId != null) $parameters['since_id'] = (string) $sinceId;
847
+		if ($maxId != null) $parameters['max_id'] = (string) $maxId;
848
+		if ($count != null) $parameters['count'] = (int) $count;
849
+		if ($page != null) $parameters['page'] = (int) $page;
850 850
 
851 851
 		// make the call
852 852
 		return (array) $this->doCall('statuses/mentions.json', $parameters);
@@ -865,14 +865,14 @@  discard block
 block discarded – undo
865 865
 	public function statusesRetweetedByMe($sinceId = null, $maxId = null, $count = null, $page = null)
866 866
 	{
867 867
 		// validate
868
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
868
+		if ($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
869 869
 
870 870
 		// build parameters
871 871
 		$parameters = array();
872
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
873
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
874
-		if($count != null) $parameters['count'] = (int) $count;
875
-		if($page != null) $parameters['page'] = (int) $page;
872
+		if ($sinceId != null) $parameters['since_id'] = (string) $sinceId;
873
+		if ($maxId != null) $parameters['max_id'] = (string) $maxId;
874
+		if ($count != null) $parameters['count'] = (int) $count;
875
+		if ($page != null) $parameters['page'] = (int) $page;
876 876
 
877 877
 		// make the call
878 878
 		return (array) $this->doCall('statuses/retweeted_by_me.json', $parameters);
@@ -891,14 +891,14 @@  discard block
 block discarded – undo
891 891
 	public function statusesRetweetedToMe($sinceId = null, $maxId = null, $count = null, $page = null)
892 892
 	{
893 893
 		// validate
894
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
894
+		if ($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
895 895
 
896 896
 		// build parameters
897 897
 		$parameters = array();
898
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
899
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
900
-		if($count != null) $parameters['count'] = (int) $count;
901
-		if($page != null) $parameters['page'] = (int) $page;
898
+		if ($sinceId != null) $parameters['since_id'] = (string) $sinceId;
899
+		if ($maxId != null) $parameters['max_id'] = (string) $maxId;
900
+		if ($count != null) $parameters['count'] = (int) $count;
901
+		if ($page != null) $parameters['page'] = (int) $page;
902 902
 
903 903
 		// make the call
904 904
 		return (array) $this->doCall('statuses/retweeted_by_me.json', $parameters);
@@ -918,14 +918,14 @@  discard block
 block discarded – undo
918 918
 	public function statusesReweetsOfMe($sinceId = null, $maxId = null, $count = null, $page = null)
919 919
 	{
920 920
 		// validate
921
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
921
+		if ($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
922 922
 
923 923
 		// build parameters
924 924
 		$parameters = array();
925
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
926
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
927
-		if($count != null) $parameters['count'] = (int) $count;
928
-		if($page != null) $parameters['page'] = (int) $page;
925
+		if ($sinceId != null) $parameters['since_id'] = (string) $sinceId;
926
+		if ($maxId != null) $parameters['max_id'] = (string) $maxId;
927
+		if ($count != null) $parameters['count'] = (int) $count;
928
+		if ($page != null) $parameters['page'] = (int) $page;
929 929
 
930 930
 		// make the call
931 931
 		return (array) $this->doCall('statuses/retweets_of_me.json', $parameters);
@@ -963,11 +963,11 @@  discard block
 block discarded – undo
963 963
 	{
964 964
 		// build parameters
965 965
 		$parameters['status'] = (string) $status;
966
-		if($inReplyToStatusId != null) $parameters['in_reply_to_status_id'] = (string) $inReplyToStatusId;
967
-		if($lat != null) $parameters['lat'] = (float) $lat;
968
-		if($long != null) $parameters['long'] = (float) $long;
969
-		if($placeId != null) $parameters['place_id'] = (string) $placeId;
970
-		if($displayCoordinates) $parameters['display_coordinates'] = 'true';
966
+		if ($inReplyToStatusId != null) $parameters['in_reply_to_status_id'] = (string) $inReplyToStatusId;
967
+		if ($lat != null) $parameters['lat'] = (float) $lat;
968
+		if ($long != null) $parameters['long'] = (float) $long;
969
+		if ($placeId != null) $parameters['place_id'] = (string) $placeId;
970
+		if ($displayCoordinates) $parameters['display_coordinates'] = 'true';
971 971
 
972 972
 		// make the call
973 973
 		return (array) $this->doCall('statuses/update.json', $parameters, true, 'POST');
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 	public function statusesRetweet($id)
1001 1001
 	{
1002 1002
 		// make the call
1003
-		return (array) $this->doCall('statuses/retweet/'. $id .'.json', null, true, 'POST');
1003
+		return (array) $this->doCall('statuses/retweet/'.$id.'.json', null, true, 'POST');
1004 1004
 	}
1005 1005
 
1006 1006
 
@@ -1015,14 +1015,14 @@  discard block
 block discarded – undo
1015 1015
 	public function statusesRetweets($id, $count = null)
1016 1016
 	{
1017 1017
 		// validate
1018
-		if($count != null && $count > 100) throw new TwitterException('Count may not be greater than 100.');
1018
+		if ($count != null && $count > 100) throw new TwitterException('Count may not be greater than 100.');
1019 1019
 
1020 1020
 		// build parameters
1021 1021
 		$parameters = null;
1022
-		if($count != null) $parameters['count'] = (int) $count;
1022
+		if ($count != null) $parameters['count'] = (int) $count;
1023 1023
 
1024 1024
 		// make the call
1025
-		return (array) $this->doCall('statuses/retweets/'. $id .'.json', $parameters);
1025
+		return (array) $this->doCall('statuses/retweets/'.$id.'.json', $parameters);
1026 1026
 	}
1027 1027
 
1028 1028
 
@@ -1037,15 +1037,15 @@  discard block
 block discarded – undo
1037 1037
 	public function statusesIdRetweetedBy($id, $count = null, $page = null)
1038 1038
 	{
1039 1039
 		// validate
1040
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1040
+		if ($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1041 1041
 
1042 1042
 		// build parameters
1043 1043
 		$parameters = null;
1044
-		if($count != null) $parameters['count'] = (int) $count;
1045
-		if($page != null) $parameters['page'] = (int) $page;
1044
+		if ($count != null) $parameters['count'] = (int) $count;
1045
+		if ($page != null) $parameters['page'] = (int) $page;
1046 1046
 
1047 1047
 		// make the call
1048
-		return (array) $this->doCall('statuses/'. (string) $id .'/retweeted_by.json', $parameters, true);
1048
+		return (array) $this->doCall('statuses/'.(string) $id.'/retweeted_by.json', $parameters, true);
1049 1049
 	}
1050 1050
 
1051 1051
 
@@ -1060,15 +1060,15 @@  discard block
 block discarded – undo
1060 1060
 	public function statusesIdRetweetedByIds($id, $count = null, $page = null)
1061 1061
 	{
1062 1062
 		// validate
1063
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1063
+		if ($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1064 1064
 
1065 1065
 		// build parameters
1066 1066
 		$parameters = null;
1067
-		if($count != null) $parameters['count'] = (int) $count;
1068
-		if($page != null) $parameters['page'] = (int) $page;
1067
+		if ($count != null) $parameters['count'] = (int) $count;
1068
+		if ($page != null) $parameters['page'] = (int) $page;
1069 1069
 
1070 1070
 		// make the call
1071
-		return (array) $this->doCall('statuses/'. (string) $id .'/retweeted_by/ids.json', $parameters, true);
1071
+		return (array) $this->doCall('statuses/'.(string) $id.'/retweeted_by/ids.json', $parameters, true);
1072 1072
 	}
1073 1073
 
1074 1074
 
@@ -1085,12 +1085,12 @@  discard block
 block discarded – undo
1085 1085
 	public function usersShow($id = null, $userId = null, $screenName = null)
1086 1086
 	{
1087 1087
 		// validate
1088
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1088
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1089 1089
 
1090 1090
 		// build parameters
1091
-		if($id != null) $parameters['id'] = (string) $id;
1092
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1093
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1091
+		if ($id != null) $parameters['id'] = (string) $id;
1092
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
1093
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
1094 1094
 
1095 1095
 		// make the call
1096 1096
 		return (array) $this->doCall('users/show.json', $parameters);
@@ -1112,11 +1112,11 @@  discard block
 block discarded – undo
1112 1112
 		$screenNames = (array) $screenNames;
1113 1113
 
1114 1114
 		// validate
1115
-		if(empty($userIds) && empty($screenNames)) throw new TwitterException('Specify an userId or a screenName.');
1115
+		if (empty($userIds) && empty($screenNames)) throw new TwitterException('Specify an userId or a screenName.');
1116 1116
 
1117 1117
 		// build parameters
1118
-		if(!empty($userIds)) $parameters['user_id'] = implode(',', $userIds);
1119
-		if(!empty($screenNames)) $parameters['screen_name'] = implode(',', $screenNames);
1118
+		if (!empty($userIds)) $parameters['user_id'] = implode(',', $userIds);
1119
+		if (!empty($screenNames)) $parameters['screen_name'] = implode(',', $screenNames);
1120 1120
 
1121 1121
 		// make the call
1122 1122
 		return (array) $this->doCall('users/lookup.json', $parameters, true);
@@ -1137,8 +1137,8 @@  discard block
 block discarded – undo
1137 1137
 	{
1138 1138
 		// build parameters
1139 1139
 		$parameters['q'] = (string) $q;
1140
-		if($perPage != null) $parameters['per_page'] = (int) $perPage;
1141
-		if($page != null) $parameters['page'] = (int) $page;
1140
+		if ($perPage != null) $parameters['per_page'] = (int) $perPage;
1141
+		if ($page != null) $parameters['page'] = (int) $page;
1142 1142
 
1143 1143
 		// make the call
1144 1144
 		return (array) $this->doCall('users/search.json', $parameters, true);
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 	 */
1167 1167
 	public function usersSuggestionsSlug($slug)
1168 1168
 	{
1169
-		return (array) $this->doCall('users/suggestions/'. (string) $slug .'.json');
1169
+		return (array) $this->doCall('users/suggestions/'.(string) $slug.'.json');
1170 1170
 	}
1171 1171
 
1172 1172
 
@@ -1188,10 +1188,10 @@  discard block
 block discarded – undo
1188 1188
 	{
1189 1189
 		// build parameters
1190 1190
 		$parameters = array();
1191
-		if($id != null) $parameters['id'] = (string) $id;
1192
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1193
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1194
-		if($cursor != null) $parameters['cursor'] = (int) $cursor;
1191
+		if ($id != null) $parameters['id'] = (string) $id;
1192
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
1193
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
1194
+		if ($cursor != null) $parameters['cursor'] = (int) $cursor;
1195 1195
 
1196 1196
 		// make the call
1197 1197
 		return (array) $this->doCall('statuses/friends.json', $parameters);
@@ -1212,10 +1212,10 @@  discard block
 block discarded – undo
1212 1212
 	{
1213 1213
 		// build parameters
1214 1214
 		$parameters = array();
1215
-		if($id != null) $parameters['id'] = (string) $id;
1216
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1217
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1218
-		if($cursor != null) $parameters['cursor'] = (int) $cursor;
1215
+		if ($id != null) $parameters['id'] = (string) $id;
1216
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
1217
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
1218
+		if ($cursor != null) $parameters['cursor'] = (int) $cursor;
1219 1219
 
1220 1220
 		// make the call
1221 1221
 		return (array) $this->doCall('statuses/followers.json', $parameters);
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 	{
1247 1247
 		// build parameters
1248 1248
 		$parameters = array();
1249
-		if($exclude != null) $parameters['exclude'] = (string) $exclude;
1249
+		if ($exclude != null) $parameters['exclude'] = (string) $exclude;
1250 1250
 
1251 1251
 		// make the call
1252 1252
 		return (array) $this->doCall('trends/current.json', $parameters);
@@ -1264,8 +1264,8 @@  discard block
 block discarded – undo
1264 1264
 	{
1265 1265
 		// build parameters
1266 1266
 		$parameters = array();
1267
-		if($exclude != null) $parameters['exclude'] = (string) $exclude;
1268
-		if($date != null) $parameters['date'] = (string) $date;
1267
+		if ($exclude != null) $parameters['exclude'] = (string) $exclude;
1268
+		if ($date != null) $parameters['date'] = (string) $date;
1269 1269
 
1270 1270
 		// make the call
1271 1271
 		return (array) $this->doCall('trends/daily.json', $parameters);
@@ -1283,8 +1283,8 @@  discard block
 block discarded – undo
1283 1283
 	{
1284 1284
 		// build parameters
1285 1285
 		$parameters = array();
1286
-		if($exclude != null) $parameters['exclude'] = (string) $exclude;
1287
-		if($date != null) $parameters['date'] = (string) $date;
1286
+		if ($exclude != null) $parameters['exclude'] = (string) $exclude;
1287
+		if ($date != null) $parameters['date'] = (string) $date;
1288 1288
 
1289 1289
 		// make the call
1290 1290
 		return (array) $this->doCall('trends/weekly.json', $parameters);
@@ -1307,15 +1307,15 @@  discard block
 block discarded – undo
1307 1307
 		$allowedModes = array('public', 'private');
1308 1308
 
1309 1309
 		// validate
1310
-		if($mode != null && !in_array($mode, $allowedModes)) throw new TwitterException('Invalid mode (), possible values are: '. implode($allowedModes) .'.');
1310
+		if ($mode != null && !in_array($mode, $allowedModes)) throw new TwitterException('Invalid mode (), possible values are: '.implode($allowedModes).'.');
1311 1311
 
1312 1312
 		// build parameters
1313 1313
 		$parameters['name'] = (string) $name;
1314
-		if($mode != null) $parameters['mode'] = (string) $mode;
1315
-		if($description != null) $parameters['description'] = (string) $description;
1314
+		if ($mode != null) $parameters['mode'] = (string) $mode;
1315
+		if ($description != null) $parameters['description'] = (string) $description;
1316 1316
 
1317 1317
 		// make the call
1318
-		return (array) $this->doCall((string) $user .'/lists.json', $parameters, true, 'POST');
1318
+		return (array) $this->doCall((string) $user.'/lists.json', $parameters, true, 'POST');
1319 1319
 	}
1320 1320
 
1321 1321
 
@@ -1329,10 +1329,10 @@  discard block
 block discarded – undo
1329 1329
 	public function userLists($user, $cursor = null)
1330 1330
 	{
1331 1331
 		$parameters = null;
1332
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1332
+		if ($cursor != null) $parameters['cursor'] = (string) $cursor;
1333 1333
 
1334 1334
 		// make the call
1335
-		return (array) $this->doCall((string) $user .'/lists.json', $parameters, true);
1335
+		return (array) $this->doCall((string) $user.'/lists.json', $parameters, true);
1336 1336
 	}
1337 1337
 
1338 1338
 
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 	public function userListsId($user, $id)
1347 1347
 	{
1348 1348
 		// make the call
1349
-		return (array) $this->doCall((string) $user .'/lists/'. (string) $id .'.json', null, true);
1349
+		return (array) $this->doCall((string) $user.'/lists/'.(string) $id.'.json', null, true);
1350 1350
 	}
1351 1351
 
1352 1352
 
@@ -1366,15 +1366,15 @@  discard block
 block discarded – undo
1366 1366
 		$allowedModes = array('public', 'private');
1367 1367
 
1368 1368
 		// validate
1369
-		if($mode != null && !in_array($mode, $allowedModes)) throw new TwitterException('Invalid mode (), possible values are: '. implode($allowedModes) .'.');
1369
+		if ($mode != null && !in_array($mode, $allowedModes)) throw new TwitterException('Invalid mode (), possible values are: '.implode($allowedModes).'.');
1370 1370
 
1371 1371
 		// build parameters
1372
-		if($name != null) $parameters['name'] = (string) $name;
1373
-		if($mode != null) $parameters['mode'] = (string) $mode;
1374
-		if($description != null) $parameters['description'] = (string) $description;
1372
+		if ($name != null) $parameters['name'] = (string) $name;
1373
+		if ($mode != null) $parameters['mode'] = (string) $mode;
1374
+		if ($description != null) $parameters['description'] = (string) $description;
1375 1375
 
1376 1376
 		// make the call
1377
-		return (array) $this->doCall((string) $user .'/lists/'. (string) $id .'.json', $parameters, true, 'POST');
1377
+		return (array) $this->doCall((string) $user.'/lists/'.(string) $id.'.json', $parameters, true, 'POST');
1378 1378
 	}
1379 1379
 
1380 1380
 
@@ -1392,17 +1392,17 @@  discard block
 block discarded – undo
1392 1392
 	public function userListsIdStatuses($user, $id, $sinceId = null, $maxId = null, $count = null, $page = null)
1393 1393
 	{
1394 1394
 		// validate
1395
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1395
+		if ($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1396 1396
 
1397 1397
 		// build parameters
1398 1398
 		$parameters = array();
1399
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
1400
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
1401
-		if($count != null) $parameters['per_page'] = (int) $count;
1402
-		if($page != null) $parameters['page'] = (int) $page;
1399
+		if ($sinceId != null) $parameters['since_id'] = (string) $sinceId;
1400
+		if ($maxId != null) $parameters['max_id'] = (string) $maxId;
1401
+		if ($count != null) $parameters['per_page'] = (int) $count;
1402
+		if ($page != null) $parameters['page'] = (int) $page;
1403 1403
 
1404 1404
 		// make the call
1405
-		return (array) $this->doCall((string) $user .'/lists/'. (string) $id .'/statuses.json', $parameters);
1405
+		return (array) $this->doCall((string) $user.'/lists/'.(string) $id.'/statuses.json', $parameters);
1406 1406
 	}
1407 1407
 
1408 1408
 
@@ -1416,10 +1416,10 @@  discard block
 block discarded – undo
1416 1416
 	public function userListsMemberships($user, $cursor = null)
1417 1417
 	{
1418 1418
 		$parameters = null;
1419
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1419
+		if ($cursor != null) $parameters['cursor'] = (string) $cursor;
1420 1420
 
1421 1421
 		// make the call
1422
-		return (array) $this->doCall((string) $user .'/lists/memberships.json', $parameters, true);
1422
+		return (array) $this->doCall((string) $user.'/lists/memberships.json', $parameters, true);
1423 1423
 	}
1424 1424
 
1425 1425
 
@@ -1433,10 +1433,10 @@  discard block
 block discarded – undo
1433 1433
 	public function userListsSubscriptions($user, $cursor = null)
1434 1434
 	{
1435 1435
 		$parameters = null;
1436
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1436
+		if ($cursor != null) $parameters['cursor'] = (string) $cursor;
1437 1437
 
1438 1438
 		// make the call
1439
-		return (array) $this->doCall((string) $user .'/lists/subscriptions.json', $parameters, true);
1439
+		return (array) $this->doCall((string) $user.'/lists/subscriptions.json', $parameters, true);
1440 1440
 	}
1441 1441
 
1442 1442
 
@@ -1452,10 +1452,10 @@  discard block
 block discarded – undo
1452 1452
 	public function userListMembers($user, $id, $cursor = null)
1453 1453
 	{
1454 1454
 		$parameters = null;
1455
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1455
+		if ($cursor != null) $parameters['cursor'] = (string) $cursor;
1456 1456
 
1457 1457
 		// make the call
1458
-		return (array) $this->doCall((string) $user .'/'. (string) $id .'/members.json', $parameters, true);
1458
+		return (array) $this->doCall((string) $user.'/'.(string) $id.'/members.json', $parameters, true);
1459 1459
 	}
1460 1460
 
1461 1461
 
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
 		$parameters['id'] = (string) $userId;
1474 1474
 
1475 1475
 		// make the call
1476
-		return (array) $this->doCall((string) $user .'/'. (string) $id .'/members.json', $parameters, true, 'POST');
1476
+		return (array) $this->doCall((string) $user.'/'.(string) $id.'/members.json', $parameters, true, 'POST');
1477 1477
 	}
1478 1478
 
1479 1479
 
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
 		$parameters['_method'] = 'DELETE';
1493 1493
 
1494 1494
 		// make the call
1495
-		return (array) $this->doCall((string) $user .'/'. (string) $id .'/members.json', $parameters, true, 'POST');
1495
+		return (array) $this->doCall((string) $user.'/'.(string) $id.'/members.json', $parameters, true, 'POST');
1496 1496
 	}
1497 1497
 
1498 1498
 
@@ -1509,13 +1509,13 @@  discard block
 block discarded – undo
1509 1509
 		try
1510 1510
 		{
1511 1511
 			// make the call
1512
-			return (array) $this->doCall((string) $user .'/'. (string) $id .'/members/'. (string) $userId .'.json', null, true);
1512
+			return (array) $this->doCall((string) $user.'/'.(string) $id.'/members/'.(string) $userId.'.json', null, true);
1513 1513
 		}
1514 1514
 
1515 1515
 		// catch exceptions
1516
-		catch(TwitterException $e)
1516
+		catch (TwitterException $e)
1517 1517
 		{
1518
-			if($e->getMessage() == 'The specified user is not a member of this list') return false;
1518
+			if ($e->getMessage() == 'The specified user is not a member of this list') return false;
1519 1519
 			else throw $e;
1520 1520
 		}
1521 1521
 	}
@@ -1533,10 +1533,10 @@  discard block
 block discarded – undo
1533 1533
 	public function userListSubscribers($user, $id, $cursor = null)
1534 1534
 	{
1535 1535
 		$parameters = null;
1536
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1536
+		if ($cursor != null) $parameters['cursor'] = (string) $cursor;
1537 1537
 
1538 1538
 		// make the call
1539
-		return (array) $this->doCall((string) $user .'/'. (string) $id .'/subscribers.json', $parameters, true);
1539
+		return (array) $this->doCall((string) $user.'/'.(string) $id.'/subscribers.json', $parameters, true);
1540 1540
 	}
1541 1541
 
1542 1542
 
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
 	public function userListSubscribersCreate($user, $id)
1551 1551
 	{
1552 1552
 		// make the call
1553
-		return (array) $this->doCall((string) $user .'/'. (string) $id .'/subscribers.json', null, true, 'POST');
1553
+		return (array) $this->doCall((string) $user.'/'.(string) $id.'/subscribers.json', null, true, 'POST');
1554 1554
 	}
1555 1555
 
1556 1556
 
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
 		$parameters['_method'] = 'DELETE';
1568 1568
 
1569 1569
 		// make the call
1570
-		return (array) $this->doCall((string) $user .'/'. (string) $id .'/subscribers.json', $parameters, true, 'POST');
1570
+		return (array) $this->doCall((string) $user.'/'.(string) $id.'/subscribers.json', $parameters, true, 'POST');
1571 1571
 	}
1572 1572
 
1573 1573
 
@@ -1584,13 +1584,13 @@  discard block
 block discarded – undo
1584 1584
 		try
1585 1585
 		{
1586 1586
 			// make the call
1587
-			return (array) $this->doCall((string) $user .'/'. (string) $id .'/subscribers/'. (string) $userId .'.json', null, true);
1587
+			return (array) $this->doCall((string) $user.'/'.(string) $id.'/subscribers/'.(string) $userId.'.json', null, true);
1588 1588
 		}
1589 1589
 
1590 1590
 		// catch exceptions
1591
-		catch(TwitterException $e)
1591
+		catch (TwitterException $e)
1592 1592
 		{
1593
-			if($e->getMessage() == 'The specified user is not a subscriber of this list') return false;
1593
+			if ($e->getMessage() == 'The specified user is not a subscriber of this list') return false;
1594 1594
 			else throw $e;
1595 1595
 		}
1596 1596
 
@@ -1610,14 +1610,14 @@  discard block
 block discarded – undo
1610 1610
 	public function directMessages($sinceId = null, $maxId = null, $count = null, $page = null)
1611 1611
 	{
1612 1612
 		// validate
1613
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1613
+		if ($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1614 1614
 
1615 1615
 		// build parameters
1616 1616
 		$parameters = array();
1617
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
1618
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
1619
-		if($count != null) $parameters['count'] = (int) $count;
1620
-		if($page != null) $parameters['page'] = (int) $page;
1617
+		if ($sinceId != null) $parameters['since_id'] = (string) $sinceId;
1618
+		if ($maxId != null) $parameters['max_id'] = (string) $maxId;
1619
+		if ($count != null) $parameters['count'] = (int) $count;
1620
+		if ($page != null) $parameters['page'] = (int) $page;
1621 1621
 
1622 1622
 		// make the call
1623 1623
 		return (array) $this->doCall('direct_messages.json', $parameters, true);
@@ -1636,14 +1636,14 @@  discard block
 block discarded – undo
1636 1636
 	public function directMessagesSent($sinceId = null, $maxId = null, $count = null, $page = null)
1637 1637
 	{
1638 1638
 		// validate
1639
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1639
+		if ($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1640 1640
 
1641 1641
 		// build parameters
1642 1642
 		$parameters = array();
1643
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
1644
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
1645
-		if($count != null) $parameters['count'] = (int) $count;
1646
-		if($page != null) $parameters['page'] = (int) $page;
1643
+		if ($sinceId != null) $parameters['since_id'] = (string) $sinceId;
1644
+		if ($maxId != null) $parameters['max_id'] = (string) $maxId;
1645
+		if ($count != null) $parameters['count'] = (int) $count;
1646
+		if ($page != null) $parameters['page'] = (int) $page;
1647 1647
 
1648 1648
 		// make the call
1649 1649
 		return (array) $this->doCall('direct_messages/sent.json', $parameters, true);
@@ -1663,13 +1663,13 @@  discard block
 block discarded – undo
1663 1663
 	public function directMessagesNew($text, $id = null, $userId = null, $screenName = null)
1664 1664
 	{
1665 1665
 		// validate
1666
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1666
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1667 1667
 
1668 1668
 		// build parameters
1669 1669
 		$parameters['text'] = (string) $text;
1670
-		if($id != null) $parameters['user'] = (string) $id;
1671
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1672
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1670
+		if ($id != null) $parameters['user'] = (string) $id;
1671
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
1672
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
1673 1673
 
1674 1674
 		// make the call
1675 1675
 		return (array) $this->doCall('direct_messages/new.json', $parameters, true, 'POST');
@@ -1707,12 +1707,12 @@  discard block
 block discarded – undo
1707 1707
 	public function friendshipsCreate($id = null, $userId = null, $screenName = null, $follow = false)
1708 1708
 	{
1709 1709
 		// validate
1710
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1710
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1711 1711
 
1712 1712
 		// build parameters
1713
-		if($id != null) $parameters['id'] = (string) $id;
1714
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1715
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1713
+		if ($id != null) $parameters['id'] = (string) $id;
1714
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
1715
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
1716 1716
 		$parameters['follow'] = ($follow) ? 'true' : 'false';
1717 1717
 
1718 1718
 		// make the call
@@ -1732,12 +1732,12 @@  discard block
 block discarded – undo
1732 1732
 	public function friendshipsDestroy($id = null, $userId = null, $screenName = null)
1733 1733
 	{
1734 1734
 		// validate
1735
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1735
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1736 1736
 
1737 1737
 		// build parameters
1738
-		if($id != null) $parameters['id'] = (string) $id;
1739
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1740
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1738
+		if ($id != null) $parameters['id'] = (string) $id;
1739
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
1740
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
1741 1741
 
1742 1742
 		// make the call
1743 1743
 		return (array) $this->doCall('friendships/destroy.json', $parameters, true, 'POST');
@@ -1774,14 +1774,14 @@  discard block
 block discarded – undo
1774 1774
 	public function friendshipsShow($sourceId = null, $sourceScreenName = null, $targetId = null, $targetScreenName = null)
1775 1775
 	{
1776 1776
 		// validate
1777
-		if($sourceId == '' && $sourceScreenName == '') throw new TwitterException('Specify an sourceId or a sourceScreenName.');
1778
-		if($targetId == '' && $targetScreenName == '') throw new TwitterException('Specify an targetId or a targetScreenName.');
1777
+		if ($sourceId == '' && $sourceScreenName == '') throw new TwitterException('Specify an sourceId or a sourceScreenName.');
1778
+		if ($targetId == '' && $targetScreenName == '') throw new TwitterException('Specify an targetId or a targetScreenName.');
1779 1779
 
1780 1780
 		// build parameters
1781
-		if($sourceId != null) $parameters['source_id'] = (string) $sourceId;
1782
-		if($sourceScreenName != null) $parameters['source_screen_name'] = (string) $sourceScreenName;
1783
-		if($targetId != null) $parameters['target_id'] = (string) $targetId;
1784
-		if($targetScreenName != null) $parameters['target_screen_name'] = (string) $targetScreenName;
1781
+		if ($sourceId != null) $parameters['source_id'] = (string) $sourceId;
1782
+		if ($sourceScreenName != null) $parameters['source_screen_name'] = (string) $sourceScreenName;
1783
+		if ($targetId != null) $parameters['target_id'] = (string) $targetId;
1784
+		if ($targetScreenName != null) $parameters['target_screen_name'] = (string) $targetScreenName;
1785 1785
 
1786 1786
 		// make the call
1787 1787
 		return (array) $this->doCall('friendships/show.json', $parameters);
@@ -1797,7 +1797,7 @@  discard block
 block discarded – undo
1797 1797
 	public function friendshipsIncoming($cursor = null)
1798 1798
 	{
1799 1799
 		$parameters = null;
1800
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1800
+		if ($cursor != null) $parameters['cursor'] = (string) $cursor;
1801 1801
 
1802 1802
 		// make the call
1803 1803
 		return (array) $this->doCall('friendships/incoming.json', $parameters, true);
@@ -1813,7 +1813,7 @@  discard block
 block discarded – undo
1813 1813
 	public function friendshipsOutgoing($cursor = null)
1814 1814
 	{
1815 1815
 		$parameters = null;
1816
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1816
+		if ($cursor != null) $parameters['cursor'] = (string) $cursor;
1817 1817
 
1818 1818
 		// make the call
1819 1819
 		return (array) $this->doCall('friendships/outgoing.json', $parameters, true);
@@ -1833,13 +1833,13 @@  discard block
 block discarded – undo
1833 1833
 	public function friendsIds($id = null, $userId = null, $screenName = null, $cursor = null)
1834 1834
 	{
1835 1835
 		// validate
1836
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1836
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1837 1837
 
1838 1838
 		// build parameters
1839
-		if($id != null) $parameters['id'] = (string) $id;
1840
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1841
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1842
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1839
+		if ($id != null) $parameters['id'] = (string) $id;
1840
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
1841
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
1842
+		if ($cursor != null) $parameters['cursor'] = (string) $cursor;
1843 1843
 
1844 1844
 		// make the call
1845 1845
 		return (array) $this->doCall('friends/ids.json', $parameters);
@@ -1858,13 +1858,13 @@  discard block
 block discarded – undo
1858 1858
 	public function followersIds($id = null, $userId = null, $screenName = null, $cursor = null)
1859 1859
 	{
1860 1860
 		// validate
1861
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1861
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1862 1862
 
1863 1863
 		// build parameters
1864
-		if($id != null) $parameters['id'] = (string) $id;
1865
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1866
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1867
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1864
+		if ($id != null) $parameters['id'] = (string) $id;
1865
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
1866
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
1867
+		if ($cursor != null) $parameters['cursor'] = (string) $cursor;
1868 1868
 
1869 1869
 		// make the call
1870 1870
 		return (array) $this->doCall('followers/ids.json', $parameters);
@@ -1909,9 +1909,9 @@  discard block
 block discarded – undo
1909 1909
 		}
1910 1910
 
1911 1911
 		// catch exceptions
1912
-		catch(TwitterException $e)
1912
+		catch (TwitterException $e)
1913 1913
 		{
1914
-			if($e->getMessage() == 'Logged out.') return true;
1914
+			if ($e->getMessage() == 'Logged out.') return true;
1915 1915
 			else throw $e;
1916 1916
 		}
1917 1917
 	}
@@ -1947,14 +1947,14 @@  discard block
 block discarded – undo
1947 1947
 	public function accountUpdateProfileColors($profileBackgroundColor = null, $profileTextColor = null, $profileLinkColor = null, $profileSidebarFillColor = null, $profileSidebarBorderColor = null)
1948 1948
 	{
1949 1949
 		// validate
1950
-		if($profileBackgroundColor == '' && $profileTextColor == '' && $profileLinkColor == '' && $profileSidebarFillColor == '' && $profileSidebarBorderColor == '') throw new TwitterException('Specify a profileBackgroundColor, profileTextColor, profileLinkColor, profileSidebarFillColor or a profileSidebarBorderColor.');
1950
+		if ($profileBackgroundColor == '' && $profileTextColor == '' && $profileLinkColor == '' && $profileSidebarFillColor == '' && $profileSidebarBorderColor == '') throw new TwitterException('Specify a profileBackgroundColor, profileTextColor, profileLinkColor, profileSidebarFillColor or a profileSidebarBorderColor.');
1951 1951
 
1952 1952
 		// build parameters
1953
-		if($profileBackgroundColor != null) $parameters['profile_background_color'] = (string) $profileBackgroundColor;
1954
-		if($profileTextColor != null) $parameters['profile_text_color'] = (string) $profileTextColor;
1955
-		if($profileLinkColor != null) $parameters['profile_link_color'] = (string) $profileLinkColor;
1956
-		if($profileSidebarFillColor != null) $parameters['profile_sidebar_fill_color'] = (string) $profileSidebarFillColor;
1957
-		if($profileSidebarBorderColor != null) $parameters['profile_sidebar_border_color'] = (string) $profileSidebarBorderColor;
1953
+		if ($profileBackgroundColor != null) $parameters['profile_background_color'] = (string) $profileBackgroundColor;
1954
+		if ($profileTextColor != null) $parameters['profile_text_color'] = (string) $profileTextColor;
1955
+		if ($profileLinkColor != null) $parameters['profile_link_color'] = (string) $profileLinkColor;
1956
+		if ($profileSidebarFillColor != null) $parameters['profile_sidebar_fill_color'] = (string) $profileSidebarFillColor;
1957
+		if ($profileSidebarBorderColor != null) $parameters['profile_sidebar_border_color'] = (string) $profileSidebarBorderColor;
1958 1958
 
1959 1959
 		// make the call
1960 1960
 		return (array) $this->doCall('account/update_profile_colors.json', $parameters, true, 'POST');
@@ -1972,7 +1972,7 @@  discard block
 block discarded – undo
1972 1972
 		throw new TwitterException('Not implemented');
1973 1973
 
1974 1974
 		// validate
1975
-		if(!file_exists($image)) throw new TwitterException('Image ('. $image .') doesn\'t exists.');
1975
+		if (!file_exists($image)) throw new TwitterException('Image ('.$image.') doesn\'t exists.');
1976 1976
 
1977 1977
 		// make the call
1978 1978
 		return (array) $this->doCall('account/update_profile_image.json', null, true, 'POST', $image);
@@ -1991,10 +1991,10 @@  discard block
 block discarded – undo
1991 1991
 		throw new TwitterException('Not implemented');
1992 1992
 
1993 1993
 		// validate
1994
-		if(!file_exists($image)) throw new TwitterException('Image ('. $image .') doesn\'t exists.');
1994
+		if (!file_exists($image)) throw new TwitterException('Image ('.$image.') doesn\'t exists.');
1995 1995
 
1996 1996
 		// build parameters
1997
-		if($tile) $parameters['tile'] = 'true';
1997
+		if ($tile) $parameters['tile'] = 'true';
1998 1998
 
1999 1999
 		// make the call
2000 2000
 		return (array) $this->doCall('account/update_profile_background_image.json', $parameters, true, 'POST', $image);
@@ -2014,10 +2014,10 @@  discard block
 block discarded – undo
2014 2014
 	{
2015 2015
 		// build parameters
2016 2016
 		$parameters = null;
2017
-		if($name != null) $parameters['name'] = (string) $name;
2018
-		if($url != null) $parameters['url'] = (string) $url;
2019
-		if($location != null) $parameters['location'] = (string) $location;
2020
-		if($description != null) $parameters['description'] = (string) $description;
2017
+		if ($name != null) $parameters['name'] = (string) $name;
2018
+		if ($url != null) $parameters['url'] = (string) $url;
2019
+		if ($location != null) $parameters['location'] = (string) $location;
2020
+		if ($description != null) $parameters['description'] = (string) $description;
2021 2021
 
2022 2022
 		// make the call
2023 2023
 		return (array) $this->doCall('account/update_profile.json', $parameters, true, 'POST');
@@ -2036,8 +2036,8 @@  discard block
 block discarded – undo
2036 2036
 	{
2037 2037
 		// build parameters
2038 2038
 		$parameters = null;
2039
-		if($id != null) $parameters['id'] = (string) $id;
2040
-		if($page != null) $parameters['page'] = (int) $page;
2039
+		if ($id != null) $parameters['id'] = (string) $id;
2040
+		if ($page != null) $parameters['page'] = (int) $page;
2041 2041
 
2042 2042
 		// make the call
2043 2043
 		return (array) $this->doCall('favorites.json', $parameters, true);
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
 	public function favoritesCreate($id)
2054 2054
 	{
2055 2055
 		// make the call
2056
-		return (array) $this->doCall('favorites/create/'. $id .'.json', null, true, 'POST');
2056
+		return (array) $this->doCall('favorites/create/'.$id.'.json', null, true, 'POST');
2057 2057
 	}
2058 2058
 
2059 2059
 
@@ -2066,7 +2066,7 @@  discard block
 block discarded – undo
2066 2066
 	public function favoritesDestroy($id)
2067 2067
 	{
2068 2068
 		// make the call
2069
-		return (array) $this->doCall('favorites/destroy/'. $id .'.json', null, true, 'POST');
2069
+		return (array) $this->doCall('favorites/destroy/'.$id.'.json', null, true, 'POST');
2070 2070
 	}
2071 2071
 
2072 2072
 
@@ -2082,12 +2082,12 @@  discard block
 block discarded – undo
2082 2082
 	public function notificationsFollow($id = null, $userId = null, $screenName = null)
2083 2083
 	{
2084 2084
 		// validate
2085
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2085
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2086 2086
 
2087 2087
 		// build parameters
2088
-		if($id != null) $parameters['id'] = (string) $id;
2089
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2090
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2088
+		if ($id != null) $parameters['id'] = (string) $id;
2089
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
2090
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
2091 2091
 
2092 2092
 		// make the call
2093 2093
 		return (array) $this->doCall('notifications/follow.json', $parameters, true, 'POST');
@@ -2105,12 +2105,12 @@  discard block
 block discarded – undo
2105 2105
 	public function notificationsLeave($id = null, $userId = null, $screenName = null)
2106 2106
 	{
2107 2107
 		// validate
2108
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2108
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2109 2109
 
2110 2110
 		// build parameters
2111
-		if($id != null) $parameters['id'] = (string) $id;
2112
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2113
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2111
+		if ($id != null) $parameters['id'] = (string) $id;
2112
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
2113
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
2114 2114
 
2115 2115
 		// make the call
2116 2116
 		return (array) $this->doCall('notifications/leave.json', $parameters, true, 'POST');
@@ -2129,12 +2129,12 @@  discard block
 block discarded – undo
2129 2129
 	public function blocksCreate($id = null, $userId = null, $screenName = null)
2130 2130
 	{
2131 2131
 		// validate
2132
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2132
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2133 2133
 
2134 2134
 		// build parameters
2135
-		if($id != null) $parameters['id'] = (string) $id;
2136
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2137
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2135
+		if ($id != null) $parameters['id'] = (string) $id;
2136
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
2137
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
2138 2138
 
2139 2139
 		// make the call
2140 2140
 		return (array) $this->doCall('blocks/create.json', $parameters, true, 'POST');
@@ -2152,12 +2152,12 @@  discard block
 block discarded – undo
2152 2152
 	public function blocksDestroy($id = null, $userId = null, $screenName = null)
2153 2153
 	{
2154 2154
 		// validate
2155
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2155
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2156 2156
 
2157 2157
 		// build parameters
2158
-		if($id != null) $parameters['id'] = (string) $id;
2159
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2160
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2158
+		if ($id != null) $parameters['id'] = (string) $id;
2159
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
2160
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
2161 2161
 
2162 2162
 		// make the call
2163 2163
 		return (array) $this->doCall('blocks/destroy.json', $parameters, true, 'POST');
@@ -2175,12 +2175,12 @@  discard block
 block discarded – undo
2175 2175
 	public function blocksExists($id = null, $userId = null, $screenName = null)
2176 2176
 	{
2177 2177
 		// validate
2178
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2178
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2179 2179
 
2180 2180
 		// build parameters
2181
-		if($id != null) $parameters['id'] = (string) $id;
2182
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2183
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2181
+		if ($id != null) $parameters['id'] = (string) $id;
2182
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
2183
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
2184 2184
 
2185 2185
 		try
2186 2186
 		{
@@ -2188,9 +2188,9 @@  discard block
 block discarded – undo
2188 2188
 			return (array) $this->doCall('blocks/exists.json', $parameters, true);
2189 2189
 		}
2190 2190
 		// catch exceptions
2191
-		catch(TwitterException $e)
2191
+		catch (TwitterException $e)
2192 2192
 		{
2193
-			if($e->getMessage() == 'You are not blocking this user.') return false;
2193
+			if ($e->getMessage() == 'You are not blocking this user.') return false;
2194 2194
 			else throw $e;
2195 2195
 		}
2196 2196
 	}
@@ -2206,7 +2206,7 @@  discard block
 block discarded – undo
2206 2206
 	{
2207 2207
 		// build parameters
2208 2208
 		$parameters = null;
2209
-		if($page != null) $parameters['page'] = (int) $page;
2209
+		if ($page != null) $parameters['page'] = (int) $page;
2210 2210
 
2211 2211
 		// make the call
2212 2212
 		return (array) $this->doCall('blocks/blocking.json', $parameters, true);
@@ -2237,12 +2237,12 @@  discard block
 block discarded – undo
2237 2237
 	public function reportSpam($id = null, $userId = null, $screenName = null)
2238 2238
 	{
2239 2239
 		// validate
2240
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2240
+		if ($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2241 2241
 
2242 2242
 		// build parameters
2243
-		if($id != null) $parameters['id'] = (string) $id;
2244
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2245
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2243
+		if ($id != null) $parameters['id'] = (string) $id;
2244
+		if ($userId != null) $parameters['user_id'] = (string) $userId;
2245
+		if ($screenName != null) $parameters['screen_name'] = (string) $screenName;
2246 2246
 
2247 2247
 		// make the call
2248 2248
 		return (array) $this->doCall('report_spam.json', $parameters, true, 'POST');
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
 	 */
2304 2304
 	public function savedSearchesDestroy($id)
2305 2305
 	{
2306
-		return (array) $this->doCall('saved_searches/destroy/'. (string) $id .'.json', null, true, 'POST');
2306
+		return (array) $this->doCall('saved_searches/destroy/'.(string) $id.'.json', null, true, 'POST');
2307 2307
 	}
2308 2308
 
2309 2309
 
@@ -2321,17 +2321,17 @@  discard block
 block discarded – undo
2321 2321
 		$parameters = array();
2322 2322
 
2323 2323
 		// set callback
2324
-		if($callbackURL != null) $parameters['oauth_callback'] = (string) $callbackURL;
2324
+		if ($callbackURL != null) $parameters['oauth_callback'] = (string) $callbackURL;
2325 2325
 
2326 2326
 		// make the call
2327 2327
 		$response = $this->doOAuthCall('request_token', $parameters);
2328 2328
 
2329 2329
 		// validate
2330
-		if(!isset($response['oauth_token'], $response['oauth_token_secret'])) throw new TwitterException(implode(', ', array_keys($response)));
2330
+		if (!isset($response['oauth_token'], $response['oauth_token_secret'])) throw new TwitterException(implode(', ', array_keys($response)));
2331 2331
 
2332 2332
 		// set some properties
2333
-		if(isset($response['oauth_token'])) $this->setOAuthToken($response['oauth_token']);
2334
-		if(isset($response['oauth_token_secret'])) $this->setOAuthTokenSecret($response['oauth_token_secret']);
2333
+		if (isset($response['oauth_token'])) $this->setOAuthToken($response['oauth_token']);
2334
+		if (isset($response['oauth_token_secret'])) $this->setOAuthTokenSecret($response['oauth_token_secret']);
2335 2335
 
2336 2336
 		// return
2337 2337
 		return $response;
@@ -2357,8 +2357,8 @@  discard block
 block discarded – undo
2357 2357
 		$response = $this->doOAuthCall('access_token', $parameters);
2358 2358
 
2359 2359
 		// set some properties
2360
-		if(isset($response['oauth_token'])) $this->setOAuthToken($response['oauth_token']);
2361
-		if(isset($response['oauth_token_secret'])) $this->setOAuthTokenSecret($response['oauth_token_secret']);
2360
+		if (isset($response['oauth_token'])) $this->setOAuthToken($response['oauth_token']);
2361
+		if (isset($response['oauth_token_secret'])) $this->setOAuthTokenSecret($response['oauth_token_secret']);
2362 2362
 
2363 2363
 		// return
2364 2364
 		return $response;
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 	 */
2373 2373
 	public function oAuthAuthorize()
2374 2374
 	{
2375
-		header('Location: '. self::SECURE_API_URL .'/oauth/authorize?oauth_token='. $this->oAuthToken);
2375
+		header('Location: '.self::SECURE_API_URL.'/oauth/authorize?oauth_token='.$this->oAuthToken);
2376 2376
 	}
2377 2377
 
2378 2378
 
@@ -2403,8 +2403,8 @@  discard block
 block discarded – undo
2403 2403
 	{
2404 2404
 		// build parameters
2405 2405
 		$parameters = null;
2406
-		if($lat != null) $parameters['lat_for_trends'] = (float) $lat;
2407
-		if($long != null) $parameters['long_for_trends'] = (float) $long;
2406
+		if ($lat != null) $parameters['lat_for_trends'] = (float) $lat;
2407
+		if ($long != null) $parameters['long_for_trends'] = (float) $long;
2408 2408
 
2409 2409
 		// make the call
2410 2410
 		return (array) $this->doCall('trends/available.json', $parameters);
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
 	public function trendsLocation($woeid)
2424 2424
 	{
2425 2425
 		// make the call
2426
-		return (array) $this->doCall('trends/location/'. (string) $woeid .'.json');
2426
+		return (array) $this->doCall('trends/location/'.(string) $woeid.'.json');
2427 2427
 	}
2428 2428
 
2429 2429
 
@@ -2446,9 +2446,9 @@  discard block
 block discarded – undo
2446 2446
 		// build parameters
2447 2447
 		$parameters['lat'] = (float) $lat;
2448 2448
 		$parameters['long'] = (float) $long;
2449
-		if($accuracy != null) $parameters['accuracy'] = (string) $accuracy;
2450
-		if($granularity != null) $parameters['granularity'] = (string) $granularity;
2451
-		if($maxResults != null) $parameters['max_results'] = (int) $maxResults;
2449
+		if ($accuracy != null) $parameters['accuracy'] = (string) $accuracy;
2450
+		if ($granularity != null) $parameters['granularity'] = (string) $granularity;
2451
+		if ($maxResults != null) $parameters['max_results'] = (int) $maxResults;
2452 2452
 
2453 2453
 		// make the call
2454 2454
 		return (array) $this->doCall('geo/reverse_geocode.json', $parameters);
@@ -2466,10 +2466,10 @@  discard block
 block discarded – undo
2466 2466
 	{
2467 2467
 		// build parameters
2468 2468
 		$parameters = null;
2469
-		if($placeId != null) $parameters['place_id'] = (string) $placeId;
2469
+		if ($placeId != null) $parameters['place_id'] = (string) $placeId;
2470 2470
 
2471 2471
 		// make the call
2472
-		return (array) $this->doCall('geo/id/'. (string) $id .'.json', $parameters);
2472
+		return (array) $this->doCall('geo/id/'.(string) $id.'.json', $parameters);
2473 2473
 	}
2474 2474
 
2475 2475
 
Please login to merge, or discard this patch.
Braces   +627 added lines, -215 removed lines patch added patch discarded remove patch
@@ -134,7 +134,9 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function __destruct()
136 136
 	{
137
-		if($this->curl != null) curl_close($this->curl);
137
+		if($this->curl != null) {
138
+			curl_close($this->curl);
139
+		}
138 140
 	}
139 141
 
140 142
 
@@ -147,7 +149,9 @@  discard block
 block discarded – undo
147 149
 	private function buildQuery(array $parameters)
148 150
 	{
149 151
 		// no parameters?
150
-		if(empty($parameters)) return '';
152
+		if(empty($parameters)) {
153
+			return '';
154
+		}
151 155
 
152 156
 		// encode the keys
153 157
 		$keys = self::urlencode_rfc3986(array_keys($parameters));
@@ -165,11 +169,15 @@  discard block
 block discarded – undo
165 169
 		foreach($parameters as $key => $value)
166 170
 		{
167 171
 			// sort by value
168
-			if(is_array($value)) $parameters[$key] = natsort($value);
172
+			if(is_array($value)) {
173
+				$parameters[$key] = natsort($value);
174
+			}
169 175
 		}
170 176
 
171 177
 		// process parameters
172
-		foreach($parameters as $key => $value) $chunks[] = $key .'='. str_replace('%25', '%', $value);
178
+		foreach($parameters as $key => $value) {
179
+			$chunks[] = $key .'='. str_replace('%25', '%', $value);
180
+		}
173 181
 
174 182
 		// return
175 183
 		return implode('&', $chunks);
@@ -208,7 +216,9 @@  discard block
 block discarded – undo
208 216
 		foreach($parameters as $key => $value)
209 217
 		{
210 218
 			// sort by value
211
-			if(is_array($value)) $parameters[$key] = natsort($value);
219
+			if(is_array($value)) {
220
+				$parameters[$key] = natsort($value);
221
+			}
212 222
 		}
213 223
 
214 224
 		// process queries
@@ -246,7 +256,9 @@  discard block
 block discarded – undo
246 256
 		$chunks = array();
247 257
 
248 258
 		// process queries
249
-		foreach($parameters as $key => $value) $chunks[] = str_replace('%25', '%', self::urlencode_rfc3986($key) .'="'. self::urlencode_rfc3986($value) .'"');
259
+		foreach($parameters as $key => $value) {
260
+			$chunks[] = str_replace('%25', '%', self::urlencode_rfc3986($key) .'="'. self::urlencode_rfc3986($value) .'"');
261
+		}
250 262
 
251 263
 		// build return
252 264
 		$return = 'Authorization: OAuth realm="' . $parts['scheme'] . '://' . $parts['host'] . $parts['path'] . '", ';
@@ -300,7 +312,9 @@  discard block
 block discarded – undo
300 312
 		$options[CURLOPT_POSTFIELDS] = $this->buildQuery($parameters);
301 313
 
302 314
 		// init
303
-		if($this->curl == null) $this->curl = curl_init();
315
+		if($this->curl == null) {
316
+			$this->curl = curl_init();
317
+		}
304 318
 
305 319
 		// set options
306 320
 		curl_setopt_array($this->curl, $options);
@@ -314,7 +328,9 @@  discard block
 block discarded – undo
314 328
 		$errorMessage = curl_error($this->curl);
315 329
 
316 330
 		// error?
317
-		if($errorNumber != '') throw new TwitterException($errorMessage, $errorNumber);
331
+		if($errorNumber != '') {
332
+			throw new TwitterException($errorMessage, $errorNumber);
333
+		}
318 334
 
319 335
 		// init var
320 336
 		$return = array();
@@ -349,7 +365,9 @@  discard block
 block discarded – undo
349 365
 		$expectJSON = (bool) $expectJSON;
350 366
 
351 367
 		// validate method
352
-		if(!in_array($method, $allowedMethods)) throw new TwitterException('Unknown method ('. $method .'). Allowed methods are: '. implode(', ', $allowedMethods));
368
+		if(!in_array($method, $allowedMethods)) {
369
+			throw new TwitterException('Unknown method ('. $method .'). Allowed methods are: '. implode(', ', $allowedMethods));
370
+		}
353 371
 
354 372
 		// append default parameters
355 373
 		$oauth['oauth_consumer_key'] = $this->getConsumerKey();
@@ -361,7 +379,9 @@  discard block
 block discarded – undo
361 379
 
362 380
 		// set data
363 381
 		$data = $oauth;
364
-		if(!empty($parameters)) $data = array_merge($data, $parameters);
382
+		if(!empty($parameters)) {
383
+			$data = array_merge($data, $parameters);
384
+		}
365 385
 
366 386
 		// calculate the base string
367 387
 		$base = $this->calculateBaseString(self::API_URL .'/'. $url, $method, $data);
@@ -386,9 +406,13 @@  discard block
 block discarded – undo
386 406
 
387 407
 				// set mimeType
388 408
 				$mimeType = 'application/octet-stream';
389
-				if($fileInfo['extension'] == 'jpg' || $fileInfo['extension'] == 'jpeg') $mimeType = 'image/jpeg';
390
-				elseif($fileInfo['extension'] == 'gif') $mimeType = 'image/gif';
391
-				elseif($fileInfo['extension'] == 'png') $mimeType = 'image/png';
409
+				if($fileInfo['extension'] == 'jpg' || $fileInfo['extension'] == 'jpeg') {
410
+					$mimeType = 'image/jpeg';
411
+				} elseif($fileInfo['extension'] == 'gif') {
412
+					$mimeType = 'image/gif';
413
+				} elseif($fileInfo['extension'] == 'png') {
414
+					$mimeType = 'image/png';
415
+				}
392 416
 
393 417
 				// init var
394 418
 				$content = '--'. $boundary ."\r\n";
@@ -405,16 +429,18 @@  discard block
 block discarded – undo
405 429
 			}
406 430
 
407 431
 			// no file
408
-			else $options[CURLOPT_POSTFIELDS] = $this->buildQuery($parameters);
432
+			else {
433
+				$options[CURLOPT_POSTFIELDS] = $this->buildQuery($parameters);
434
+			}
409 435
 
410 436
 			// enable post
411 437
 			$options[CURLOPT_POST] = 1;
412
-		}
413
-
414
-		else
438
+		} else
415 439
 		{
416 440
 			// add the parameters into the querystring
417
-			if(!empty($parameters)) $url .= '?'. $this->buildQuery($parameters);
441
+			if(!empty($parameters)) {
442
+				$url .= '?'. $this->buildQuery($parameters);
443
+			}
418 444
 		}
419 445
 
420 446
 		// set options
@@ -430,7 +456,9 @@  discard block
 block discarded – undo
430 456
 		$options[CURLOPT_HTTPHEADER] = $headers;
431 457
 
432 458
 		// init
433
-		if($this->curl == null) $this->curl = curl_init();
459
+		if($this->curl == null) {
460
+			$this->curl = curl_init();
461
+		}
434 462
 
435 463
 		// set options
436 464
 		curl_setopt_array($this->curl, $options);
@@ -444,7 +472,9 @@  discard block
 block discarded – undo
444 472
 		$errorMessage = curl_error($this->curl);
445 473
 
446 474
 		// we don't expext JSON, return the response
447
-		if(!$expectJSON) return $response;
475
+		if(!$expectJSON) {
476
+			return $response;
477
+		}
448 478
 
449 479
 		// replace ids with their string values, added because of some PHP-version can't handle these large values
450 480
 		$response = preg_replace('/id":(\d+)/', 'id":"\1"', $response);
@@ -502,8 +532,11 @@  discard block
 block discarded – undo
502 532
 			}
503 533
 
504 534
 			// throw exception
505
-			if(isset($json['errors'][0]['message'])) throw new TwitterException($json['errors'][0]['message']);
506
-			else throw new TwitterException('Invalid response.');
535
+			if(isset($json['errors'][0]['message'])) {
536
+				throw new TwitterException($json['errors'][0]['message']);
537
+			} else {
538
+				throw new TwitterException('Invalid response.');
539
+			}
507 540
 		}
508 541
 
509 542
 
@@ -696,8 +729,9 @@  discard block
 block discarded – undo
696 729
 	 */
697 730
 	private static function urlencode_rfc3986($value)
698 731
 	{
699
-		if(is_array($value)) return array_map(array('Twitter', 'urlencode_rfc3986'), $value);
700
-		else
732
+		if(is_array($value)) {
733
+			return array_map(array('Twitter', 'urlencode_rfc3986'), $value);
734
+		} else
701 735
 		{
702 736
 			$search = array('+', ' ', '%7E', '%');
703 737
 			$replace = array('%20', '%20', '~', '%25');
@@ -722,7 +756,9 @@  discard block
 block discarded – undo
722 756
 
723 757
 		// build parameters
724 758
 		$parameters = array();
725
-		if($skipUser) $parameters['skip_user'] = 'true';
759
+		if($skipUser) {
760
+			$parameters['skip_user'] = 'true';
761
+		}
726 762
 
727 763
 		// make the call
728 764
 		return (array) $this->doCall('statuses/public_timeline.json', $parameters);
@@ -746,11 +782,21 @@  discard block
 block discarded – undo
746 782
 
747 783
 		// build parameters
748 784
 		$parameters = array();
749
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
750
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
751
-		if($count != null) $parameters['count'] = (int) $count;
752
-		if($page != null) $parameters['page'] = (int) $page;
753
-		if($skipUser) $parameters['skip_user'] = 'true';
785
+		if($sinceId != null) {
786
+			$parameters['since_id'] = (string) $sinceId;
787
+		}
788
+		if($maxId != null) {
789
+			$parameters['max_id'] = (string) $maxId;
790
+		}
791
+		if($count != null) {
792
+			$parameters['count'] = (int) $count;
793
+		}
794
+		if($page != null) {
795
+			$parameters['page'] = (int) $page;
796
+		}
797
+		if($skipUser) {
798
+			$parameters['skip_user'] = 'true';
799
+		}
754 800
 
755 801
 		// make the call
756 802
 		return (array) $this->doCall('statuses/home_timeline.json', $parameters, true);
@@ -778,11 +824,21 @@  discard block
 block discarded – undo
778 824
 
779 825
 		// build parameters
780 826
 		$parameters = array();
781
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
782
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
783
-		if($count != null) $parameters['count'] = (int) $count;
784
-		if($page != null) $parameters['page'] = (int) $page;
785
-		if($skipUser) $parameters['skip_user'] = 'true';
827
+		if($sinceId != null) {
828
+			$parameters['since_id'] = (string) $sinceId;
829
+		}
830
+		if($maxId != null) {
831
+			$parameters['max_id'] = (string) $maxId;
832
+		}
833
+		if($count != null) {
834
+			$parameters['count'] = (int) $count;
835
+		}
836
+		if($page != null) {
837
+			$parameters['page'] = (int) $page;
838
+		}
839
+		if($skipUser) {
840
+			$parameters['skip_user'] = 'true';
841
+		}
786 842
 
787 843
 		// make the call
788 844
 		return (array) $this->doCall('statuses/friends_timeline.json', $parameters, true);
@@ -813,14 +869,30 @@  discard block
 block discarded – undo
813 869
 
814 870
 		// build parameters
815 871
 		$parameters = array();
816
-		if($id != null) $parameters['id'] = (string) $id;
817
-		if($userId != null) $parameters['user_id'] = (string) $userId;
818
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
819
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
820
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
821
-		if($count != null) $parameters['count'] = (int) $count;
822
-		if($page != null) $parameters['page'] = (int) $page;
823
-		if($skipUser) $parameters['skip_user'] = 'true';
872
+		if($id != null) {
873
+			$parameters['id'] = (string) $id;
874
+		}
875
+		if($userId != null) {
876
+			$parameters['user_id'] = (string) $userId;
877
+		}
878
+		if($screenName != null) {
879
+			$parameters['screen_name'] = (string) $screenName;
880
+		}
881
+		if($sinceId != null) {
882
+			$parameters['since_id'] = (string) $sinceId;
883
+		}
884
+		if($maxId != null) {
885
+			$parameters['max_id'] = (string) $maxId;
886
+		}
887
+		if($count != null) {
888
+			$parameters['count'] = (int) $count;
889
+		}
890
+		if($page != null) {
891
+			$parameters['page'] = (int) $page;
892
+		}
893
+		if($skipUser) {
894
+			$parameters['skip_user'] = 'true';
895
+		}
824 896
 
825 897
 		// make the call
826 898
 		return (array) $this->doCall('statuses/user_timeline.json', $parameters, true);
@@ -839,14 +911,24 @@  discard block
 block discarded – undo
839 911
 	public function statusesMentions($sinceId = null, $maxId = null, $count = null, $page = null)
840 912
 	{
841 913
 		// validate
842
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
914
+		if($count != null && $count > 200) {
915
+			throw new TwitterException('Count may not be greater than 200.');
916
+		}
843 917
 
844 918
 		// build parameters
845 919
 		$parameters = array();
846
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
847
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
848
-		if($count != null) $parameters['count'] = (int) $count;
849
-		if($page != null) $parameters['page'] = (int) $page;
920
+		if($sinceId != null) {
921
+			$parameters['since_id'] = (string) $sinceId;
922
+		}
923
+		if($maxId != null) {
924
+			$parameters['max_id'] = (string) $maxId;
925
+		}
926
+		if($count != null) {
927
+			$parameters['count'] = (int) $count;
928
+		}
929
+		if($page != null) {
930
+			$parameters['page'] = (int) $page;
931
+		}
850 932
 
851 933
 		// make the call
852 934
 		return (array) $this->doCall('statuses/mentions.json', $parameters);
@@ -865,14 +947,24 @@  discard block
 block discarded – undo
865 947
 	public function statusesRetweetedByMe($sinceId = null, $maxId = null, $count = null, $page = null)
866 948
 	{
867 949
 		// validate
868
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
950
+		if($count != null && $count > 200) {
951
+			throw new TwitterException('Count may not be greater than 200.');
952
+		}
869 953
 
870 954
 		// build parameters
871 955
 		$parameters = array();
872
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
873
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
874
-		if($count != null) $parameters['count'] = (int) $count;
875
-		if($page != null) $parameters['page'] = (int) $page;
956
+		if($sinceId != null) {
957
+			$parameters['since_id'] = (string) $sinceId;
958
+		}
959
+		if($maxId != null) {
960
+			$parameters['max_id'] = (string) $maxId;
961
+		}
962
+		if($count != null) {
963
+			$parameters['count'] = (int) $count;
964
+		}
965
+		if($page != null) {
966
+			$parameters['page'] = (int) $page;
967
+		}
876 968
 
877 969
 		// make the call
878 970
 		return (array) $this->doCall('statuses/retweeted_by_me.json', $parameters);
@@ -891,14 +983,24 @@  discard block
 block discarded – undo
891 983
 	public function statusesRetweetedToMe($sinceId = null, $maxId = null, $count = null, $page = null)
892 984
 	{
893 985
 		// validate
894
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
986
+		if($count != null && $count > 200) {
987
+			throw new TwitterException('Count may not be greater than 200.');
988
+		}
895 989
 
896 990
 		// build parameters
897 991
 		$parameters = array();
898
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
899
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
900
-		if($count != null) $parameters['count'] = (int) $count;
901
-		if($page != null) $parameters['page'] = (int) $page;
992
+		if($sinceId != null) {
993
+			$parameters['since_id'] = (string) $sinceId;
994
+		}
995
+		if($maxId != null) {
996
+			$parameters['max_id'] = (string) $maxId;
997
+		}
998
+		if($count != null) {
999
+			$parameters['count'] = (int) $count;
1000
+		}
1001
+		if($page != null) {
1002
+			$parameters['page'] = (int) $page;
1003
+		}
902 1004
 
903 1005
 		// make the call
904 1006
 		return (array) $this->doCall('statuses/retweeted_by_me.json', $parameters);
@@ -918,14 +1020,24 @@  discard block
 block discarded – undo
918 1020
 	public function statusesReweetsOfMe($sinceId = null, $maxId = null, $count = null, $page = null)
919 1021
 	{
920 1022
 		// validate
921
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1023
+		if($count != null && $count > 200) {
1024
+			throw new TwitterException('Count may not be greater than 200.');
1025
+		}
922 1026
 
923 1027
 		// build parameters
924 1028
 		$parameters = array();
925
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
926
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
927
-		if($count != null) $parameters['count'] = (int) $count;
928
-		if($page != null) $parameters['page'] = (int) $page;
1029
+		if($sinceId != null) {
1030
+			$parameters['since_id'] = (string) $sinceId;
1031
+		}
1032
+		if($maxId != null) {
1033
+			$parameters['max_id'] = (string) $maxId;
1034
+		}
1035
+		if($count != null) {
1036
+			$parameters['count'] = (int) $count;
1037
+		}
1038
+		if($page != null) {
1039
+			$parameters['page'] = (int) $page;
1040
+		}
929 1041
 
930 1042
 		// make the call
931 1043
 		return (array) $this->doCall('statuses/retweets_of_me.json', $parameters);
@@ -963,11 +1075,21 @@  discard block
 block discarded – undo
963 1075
 	{
964 1076
 		// build parameters
965 1077
 		$parameters['status'] = (string) $status;
966
-		if($inReplyToStatusId != null) $parameters['in_reply_to_status_id'] = (string) $inReplyToStatusId;
967
-		if($lat != null) $parameters['lat'] = (float) $lat;
968
-		if($long != null) $parameters['long'] = (float) $long;
969
-		if($placeId != null) $parameters['place_id'] = (string) $placeId;
970
-		if($displayCoordinates) $parameters['display_coordinates'] = 'true';
1078
+		if($inReplyToStatusId != null) {
1079
+			$parameters['in_reply_to_status_id'] = (string) $inReplyToStatusId;
1080
+		}
1081
+		if($lat != null) {
1082
+			$parameters['lat'] = (float) $lat;
1083
+		}
1084
+		if($long != null) {
1085
+			$parameters['long'] = (float) $long;
1086
+		}
1087
+		if($placeId != null) {
1088
+			$parameters['place_id'] = (string) $placeId;
1089
+		}
1090
+		if($displayCoordinates) {
1091
+			$parameters['display_coordinates'] = 'true';
1092
+		}
971 1093
 
972 1094
 		// make the call
973 1095
 		return (array) $this->doCall('statuses/update.json', $parameters, true, 'POST');
@@ -1015,11 +1137,15 @@  discard block
 block discarded – undo
1015 1137
 	public function statusesRetweets($id, $count = null)
1016 1138
 	{
1017 1139
 		// validate
1018
-		if($count != null && $count > 100) throw new TwitterException('Count may not be greater than 100.');
1140
+		if($count != null && $count > 100) {
1141
+			throw new TwitterException('Count may not be greater than 100.');
1142
+		}
1019 1143
 
1020 1144
 		// build parameters
1021 1145
 		$parameters = null;
1022
-		if($count != null) $parameters['count'] = (int) $count;
1146
+		if($count != null) {
1147
+			$parameters['count'] = (int) $count;
1148
+		}
1023 1149
 
1024 1150
 		// make the call
1025 1151
 		return (array) $this->doCall('statuses/retweets/'. $id .'.json', $parameters);
@@ -1037,12 +1163,18 @@  discard block
 block discarded – undo
1037 1163
 	public function statusesIdRetweetedBy($id, $count = null, $page = null)
1038 1164
 	{
1039 1165
 		// validate
1040
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1166
+		if($count != null && $count > 200) {
1167
+			throw new TwitterException('Count may not be greater than 200.');
1168
+		}
1041 1169
 
1042 1170
 		// build parameters
1043 1171
 		$parameters = null;
1044
-		if($count != null) $parameters['count'] = (int) $count;
1045
-		if($page != null) $parameters['page'] = (int) $page;
1172
+		if($count != null) {
1173
+			$parameters['count'] = (int) $count;
1174
+		}
1175
+		if($page != null) {
1176
+			$parameters['page'] = (int) $page;
1177
+		}
1046 1178
 
1047 1179
 		// make the call
1048 1180
 		return (array) $this->doCall('statuses/'. (string) $id .'/retweeted_by.json', $parameters, true);
@@ -1060,12 +1192,18 @@  discard block
 block discarded – undo
1060 1192
 	public function statusesIdRetweetedByIds($id, $count = null, $page = null)
1061 1193
 	{
1062 1194
 		// validate
1063
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1195
+		if($count != null && $count > 200) {
1196
+			throw new TwitterException('Count may not be greater than 200.');
1197
+		}
1064 1198
 
1065 1199
 		// build parameters
1066 1200
 		$parameters = null;
1067
-		if($count != null) $parameters['count'] = (int) $count;
1068
-		if($page != null) $parameters['page'] = (int) $page;
1201
+		if($count != null) {
1202
+			$parameters['count'] = (int) $count;
1203
+		}
1204
+		if($page != null) {
1205
+			$parameters['page'] = (int) $page;
1206
+		}
1069 1207
 
1070 1208
 		// make the call
1071 1209
 		return (array) $this->doCall('statuses/'. (string) $id .'/retweeted_by/ids.json', $parameters, true);
@@ -1085,12 +1223,20 @@  discard block
 block discarded – undo
1085 1223
 	public function usersShow($id = null, $userId = null, $screenName = null)
1086 1224
 	{
1087 1225
 		// validate
1088
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1226
+		if($id == '' && $userId == '' && $screenName == '') {
1227
+			throw new TwitterException('Specify an id or an userId or a screenName.');
1228
+		}
1089 1229
 
1090 1230
 		// build parameters
1091
-		if($id != null) $parameters['id'] = (string) $id;
1092
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1093
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1231
+		if($id != null) {
1232
+			$parameters['id'] = (string) $id;
1233
+		}
1234
+		if($userId != null) {
1235
+			$parameters['user_id'] = (string) $userId;
1236
+		}
1237
+		if($screenName != null) {
1238
+			$parameters['screen_name'] = (string) $screenName;
1239
+		}
1094 1240
 
1095 1241
 		// make the call
1096 1242
 		return (array) $this->doCall('users/show.json', $parameters);
@@ -1112,11 +1258,17 @@  discard block
 block discarded – undo
1112 1258
 		$screenNames = (array) $screenNames;
1113 1259
 
1114 1260
 		// validate
1115
-		if(empty($userIds) && empty($screenNames)) throw new TwitterException('Specify an userId or a screenName.');
1261
+		if(empty($userIds) && empty($screenNames)) {
1262
+			throw new TwitterException('Specify an userId or a screenName.');
1263
+		}
1116 1264
 
1117 1265
 		// build parameters
1118
-		if(!empty($userIds)) $parameters['user_id'] = implode(',', $userIds);
1119
-		if(!empty($screenNames)) $parameters['screen_name'] = implode(',', $screenNames);
1266
+		if(!empty($userIds)) {
1267
+			$parameters['user_id'] = implode(',', $userIds);
1268
+		}
1269
+		if(!empty($screenNames)) {
1270
+			$parameters['screen_name'] = implode(',', $screenNames);
1271
+		}
1120 1272
 
1121 1273
 		// make the call
1122 1274
 		return (array) $this->doCall('users/lookup.json', $parameters, true);
@@ -1137,8 +1289,12 @@  discard block
 block discarded – undo
1137 1289
 	{
1138 1290
 		// build parameters
1139 1291
 		$parameters['q'] = (string) $q;
1140
-		if($perPage != null) $parameters['per_page'] = (int) $perPage;
1141
-		if($page != null) $parameters['page'] = (int) $page;
1292
+		if($perPage != null) {
1293
+			$parameters['per_page'] = (int) $perPage;
1294
+		}
1295
+		if($page != null) {
1296
+			$parameters['page'] = (int) $page;
1297
+		}
1142 1298
 
1143 1299
 		// make the call
1144 1300
 		return (array) $this->doCall('users/search.json', $parameters, true);
@@ -1188,10 +1344,18 @@  discard block
 block discarded – undo
1188 1344
 	{
1189 1345
 		// build parameters
1190 1346
 		$parameters = array();
1191
-		if($id != null) $parameters['id'] = (string) $id;
1192
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1193
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1194
-		if($cursor != null) $parameters['cursor'] = (int) $cursor;
1347
+		if($id != null) {
1348
+			$parameters['id'] = (string) $id;
1349
+		}
1350
+		if($userId != null) {
1351
+			$parameters['user_id'] = (string) $userId;
1352
+		}
1353
+		if($screenName != null) {
1354
+			$parameters['screen_name'] = (string) $screenName;
1355
+		}
1356
+		if($cursor != null) {
1357
+			$parameters['cursor'] = (int) $cursor;
1358
+		}
1195 1359
 
1196 1360
 		// make the call
1197 1361
 		return (array) $this->doCall('statuses/friends.json', $parameters);
@@ -1212,10 +1376,18 @@  discard block
 block discarded – undo
1212 1376
 	{
1213 1377
 		// build parameters
1214 1378
 		$parameters = array();
1215
-		if($id != null) $parameters['id'] = (string) $id;
1216
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1217
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1218
-		if($cursor != null) $parameters['cursor'] = (int) $cursor;
1379
+		if($id != null) {
1380
+			$parameters['id'] = (string) $id;
1381
+		}
1382
+		if($userId != null) {
1383
+			$parameters['user_id'] = (string) $userId;
1384
+		}
1385
+		if($screenName != null) {
1386
+			$parameters['screen_name'] = (string) $screenName;
1387
+		}
1388
+		if($cursor != null) {
1389
+			$parameters['cursor'] = (int) $cursor;
1390
+		}
1219 1391
 
1220 1392
 		// make the call
1221 1393
 		return (array) $this->doCall('statuses/followers.json', $parameters);
@@ -1246,7 +1418,9 @@  discard block
 block discarded – undo
1246 1418
 	{
1247 1419
 		// build parameters
1248 1420
 		$parameters = array();
1249
-		if($exclude != null) $parameters['exclude'] = (string) $exclude;
1421
+		if($exclude != null) {
1422
+			$parameters['exclude'] = (string) $exclude;
1423
+		}
1250 1424
 
1251 1425
 		// make the call
1252 1426
 		return (array) $this->doCall('trends/current.json', $parameters);
@@ -1264,8 +1438,12 @@  discard block
 block discarded – undo
1264 1438
 	{
1265 1439
 		// build parameters
1266 1440
 		$parameters = array();
1267
-		if($exclude != null) $parameters['exclude'] = (string) $exclude;
1268
-		if($date != null) $parameters['date'] = (string) $date;
1441
+		if($exclude != null) {
1442
+			$parameters['exclude'] = (string) $exclude;
1443
+		}
1444
+		if($date != null) {
1445
+			$parameters['date'] = (string) $date;
1446
+		}
1269 1447
 
1270 1448
 		// make the call
1271 1449
 		return (array) $this->doCall('trends/daily.json', $parameters);
@@ -1283,8 +1461,12 @@  discard block
 block discarded – undo
1283 1461
 	{
1284 1462
 		// build parameters
1285 1463
 		$parameters = array();
1286
-		if($exclude != null) $parameters['exclude'] = (string) $exclude;
1287
-		if($date != null) $parameters['date'] = (string) $date;
1464
+		if($exclude != null) {
1465
+			$parameters['exclude'] = (string) $exclude;
1466
+		}
1467
+		if($date != null) {
1468
+			$parameters['date'] = (string) $date;
1469
+		}
1288 1470
 
1289 1471
 		// make the call
1290 1472
 		return (array) $this->doCall('trends/weekly.json', $parameters);
@@ -1307,12 +1489,18 @@  discard block
 block discarded – undo
1307 1489
 		$allowedModes = array('public', 'private');
1308 1490
 
1309 1491
 		// validate
1310
-		if($mode != null && !in_array($mode, $allowedModes)) throw new TwitterException('Invalid mode (), possible values are: '. implode($allowedModes) .'.');
1492
+		if($mode != null && !in_array($mode, $allowedModes)) {
1493
+			throw new TwitterException('Invalid mode (), possible values are: '. implode($allowedModes) .'.');
1494
+		}
1311 1495
 
1312 1496
 		// build parameters
1313 1497
 		$parameters['name'] = (string) $name;
1314
-		if($mode != null) $parameters['mode'] = (string) $mode;
1315
-		if($description != null) $parameters['description'] = (string) $description;
1498
+		if($mode != null) {
1499
+			$parameters['mode'] = (string) $mode;
1500
+		}
1501
+		if($description != null) {
1502
+			$parameters['description'] = (string) $description;
1503
+		}
1316 1504
 
1317 1505
 		// make the call
1318 1506
 		return (array) $this->doCall((string) $user .'/lists.json', $parameters, true, 'POST');
@@ -1329,7 +1517,9 @@  discard block
 block discarded – undo
1329 1517
 	public function userLists($user, $cursor = null)
1330 1518
 	{
1331 1519
 		$parameters = null;
1332
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1520
+		if($cursor != null) {
1521
+			$parameters['cursor'] = (string) $cursor;
1522
+		}
1333 1523
 
1334 1524
 		// make the call
1335 1525
 		return (array) $this->doCall((string) $user .'/lists.json', $parameters, true);
@@ -1366,12 +1556,20 @@  discard block
 block discarded – undo
1366 1556
 		$allowedModes = array('public', 'private');
1367 1557
 
1368 1558
 		// validate
1369
-		if($mode != null && !in_array($mode, $allowedModes)) throw new TwitterException('Invalid mode (), possible values are: '. implode($allowedModes) .'.');
1559
+		if($mode != null && !in_array($mode, $allowedModes)) {
1560
+			throw new TwitterException('Invalid mode (), possible values are: '. implode($allowedModes) .'.');
1561
+		}
1370 1562
 
1371 1563
 		// build parameters
1372
-		if($name != null) $parameters['name'] = (string) $name;
1373
-		if($mode != null) $parameters['mode'] = (string) $mode;
1374
-		if($description != null) $parameters['description'] = (string) $description;
1564
+		if($name != null) {
1565
+			$parameters['name'] = (string) $name;
1566
+		}
1567
+		if($mode != null) {
1568
+			$parameters['mode'] = (string) $mode;
1569
+		}
1570
+		if($description != null) {
1571
+			$parameters['description'] = (string) $description;
1572
+		}
1375 1573
 
1376 1574
 		// make the call
1377 1575
 		return (array) $this->doCall((string) $user .'/lists/'. (string) $id .'.json', $parameters, true, 'POST');
@@ -1392,14 +1590,24 @@  discard block
 block discarded – undo
1392 1590
 	public function userListsIdStatuses($user, $id, $sinceId = null, $maxId = null, $count = null, $page = null)
1393 1591
 	{
1394 1592
 		// validate
1395
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1593
+		if($count != null && $count > 200) {
1594
+			throw new TwitterException('Count may not be greater than 200.');
1595
+		}
1396 1596
 
1397 1597
 		// build parameters
1398 1598
 		$parameters = array();
1399
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
1400
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
1401
-		if($count != null) $parameters['per_page'] = (int) $count;
1402
-		if($page != null) $parameters['page'] = (int) $page;
1599
+		if($sinceId != null) {
1600
+			$parameters['since_id'] = (string) $sinceId;
1601
+		}
1602
+		if($maxId != null) {
1603
+			$parameters['max_id'] = (string) $maxId;
1604
+		}
1605
+		if($count != null) {
1606
+			$parameters['per_page'] = (int) $count;
1607
+		}
1608
+		if($page != null) {
1609
+			$parameters['page'] = (int) $page;
1610
+		}
1403 1611
 
1404 1612
 		// make the call
1405 1613
 		return (array) $this->doCall((string) $user .'/lists/'. (string) $id .'/statuses.json', $parameters);
@@ -1416,7 +1624,9 @@  discard block
 block discarded – undo
1416 1624
 	public function userListsMemberships($user, $cursor = null)
1417 1625
 	{
1418 1626
 		$parameters = null;
1419
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1627
+		if($cursor != null) {
1628
+			$parameters['cursor'] = (string) $cursor;
1629
+		}
1420 1630
 
1421 1631
 		// make the call
1422 1632
 		return (array) $this->doCall((string) $user .'/lists/memberships.json', $parameters, true);
@@ -1433,7 +1643,9 @@  discard block
 block discarded – undo
1433 1643
 	public function userListsSubscriptions($user, $cursor = null)
1434 1644
 	{
1435 1645
 		$parameters = null;
1436
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1646
+		if($cursor != null) {
1647
+			$parameters['cursor'] = (string) $cursor;
1648
+		}
1437 1649
 
1438 1650
 		// make the call
1439 1651
 		return (array) $this->doCall((string) $user .'/lists/subscriptions.json', $parameters, true);
@@ -1452,7 +1664,9 @@  discard block
 block discarded – undo
1452 1664
 	public function userListMembers($user, $id, $cursor = null)
1453 1665
 	{
1454 1666
 		$parameters = null;
1455
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1667
+		if($cursor != null) {
1668
+			$parameters['cursor'] = (string) $cursor;
1669
+		}
1456 1670
 
1457 1671
 		// make the call
1458 1672
 		return (array) $this->doCall((string) $user .'/'. (string) $id .'/members.json', $parameters, true);
@@ -1515,8 +1729,11 @@  discard block
 block discarded – undo
1515 1729
 		// catch exceptions
1516 1730
 		catch(TwitterException $e)
1517 1731
 		{
1518
-			if($e->getMessage() == 'The specified user is not a member of this list') return false;
1519
-			else throw $e;
1732
+			if($e->getMessage() == 'The specified user is not a member of this list') {
1733
+				return false;
1734
+			} else {
1735
+				throw $e;
1736
+			}
1520 1737
 		}
1521 1738
 	}
1522 1739
 
@@ -1533,7 +1750,9 @@  discard block
 block discarded – undo
1533 1750
 	public function userListSubscribers($user, $id, $cursor = null)
1534 1751
 	{
1535 1752
 		$parameters = null;
1536
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
1753
+		if($cursor != null) {
1754
+			$parameters['cursor'] = (string) $cursor;
1755
+		}
1537 1756
 
1538 1757
 		// make the call
1539 1758
 		return (array) $this->doCall((string) $user .'/'. (string) $id .'/subscribers.json', $parameters, true);
@@ -1590,8 +1809,11 @@  discard block
 block discarded – undo
1590 1809
 		// catch exceptions
1591 1810
 		catch(TwitterException $e)
1592 1811
 		{
1593
-			if($e->getMessage() == 'The specified user is not a subscriber of this list') return false;
1594
-			else throw $e;
1812
+			if($e->getMessage() == 'The specified user is not a subscriber of this list') {
1813
+				return false;
1814
+			} else {
1815
+				throw $e;
1816
+			}
1595 1817
 		}
1596 1818
 
1597 1819
 	}
@@ -1610,14 +1832,24 @@  discard block
 block discarded – undo
1610 1832
 	public function directMessages($sinceId = null, $maxId = null, $count = null, $page = null)
1611 1833
 	{
1612 1834
 		// validate
1613
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1835
+		if($count != null && $count > 200) {
1836
+			throw new TwitterException('Count may not be greater than 200.');
1837
+		}
1614 1838
 
1615 1839
 		// build parameters
1616 1840
 		$parameters = array();
1617
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
1618
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
1619
-		if($count != null) $parameters['count'] = (int) $count;
1620
-		if($page != null) $parameters['page'] = (int) $page;
1841
+		if($sinceId != null) {
1842
+			$parameters['since_id'] = (string) $sinceId;
1843
+		}
1844
+		if($maxId != null) {
1845
+			$parameters['max_id'] = (string) $maxId;
1846
+		}
1847
+		if($count != null) {
1848
+			$parameters['count'] = (int) $count;
1849
+		}
1850
+		if($page != null) {
1851
+			$parameters['page'] = (int) $page;
1852
+		}
1621 1853
 
1622 1854
 		// make the call
1623 1855
 		return (array) $this->doCall('direct_messages.json', $parameters, true);
@@ -1636,14 +1868,24 @@  discard block
 block discarded – undo
1636 1868
 	public function directMessagesSent($sinceId = null, $maxId = null, $count = null, $page = null)
1637 1869
 	{
1638 1870
 		// validate
1639
-		if($count != null && $count > 200) throw new TwitterException('Count may not be greater than 200.');
1871
+		if($count != null && $count > 200) {
1872
+			throw new TwitterException('Count may not be greater than 200.');
1873
+		}
1640 1874
 
1641 1875
 		// build parameters
1642 1876
 		$parameters = array();
1643
-		if($sinceId != null) $parameters['since_id'] = (string) $sinceId;
1644
-		if($maxId != null) $parameters['max_id'] = (string) $maxId;
1645
-		if($count != null) $parameters['count'] = (int) $count;
1646
-		if($page != null) $parameters['page'] = (int) $page;
1877
+		if($sinceId != null) {
1878
+			$parameters['since_id'] = (string) $sinceId;
1879
+		}
1880
+		if($maxId != null) {
1881
+			$parameters['max_id'] = (string) $maxId;
1882
+		}
1883
+		if($count != null) {
1884
+			$parameters['count'] = (int) $count;
1885
+		}
1886
+		if($page != null) {
1887
+			$parameters['page'] = (int) $page;
1888
+		}
1647 1889
 
1648 1890
 		// make the call
1649 1891
 		return (array) $this->doCall('direct_messages/sent.json', $parameters, true);
@@ -1663,13 +1905,21 @@  discard block
 block discarded – undo
1663 1905
 	public function directMessagesNew($text, $id = null, $userId = null, $screenName = null)
1664 1906
 	{
1665 1907
 		// validate
1666
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1908
+		if($id == '' && $userId == '' && $screenName == '') {
1909
+			throw new TwitterException('Specify an id or an userId or a screenName.');
1910
+		}
1667 1911
 
1668 1912
 		// build parameters
1669 1913
 		$parameters['text'] = (string) $text;
1670
-		if($id != null) $parameters['user'] = (string) $id;
1671
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1672
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1914
+		if($id != null) {
1915
+			$parameters['user'] = (string) $id;
1916
+		}
1917
+		if($userId != null) {
1918
+			$parameters['user_id'] = (string) $userId;
1919
+		}
1920
+		if($screenName != null) {
1921
+			$parameters['screen_name'] = (string) $screenName;
1922
+		}
1673 1923
 
1674 1924
 		// make the call
1675 1925
 		return (array) $this->doCall('direct_messages/new.json', $parameters, true, 'POST');
@@ -1707,12 +1957,20 @@  discard block
 block discarded – undo
1707 1957
 	public function friendshipsCreate($id = null, $userId = null, $screenName = null, $follow = false)
1708 1958
 	{
1709 1959
 		// validate
1710
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1960
+		if($id == '' && $userId == '' && $screenName == '') {
1961
+			throw new TwitterException('Specify an id or an userId or a screenName.');
1962
+		}
1711 1963
 
1712 1964
 		// build parameters
1713
-		if($id != null) $parameters['id'] = (string) $id;
1714
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1715
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1965
+		if($id != null) {
1966
+			$parameters['id'] = (string) $id;
1967
+		}
1968
+		if($userId != null) {
1969
+			$parameters['user_id'] = (string) $userId;
1970
+		}
1971
+		if($screenName != null) {
1972
+			$parameters['screen_name'] = (string) $screenName;
1973
+		}
1716 1974
 		$parameters['follow'] = ($follow) ? 'true' : 'false';
1717 1975
 
1718 1976
 		// make the call
@@ -1732,12 +1990,20 @@  discard block
 block discarded – undo
1732 1990
 	public function friendshipsDestroy($id = null, $userId = null, $screenName = null)
1733 1991
 	{
1734 1992
 		// validate
1735
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
1993
+		if($id == '' && $userId == '' && $screenName == '') {
1994
+			throw new TwitterException('Specify an id or an userId or a screenName.');
1995
+		}
1736 1996
 
1737 1997
 		// build parameters
1738
-		if($id != null) $parameters['id'] = (string) $id;
1739
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1740
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1998
+		if($id != null) {
1999
+			$parameters['id'] = (string) $id;
2000
+		}
2001
+		if($userId != null) {
2002
+			$parameters['user_id'] = (string) $userId;
2003
+		}
2004
+		if($screenName != null) {
2005
+			$parameters['screen_name'] = (string) $screenName;
2006
+		}
1741 2007
 
1742 2008
 		// make the call
1743 2009
 		return (array) $this->doCall('friendships/destroy.json', $parameters, true, 'POST');
@@ -1774,14 +2040,26 @@  discard block
 block discarded – undo
1774 2040
 	public function friendshipsShow($sourceId = null, $sourceScreenName = null, $targetId = null, $targetScreenName = null)
1775 2041
 	{
1776 2042
 		// validate
1777
-		if($sourceId == '' && $sourceScreenName == '') throw new TwitterException('Specify an sourceId or a sourceScreenName.');
1778
-		if($targetId == '' && $targetScreenName == '') throw new TwitterException('Specify an targetId or a targetScreenName.');
2043
+		if($sourceId == '' && $sourceScreenName == '') {
2044
+			throw new TwitterException('Specify an sourceId or a sourceScreenName.');
2045
+		}
2046
+		if($targetId == '' && $targetScreenName == '') {
2047
+			throw new TwitterException('Specify an targetId or a targetScreenName.');
2048
+		}
1779 2049
 
1780 2050
 		// build parameters
1781
-		if($sourceId != null) $parameters['source_id'] = (string) $sourceId;
1782
-		if($sourceScreenName != null) $parameters['source_screen_name'] = (string) $sourceScreenName;
1783
-		if($targetId != null) $parameters['target_id'] = (string) $targetId;
1784
-		if($targetScreenName != null) $parameters['target_screen_name'] = (string) $targetScreenName;
2051
+		if($sourceId != null) {
2052
+			$parameters['source_id'] = (string) $sourceId;
2053
+		}
2054
+		if($sourceScreenName != null) {
2055
+			$parameters['source_screen_name'] = (string) $sourceScreenName;
2056
+		}
2057
+		if($targetId != null) {
2058
+			$parameters['target_id'] = (string) $targetId;
2059
+		}
2060
+		if($targetScreenName != null) {
2061
+			$parameters['target_screen_name'] = (string) $targetScreenName;
2062
+		}
1785 2063
 
1786 2064
 		// make the call
1787 2065
 		return (array) $this->doCall('friendships/show.json', $parameters);
@@ -1797,7 +2075,9 @@  discard block
 block discarded – undo
1797 2075
 	public function friendshipsIncoming($cursor = null)
1798 2076
 	{
1799 2077
 		$parameters = null;
1800
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
2078
+		if($cursor != null) {
2079
+			$parameters['cursor'] = (string) $cursor;
2080
+		}
1801 2081
 
1802 2082
 		// make the call
1803 2083
 		return (array) $this->doCall('friendships/incoming.json', $parameters, true);
@@ -1813,7 +2093,9 @@  discard block
 block discarded – undo
1813 2093
 	public function friendshipsOutgoing($cursor = null)
1814 2094
 	{
1815 2095
 		$parameters = null;
1816
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
2096
+		if($cursor != null) {
2097
+			$parameters['cursor'] = (string) $cursor;
2098
+		}
1817 2099
 
1818 2100
 		// make the call
1819 2101
 		return (array) $this->doCall('friendships/outgoing.json', $parameters, true);
@@ -1833,13 +2115,23 @@  discard block
 block discarded – undo
1833 2115
 	public function friendsIds($id = null, $userId = null, $screenName = null, $cursor = null)
1834 2116
 	{
1835 2117
 		// validate
1836
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2118
+		if($id == '' && $userId == '' && $screenName == '') {
2119
+			throw new TwitterException('Specify an id or an userId or a screenName.');
2120
+		}
1837 2121
 
1838 2122
 		// build parameters
1839
-		if($id != null) $parameters['id'] = (string) $id;
1840
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1841
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1842
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
2123
+		if($id != null) {
2124
+			$parameters['id'] = (string) $id;
2125
+		}
2126
+		if($userId != null) {
2127
+			$parameters['user_id'] = (string) $userId;
2128
+		}
2129
+		if($screenName != null) {
2130
+			$parameters['screen_name'] = (string) $screenName;
2131
+		}
2132
+		if($cursor != null) {
2133
+			$parameters['cursor'] = (string) $cursor;
2134
+		}
1843 2135
 
1844 2136
 		// make the call
1845 2137
 		return (array) $this->doCall('friends/ids.json', $parameters);
@@ -1858,13 +2150,23 @@  discard block
 block discarded – undo
1858 2150
 	public function followersIds($id = null, $userId = null, $screenName = null, $cursor = null)
1859 2151
 	{
1860 2152
 		// validate
1861
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2153
+		if($id == '' && $userId == '' && $screenName == '') {
2154
+			throw new TwitterException('Specify an id or an userId or a screenName.');
2155
+		}
1862 2156
 
1863 2157
 		// build parameters
1864
-		if($id != null) $parameters['id'] = (string) $id;
1865
-		if($userId != null) $parameters['user_id'] = (string) $userId;
1866
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
1867
-		if($cursor != null) $parameters['cursor'] = (string) $cursor;
2158
+		if($id != null) {
2159
+			$parameters['id'] = (string) $id;
2160
+		}
2161
+		if($userId != null) {
2162
+			$parameters['user_id'] = (string) $userId;
2163
+		}
2164
+		if($screenName != null) {
2165
+			$parameters['screen_name'] = (string) $screenName;
2166
+		}
2167
+		if($cursor != null) {
2168
+			$parameters['cursor'] = (string) $cursor;
2169
+		}
1868 2170
 
1869 2171
 		// make the call
1870 2172
 		return (array) $this->doCall('followers/ids.json', $parameters);
@@ -1911,8 +2213,11 @@  discard block
 block discarded – undo
1911 2213
 		// catch exceptions
1912 2214
 		catch(TwitterException $e)
1913 2215
 		{
1914
-			if($e->getMessage() == 'Logged out.') return true;
1915
-			else throw $e;
2216
+			if($e->getMessage() == 'Logged out.') {
2217
+				return true;
2218
+			} else {
2219
+				throw $e;
2220
+			}
1916 2221
 		}
1917 2222
 	}
1918 2223
 
@@ -1947,14 +2252,26 @@  discard block
 block discarded – undo
1947 2252
 	public function accountUpdateProfileColors($profileBackgroundColor = null, $profileTextColor = null, $profileLinkColor = null, $profileSidebarFillColor = null, $profileSidebarBorderColor = null)
1948 2253
 	{
1949 2254
 		// validate
1950
-		if($profileBackgroundColor == '' && $profileTextColor == '' && $profileLinkColor == '' && $profileSidebarFillColor == '' && $profileSidebarBorderColor == '') throw new TwitterException('Specify a profileBackgroundColor, profileTextColor, profileLinkColor, profileSidebarFillColor or a profileSidebarBorderColor.');
2255
+		if($profileBackgroundColor == '' && $profileTextColor == '' && $profileLinkColor == '' && $profileSidebarFillColor == '' && $profileSidebarBorderColor == '') {
2256
+			throw new TwitterException('Specify a profileBackgroundColor, profileTextColor, profileLinkColor, profileSidebarFillColor or a profileSidebarBorderColor.');
2257
+		}
1951 2258
 
1952 2259
 		// build parameters
1953
-		if($profileBackgroundColor != null) $parameters['profile_background_color'] = (string) $profileBackgroundColor;
1954
-		if($profileTextColor != null) $parameters['profile_text_color'] = (string) $profileTextColor;
1955
-		if($profileLinkColor != null) $parameters['profile_link_color'] = (string) $profileLinkColor;
1956
-		if($profileSidebarFillColor != null) $parameters['profile_sidebar_fill_color'] = (string) $profileSidebarFillColor;
1957
-		if($profileSidebarBorderColor != null) $parameters['profile_sidebar_border_color'] = (string) $profileSidebarBorderColor;
2260
+		if($profileBackgroundColor != null) {
2261
+			$parameters['profile_background_color'] = (string) $profileBackgroundColor;
2262
+		}
2263
+		if($profileTextColor != null) {
2264
+			$parameters['profile_text_color'] = (string) $profileTextColor;
2265
+		}
2266
+		if($profileLinkColor != null) {
2267
+			$parameters['profile_link_color'] = (string) $profileLinkColor;
2268
+		}
2269
+		if($profileSidebarFillColor != null) {
2270
+			$parameters['profile_sidebar_fill_color'] = (string) $profileSidebarFillColor;
2271
+		}
2272
+		if($profileSidebarBorderColor != null) {
2273
+			$parameters['profile_sidebar_border_color'] = (string) $profileSidebarBorderColor;
2274
+		}
1958 2275
 
1959 2276
 		// make the call
1960 2277
 		return (array) $this->doCall('account/update_profile_colors.json', $parameters, true, 'POST');
@@ -1972,7 +2289,9 @@  discard block
 block discarded – undo
1972 2289
 		throw new TwitterException('Not implemented');
1973 2290
 
1974 2291
 		// validate
1975
-		if(!file_exists($image)) throw new TwitterException('Image ('. $image .') doesn\'t exists.');
2292
+		if(!file_exists($image)) {
2293
+			throw new TwitterException('Image ('. $image .') doesn\'t exists.');
2294
+		}
1976 2295
 
1977 2296
 		// make the call
1978 2297
 		return (array) $this->doCall('account/update_profile_image.json', null, true, 'POST', $image);
@@ -1991,10 +2310,14 @@  discard block
 block discarded – undo
1991 2310
 		throw new TwitterException('Not implemented');
1992 2311
 
1993 2312
 		// validate
1994
-		if(!file_exists($image)) throw new TwitterException('Image ('. $image .') doesn\'t exists.');
2313
+		if(!file_exists($image)) {
2314
+			throw new TwitterException('Image ('. $image .') doesn\'t exists.');
2315
+		}
1995 2316
 
1996 2317
 		// build parameters
1997
-		if($tile) $parameters['tile'] = 'true';
2318
+		if($tile) {
2319
+			$parameters['tile'] = 'true';
2320
+		}
1998 2321
 
1999 2322
 		// make the call
2000 2323
 		return (array) $this->doCall('account/update_profile_background_image.json', $parameters, true, 'POST', $image);
@@ -2014,10 +2337,18 @@  discard block
 block discarded – undo
2014 2337
 	{
2015 2338
 		// build parameters
2016 2339
 		$parameters = null;
2017
-		if($name != null) $parameters['name'] = (string) $name;
2018
-		if($url != null) $parameters['url'] = (string) $url;
2019
-		if($location != null) $parameters['location'] = (string) $location;
2020
-		if($description != null) $parameters['description'] = (string) $description;
2340
+		if($name != null) {
2341
+			$parameters['name'] = (string) $name;
2342
+		}
2343
+		if($url != null) {
2344
+			$parameters['url'] = (string) $url;
2345
+		}
2346
+		if($location != null) {
2347
+			$parameters['location'] = (string) $location;
2348
+		}
2349
+		if($description != null) {
2350
+			$parameters['description'] = (string) $description;
2351
+		}
2021 2352
 
2022 2353
 		// make the call
2023 2354
 		return (array) $this->doCall('account/update_profile.json', $parameters, true, 'POST');
@@ -2036,8 +2367,12 @@  discard block
 block discarded – undo
2036 2367
 	{
2037 2368
 		// build parameters
2038 2369
 		$parameters = null;
2039
-		if($id != null) $parameters['id'] = (string) $id;
2040
-		if($page != null) $parameters['page'] = (int) $page;
2370
+		if($id != null) {
2371
+			$parameters['id'] = (string) $id;
2372
+		}
2373
+		if($page != null) {
2374
+			$parameters['page'] = (int) $page;
2375
+		}
2041 2376
 
2042 2377
 		// make the call
2043 2378
 		return (array) $this->doCall('favorites.json', $parameters, true);
@@ -2082,12 +2417,20 @@  discard block
 block discarded – undo
2082 2417
 	public function notificationsFollow($id = null, $userId = null, $screenName = null)
2083 2418
 	{
2084 2419
 		// validate
2085
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2420
+		if($id == '' && $userId == '' && $screenName == '') {
2421
+			throw new TwitterException('Specify an id or an userId or a screenName.');
2422
+		}
2086 2423
 
2087 2424
 		// build parameters
2088
-		if($id != null) $parameters['id'] = (string) $id;
2089
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2090
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2425
+		if($id != null) {
2426
+			$parameters['id'] = (string) $id;
2427
+		}
2428
+		if($userId != null) {
2429
+			$parameters['user_id'] = (string) $userId;
2430
+		}
2431
+		if($screenName != null) {
2432
+			$parameters['screen_name'] = (string) $screenName;
2433
+		}
2091 2434
 
2092 2435
 		// make the call
2093 2436
 		return (array) $this->doCall('notifications/follow.json', $parameters, true, 'POST');
@@ -2105,12 +2448,20 @@  discard block
 block discarded – undo
2105 2448
 	public function notificationsLeave($id = null, $userId = null, $screenName = null)
2106 2449
 	{
2107 2450
 		// validate
2108
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2451
+		if($id == '' && $userId == '' && $screenName == '') {
2452
+			throw new TwitterException('Specify an id or an userId or a screenName.');
2453
+		}
2109 2454
 
2110 2455
 		// build parameters
2111
-		if($id != null) $parameters['id'] = (string) $id;
2112
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2113
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2456
+		if($id != null) {
2457
+			$parameters['id'] = (string) $id;
2458
+		}
2459
+		if($userId != null) {
2460
+			$parameters['user_id'] = (string) $userId;
2461
+		}
2462
+		if($screenName != null) {
2463
+			$parameters['screen_name'] = (string) $screenName;
2464
+		}
2114 2465
 
2115 2466
 		// make the call
2116 2467
 		return (array) $this->doCall('notifications/leave.json', $parameters, true, 'POST');
@@ -2129,12 +2480,20 @@  discard block
 block discarded – undo
2129 2480
 	public function blocksCreate($id = null, $userId = null, $screenName = null)
2130 2481
 	{
2131 2482
 		// validate
2132
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2483
+		if($id == '' && $userId == '' && $screenName == '') {
2484
+			throw new TwitterException('Specify an id or an userId or a screenName.');
2485
+		}
2133 2486
 
2134 2487
 		// build parameters
2135
-		if($id != null) $parameters['id'] = (string) $id;
2136
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2137
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2488
+		if($id != null) {
2489
+			$parameters['id'] = (string) $id;
2490
+		}
2491
+		if($userId != null) {
2492
+			$parameters['user_id'] = (string) $userId;
2493
+		}
2494
+		if($screenName != null) {
2495
+			$parameters['screen_name'] = (string) $screenName;
2496
+		}
2138 2497
 
2139 2498
 		// make the call
2140 2499
 		return (array) $this->doCall('blocks/create.json', $parameters, true, 'POST');
@@ -2152,12 +2511,20 @@  discard block
 block discarded – undo
2152 2511
 	public function blocksDestroy($id = null, $userId = null, $screenName = null)
2153 2512
 	{
2154 2513
 		// validate
2155
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2514
+		if($id == '' && $userId == '' && $screenName == '') {
2515
+			throw new TwitterException('Specify an id or an userId or a screenName.');
2516
+		}
2156 2517
 
2157 2518
 		// build parameters
2158
-		if($id != null) $parameters['id'] = (string) $id;
2159
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2160
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2519
+		if($id != null) {
2520
+			$parameters['id'] = (string) $id;
2521
+		}
2522
+		if($userId != null) {
2523
+			$parameters['user_id'] = (string) $userId;
2524
+		}
2525
+		if($screenName != null) {
2526
+			$parameters['screen_name'] = (string) $screenName;
2527
+		}
2161 2528
 
2162 2529
 		// make the call
2163 2530
 		return (array) $this->doCall('blocks/destroy.json', $parameters, true, 'POST');
@@ -2175,12 +2542,20 @@  discard block
 block discarded – undo
2175 2542
 	public function blocksExists($id = null, $userId = null, $screenName = null)
2176 2543
 	{
2177 2544
 		// validate
2178
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2545
+		if($id == '' && $userId == '' && $screenName == '') {
2546
+			throw new TwitterException('Specify an id or an userId or a screenName.');
2547
+		}
2179 2548
 
2180 2549
 		// build parameters
2181
-		if($id != null) $parameters['id'] = (string) $id;
2182
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2183
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2550
+		if($id != null) {
2551
+			$parameters['id'] = (string) $id;
2552
+		}
2553
+		if($userId != null) {
2554
+			$parameters['user_id'] = (string) $userId;
2555
+		}
2556
+		if($screenName != null) {
2557
+			$parameters['screen_name'] = (string) $screenName;
2558
+		}
2184 2559
 
2185 2560
 		try
2186 2561
 		{
@@ -2190,8 +2565,11 @@  discard block
 block discarded – undo
2190 2565
 		// catch exceptions
2191 2566
 		catch(TwitterException $e)
2192 2567
 		{
2193
-			if($e->getMessage() == 'You are not blocking this user.') return false;
2194
-			else throw $e;
2568
+			if($e->getMessage() == 'You are not blocking this user.') {
2569
+				return false;
2570
+			} else {
2571
+				throw $e;
2572
+			}
2195 2573
 		}
2196 2574
 	}
2197 2575
 
@@ -2206,7 +2584,9 @@  discard block
 block discarded – undo
2206 2584
 	{
2207 2585
 		// build parameters
2208 2586
 		$parameters = null;
2209
-		if($page != null) $parameters['page'] = (int) $page;
2587
+		if($page != null) {
2588
+			$parameters['page'] = (int) $page;
2589
+		}
2210 2590
 
2211 2591
 		// make the call
2212 2592
 		return (array) $this->doCall('blocks/blocking.json', $parameters, true);
@@ -2237,12 +2617,20 @@  discard block
 block discarded – undo
2237 2617
 	public function reportSpam($id = null, $userId = null, $screenName = null)
2238 2618
 	{
2239 2619
 		// validate
2240
-		if($id == '' && $userId == '' && $screenName == '') throw new TwitterException('Specify an id or an userId or a screenName.');
2620
+		if($id == '' && $userId == '' && $screenName == '') {
2621
+			throw new TwitterException('Specify an id or an userId or a screenName.');
2622
+		}
2241 2623
 
2242 2624
 		// build parameters
2243
-		if($id != null) $parameters['id'] = (string) $id;
2244
-		if($userId != null) $parameters['user_id'] = (string) $userId;
2245
-		if($screenName != null) $parameters['screen_name'] = (string) $screenName;
2625
+		if($id != null) {
2626
+			$parameters['id'] = (string) $id;
2627
+		}
2628
+		if($userId != null) {
2629
+			$parameters['user_id'] = (string) $userId;
2630
+		}
2631
+		if($screenName != null) {
2632
+			$parameters['screen_name'] = (string) $screenName;
2633
+		}
2246 2634
 
2247 2635
 		// make the call
2248 2636
 		return (array) $this->doCall('report_spam.json', $parameters, true, 'POST');
@@ -2321,17 +2709,25 @@  discard block
 block discarded – undo
2321 2709
 		$parameters = array();
2322 2710
 
2323 2711
 		// set callback
2324
-		if($callbackURL != null) $parameters['oauth_callback'] = (string) $callbackURL;
2712
+		if($callbackURL != null) {
2713
+			$parameters['oauth_callback'] = (string) $callbackURL;
2714
+		}
2325 2715
 
2326 2716
 		// make the call
2327 2717
 		$response = $this->doOAuthCall('request_token', $parameters);
2328 2718
 
2329 2719
 		// validate
2330
-		if(!isset($response['oauth_token'], $response['oauth_token_secret'])) throw new TwitterException(implode(', ', array_keys($response)));
2720
+		if(!isset($response['oauth_token'], $response['oauth_token_secret'])) {
2721
+			throw new TwitterException(implode(', ', array_keys($response)));
2722
+		}
2331 2723
 
2332 2724
 		// set some properties
2333
-		if(isset($response['oauth_token'])) $this->setOAuthToken($response['oauth_token']);
2334
-		if(isset($response['oauth_token_secret'])) $this->setOAuthTokenSecret($response['oauth_token_secret']);
2725
+		if(isset($response['oauth_token'])) {
2726
+			$this->setOAuthToken($response['oauth_token']);
2727
+		}
2728
+		if(isset($response['oauth_token_secret'])) {
2729
+			$this->setOAuthTokenSecret($response['oauth_token_secret']);
2730
+		}
2335 2731
 
2336 2732
 		// return
2337 2733
 		return $response;
@@ -2357,8 +2753,12 @@  discard block
 block discarded – undo
2357 2753
 		$response = $this->doOAuthCall('access_token', $parameters);
2358 2754
 
2359 2755
 		// set some properties
2360
-		if(isset($response['oauth_token'])) $this->setOAuthToken($response['oauth_token']);
2361
-		if(isset($response['oauth_token_secret'])) $this->setOAuthTokenSecret($response['oauth_token_secret']);
2756
+		if(isset($response['oauth_token'])) {
2757
+			$this->setOAuthToken($response['oauth_token']);
2758
+		}
2759
+		if(isset($response['oauth_token_secret'])) {
2760
+			$this->setOAuthTokenSecret($response['oauth_token_secret']);
2761
+		}
2362 2762
 
2363 2763
 		// return
2364 2764
 		return $response;
@@ -2403,8 +2803,12 @@  discard block
 block discarded – undo
2403 2803
 	{
2404 2804
 		// build parameters
2405 2805
 		$parameters = null;
2406
-		if($lat != null) $parameters['lat_for_trends'] = (float) $lat;
2407
-		if($long != null) $parameters['long_for_trends'] = (float) $long;
2806
+		if($lat != null) {
2807
+			$parameters['lat_for_trends'] = (float) $lat;
2808
+		}
2809
+		if($long != null) {
2810
+			$parameters['long_for_trends'] = (float) $long;
2811
+		}
2408 2812
 
2409 2813
 		// make the call
2410 2814
 		return (array) $this->doCall('trends/available.json', $parameters);
@@ -2446,9 +2850,15 @@  discard block
 block discarded – undo
2446 2850
 		// build parameters
2447 2851
 		$parameters['lat'] = (float) $lat;
2448 2852
 		$parameters['long'] = (float) $long;
2449
-		if($accuracy != null) $parameters['accuracy'] = (string) $accuracy;
2450
-		if($granularity != null) $parameters['granularity'] = (string) $granularity;
2451
-		if($maxResults != null) $parameters['max_results'] = (int) $maxResults;
2853
+		if($accuracy != null) {
2854
+			$parameters['accuracy'] = (string) $accuracy;
2855
+		}
2856
+		if($granularity != null) {
2857
+			$parameters['granularity'] = (string) $granularity;
2858
+		}
2859
+		if($maxResults != null) {
2860
+			$parameters['max_results'] = (int) $maxResults;
2861
+		}
2452 2862
 
2453 2863
 		// make the call
2454 2864
 		return (array) $this->doCall('geo/reverse_geocode.json', $parameters);
@@ -2466,7 +2876,9 @@  discard block
 block discarded – undo
2466 2876
 	{
2467 2877
 		// build parameters
2468 2878
 		$parameters = null;
2469
-		if($placeId != null) $parameters['place_id'] = (string) $placeId;
2879
+		if($placeId != null) {
2880
+			$parameters['place_id'] = (string) $placeId;
2881
+		}
2470 2882
 
2471 2883
 		// make the call
2472 2884
 		return (array) $this->doCall('geo/id/'. (string) $id .'.json', $parameters);
Please login to merge, or discard this patch.
class/wideimage/Operation/CorrectGamma.php 1 patch
Indentation   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	/**
3
- * @author Gasper Kozak
4
- * @copyright 2007, 2008, 2009
3
+	 * @author Gasper Kozak
4
+	 * @copyright 2007, 2008, 2009
5 5
 
6 6
     This file is part of WideImage.
7 7
 		
@@ -18,9 +18,8 @@  discard block
 block discarded – undo
18 18
     You should have received a copy of the GNU Lesser General Public License
19 19
     along with WideImage; if not, write to the Free Software
20 20
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21
-
22
-    * @package Internal/Operations
23
-  **/
21
+	 * @package Internal/Operations
22
+	 **/
24 23
 	
25 24
 	/**
26 25
 	 * An Exception for when an invalid fit method is passed
Please login to merge, or discard this patch.
class/wideimage/Operation/ApplyConvolution.php 1 patch
Indentation   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	/**
3
- * @author Gasper Kozak
4
- * @copyright 2007, 2008, 2009
3
+	 * @author Gasper Kozak
4
+	 * @copyright 2007, 2008, 2009
5 5
 
6 6
     This file is part of WideImage.
7 7
 		
@@ -18,9 +18,8 @@  discard block
 block discarded – undo
18 18
     You should have received a copy of the GNU Lesser General Public License
19 19
     along with WideImage; if not, write to the Free Software
20 20
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21
-
22
-    * @package Internal/Operations
23
-  **/
21
+	 * @package Internal/Operations
22
+	 **/
24 23
 	
25 24
 	/**
26 25
 	 * An Exception for when an invalid fit method is passed
Please login to merge, or discard this patch.
class/wideimage/Operation/Mirror.php 1 patch
Indentation   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	/**
3
- * @author Gasper Kozak
4
- * @copyright 2007, 2008, 2009
3
+	 * @author Gasper Kozak
4
+	 * @copyright 2007, 2008, 2009
5 5
 
6 6
     This file is part of WideImage.
7 7
 		
@@ -18,9 +18,8 @@  discard block
 block discarded – undo
18 18
     You should have received a copy of the GNU Lesser General Public License
19 19
     along with WideImage; if not, write to the Free Software
20 20
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21
-
22
-    * @package Internal/Operations
23
-  **/
21
+	 * @package Internal/Operations
22
+	 **/
24 23
 	
25 24
 	/**
26 25
 	 * An Exception for when an invalid fit method is passed
Please login to merge, or discard this patch.
class/wideimage/Mapper/JPEG.php 1 patch
Indentation   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 	/**
3
- * @author Gasper Kozak
4
- * @copyright 2007, 2008, 2009
3
+	 * @author Gasper Kozak
4
+	 * @copyright 2007, 2008, 2009
5 5
 
6 6
     This file is part of WideImage.
7 7
 		
@@ -18,9 +18,8 @@  discard block
 block discarded – undo
18 18
     You should have received a copy of the GNU Lesser General Public License
19 19
     along with WideImage; if not, write to the Free Software
20 20
     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21
-
22
-    * @package Internal/Mappers
23
-  **/
21
+	 * @package Internal/Mappers
22
+	 **/
24 23
 	
25 24
 	/**
26 25
 	 * Mapper class for GD files
Please login to merge, or discard this patch.