Passed
Branch master (8f4937)
by smiley
04:23
created
examples/Psr4AutoloaderClass.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * Loads the class file for a given class name.
110 110
 	 *
111 111
 	 * @param string $class The fully-qualified class name.
112
-	 * @return mixed The mapped file name on success, or boolean false on
112
+	 * @return string|false The mapped file name on success, or boolean false on
113 113
 	 * failure.
114 114
 	 */
115 115
 	public function loadClass($class)
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @param string $prefix The namespace prefix.
149 149
 	 * @param string $relative_class The relative class name.
150
-	 * @return mixed Boolean false if no mapped file can be loaded, or the
150
+	 * @return false|string Boolean false if no mapped file can be loaded, or the
151 151
 	 * name of the mapped file that was loaded.
152 152
 	 */
153 153
 	protected function loadMappedFile($prefix, $relative_class)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,10 +87,10 @@
 block discarded – undo
87 87
 	public function addNamespace($prefix, $base_dir, $prepend = false)
88 88
 	{
89 89
 		// normalize namespace prefix
90
-		$prefix = trim($prefix, '\\') . '\\';
90
+		$prefix = trim($prefix, '\\').'\\';
91 91
 
92 92
 		// normalize the base directory with a trailing separator
93
-		$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/';
93
+		$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR).'/';
94 94
 
95 95
 		// initialize the namespace prefix array
96 96
 		if (isset($this->prefixes[$prefix]) === false) {
Please login to merge, or discard this patch.
src/Modules/BaseModule.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 * @param string $name     the desired attributes name
224 224
 	 * @param mixed  $default  [optional] a default value in case the attribute isn't set, defaults to false
225 225
 	 *
226
-	 * @return mixed the attribute's value in case it exists, otherwise $default
226
+	 * @return string the attribute's value in case it exists, otherwise $default
227 227
 	 */
228 228
 	public function getAttribute($name, $default = false){
229 229
 		return isset($this->attributes[$name]) && !empty($this->attributes[$name]) ? $this->attributes[$name] : $default;
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
 	 * @param string $name      the desired attributes name
251 251
 	 * @param array  $whitelist an array with whitelisted key -> value pairs
252
-	 * @param mixed  $default   [optional] a default value in case the attribute isn't set, defaults to false
252
+	 * @param string  $default   [optional] a default value in case the attribute isn't set, defaults to false
253 253
 	 *
254 254
 	 * @return mixed boolean if no $default is set, otherwise the whitelist value to the given key in case it exists or $default
255 255
 	 */
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 	 * Checks if the current tag is whitelisted
264 264
 	 *
265 265
 	 * @param array $whitelist an array with whitelisted tag names
266
-	 * @param mixed $default   [optional] a default value in case the tag isn't whitelisted
266
+	 * @param string $default   [optional] a default value in case the tag isn't whitelisted
267 267
 	 *
268 268
 	 * @return mixed boolean if no $default is set, otherwise the whitelisted tag or $default
269 269
 	 */
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 	 * shorthand for self::attributeIn('__BBTAG__', $array)
315 315
 	 *
316 316
 	 * @param array $array
317
-	 * @param mixed $default
317
+	 * @param string $default
318 318
 	 *
319 319
 	 * @return mixed
320 320
 	 */
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 *
328 328
 	 * @param string $url the URL to check
329 329
 	 *
330
-	 * @return bool|string the url if valid, otherwise false
330
+	 * @return false|string the url if valid, otherwise false
331 331
 	 */
332 332
 	public function checkUrl($url){
333 333
 		if(filter_var($url, FILTER_VALIDATE_URL) === false){
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -246,7 +246,6 @@
 block discarded – undo
246 246
 
247 247
 	/**
248 248
 	 * Checks if an attribute exists and if it exists as key in a whitelist
249
-
250 249
 	 * @param string $name      the desired attributes name
251 250
 	 * @param array  $whitelist an array with whitelisted key -> value pairs
252 251
 	 * @param mixed  $default   [optional] a default value in case the attribute isn't set, defaults to false
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * The base module implements the basic functionality for each module
20 20
  */
21
-class BaseModule implements BaseModuleInterface{
21
+class BaseModule implements BaseModuleInterface {
22 22
 
23 23
 	/**
24 24
 	 * The current bbcode tag
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param \chillerlan\bbcode\BBTemp $bbtemp
116 116
 	 */
117
-	public function __construct(BBTemp $bbtemp = null){
118
-		if($bbtemp instanceof BBTemp){
117
+	public function __construct(BBTemp $bbtemp = null) {
118
+		if ($bbtemp instanceof BBTemp) {
119 119
 			$this->setBBTemp($bbtemp);
120 120
 		}
121 121
 	}
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @return $this
129 129
 	 */
130
-	public function setBBTemp(BBTemp $bbtemp){
131
-		foreach(['tag', 'attributes', 'content', 'parserOptions', 'languageInterface', 'depth'] as $var){
130
+	public function setBBTemp(BBTemp $bbtemp) {
131
+		foreach (['tag', 'attributes', 'content', 'parserOptions', 'languageInterface', 'depth'] as $var) {
132 132
 			$this->{$var} = $bbtemp->{$var};
133 133
 		}
134 134
 
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	 *
141 141
 	 * @return \chillerlan\bbcode\Modules\BaseModuleInfo
142 142
 	 */
143
-	public function getInfo(){
143
+	public function getInfo() {
144 144
 		$info = new BaseModuleInfo;
145 145
 
146
-		foreach(['modules', 'eol_token'] as $option){
146
+		foreach (['modules', 'eol_token'] as $option) {
147 147
 			$info->{$option} = $this->{$option};
148 148
 		}
149 149
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * @return \chillerlan\bbcode\Modules\Tagmap
157 157
 	 * @see \chillerlan\bbcode\Modules\ModuleInterface
158 158
 	 */
159
-	public function getTags(){
159
+	public function getTags() {
160 160
 		$tags = new Tagmap;
161 161
 		$tags->tags = $this->tags;
162 162
 		$tags->noparse_tags = $this->noparse_tags;
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @return $this
172 172
 	 * @throws \chillerlan\bbcode\BBCodeException
173 173
 	 */
174
-	public function checkTag(){
175
-		if(!$this->tag || !in_array($this->tag, $this->tags)){
174
+	public function checkTag() {
175
+		if (!$this->tag || !in_array($this->tag, $this->tags)) {
176 176
 			throw new BBCodeException('tag ['.$this->tag.'] not supported.');
177 177
 		}
178 178
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 *
189 189
 	 * @return string
190 190
 	 */
191
-	public function eol($str, $eol = '', $count = null){
191
+	public function eol($str, $eol = '', $count = null) {
192 192
 		return str_replace($this->parserOptions->eol_placeholder, $eol, $str, $count);
193 193
 	}
194 194
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return $this
201 201
 	 */
202
-	public function clearEOL($eol = null){
202
+	public function clearEOL($eol = null) {
203 203
 		$eol = $eol ?: $this->eol_token;
204 204
 		$this->content = str_replace($this->parserOptions->eol_placeholder, $eol, $this->content);
205 205
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 *
212 212
 	 * @return $this
213 213
 	 */
214
-	public function clearPseudoClosingTags(){
214
+	public function clearPseudoClosingTags() {
215 215
 		$this->content = preg_replace('#\[/('.$this->parserOptions->singletags.')]#is', '', $this->content);
216 216
 
217 217
 		return $this;
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 	 *
226 226
 	 * @return mixed the attribute's value in case it exists, otherwise $default
227 227
 	 */
228
-	public function getAttribute($name, $default = false){
228
+	public function getAttribute($name, $default = false) {
229 229
 		return isset($this->attributes[$name]) && !empty($this->attributes[$name]) ? $this->attributes[$name] : $default;
230 230
 	}
231 231
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @return mixed boolean if no $default is set, otherwise the attribute's value in case it exists and is whitelisted or $default
240 240
 	 */
241
-	public function attributeIn($name, array $whitelist, $default = false){
241
+	public function attributeIn($name, array $whitelist, $default = false) {
242 242
 		return isset($this->attributes[$name]) && in_array($this->attributes[$name], $whitelist)
243 243
 			? $default !== false ? $this->attributes[$name] : true
244 244
 			: $default;
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return mixed boolean if no $default is set, otherwise the whitelist value to the given key in case it exists or $default
255 255
 	 */
256
-	public function attributeKeyIn($name, array $whitelist, $default = false){
256
+	public function attributeKeyIn($name, array $whitelist, $default = false) {
257 257
 		return isset($this->attributes[$name]) && array_key_exists($this->attributes[$name], $whitelist)
258 258
 				? $default !== false ? $whitelist[$this->attributes[$name]] : true
259 259
 				: $default;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return mixed boolean if no $default is set, otherwise the whitelisted tag or $default
269 269
 	 */
270
-	public function tagIn(array $whitelist, $default = false){
270
+	public function tagIn(array $whitelist, $default = false) {
271 271
 		return in_array($this->tag, $whitelist)
272 272
 				? $default !== false ? $this->tag : true
273 273
 				: $default;
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 * @return string
282 282
 	 * @codeCoverageIgnore
283 283
 	 */
284
-	public function sanitize($content){
284
+	public function sanitize($content) {
285 285
 		return 'Implement sanitize() method!';
286 286
 	}
287 287
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 *
293 293
 	 * @see \chillerlan\bbcode\Modules\ModuleInterface::transform()
294 294
 	 */
295
-	public function transform(){
295
+	public function transform() {
296 296
 		$this->checkTag();
297 297
 
298 298
 		/** @var $this \chillerlan\bbcode\Modules\ModuleInterface */
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 *
307 307
 	 * @return mixed $this->attributes['__BBTAG__']
308 308
 	 */
309
-	protected function bbtag($default = false){
309
+	protected function bbtag($default = false) {
310 310
 		return $this->getAttribute($this->parserOptions->bbtag_placeholder, $default);
311 311
 	}
312 312
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 *
319 319
 	 * @return mixed
320 320
 	 */
321
-	protected function bbtagIn(array $array, $default = false){
321
+	protected function bbtagIn(array $array, $default = false) {
322 322
 		return $this->attributeIn($this->parserOptions->bbtag_placeholder, $array, $default);
323 323
 	}
324 324
 
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
 	 *
330 330
 	 * @return bool|string the url if valid, otherwise false
331 331
 	 */
332
-	public function checkUrl($url){
333
-		if(filter_var($url, FILTER_VALIDATE_URL) === false){
332
+	public function checkUrl($url) {
333
+		if (filter_var($url, FILTER_VALIDATE_URL) === false) {
334 334
 			return false;
335 335
 		}
336 336
 		// todo: check against whitelist?
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	 *
347 347
 	 * @return string
348 348
 	 */
349
-	public function wrap($content, $wrapper){
349
+	public function wrap($content, $wrapper) {
350 350
 		return $wrapper.$content.$wrapper;
351 351
 	}
352 352
 
Please login to merge, or discard this patch.
src/Parser.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@
 block discarded – undo
259 259
 	/**
260 260
 	 * strng regexp bbcode killer
261 261
 	 *
262
-	 * @param string|array $bbcode BBCode as string or matches as array - callback from preg_replace_callback()
262
+	 * @param string $bbcode BBCode as string or matches as array - callback from preg_replace_callback()
263 263
 	 *
264 264
 	 * @return string
265 265
 	 * @throws \chillerlan\bbcode\BBCodeException
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @link http://www.developers-guide.net/c/152-bbcode-parser-mit-noparse-tag-selbst-gemacht.html
29 29
  */
30
-class Parser{
30
+class Parser {
31 31
 	use ClassLoaderTrait;
32 32
 
33 33
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 *
140 140
 	 * @param \chillerlan\bbcode\ParserOptions $options [optional]
141 141
 	 */
142
-	public function __construct(ParserOptions $options = null){
142
+	public function __construct(ParserOptions $options = null) {
143 143
 		$this->setOptions(!$options ? new ParserOptions : $options);
144 144
 		$this->BBTemp = new BBTemp;
145 145
 	}
@@ -151,22 +151,22 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @throws \chillerlan\bbcode\BBCodeException
153 153
 	 */
154
-	public function setOptions(ParserOptions $options){
154
+	public function setOptions(ParserOptions $options) {
155 155
 		$this->parserOptions       = $options;
156 156
 		$this->baseModuleInterface = $this->__loadClass($this->parserOptions->baseModuleInterface, BaseModuleInterface::class);
157 157
 		$this->languageInterface   = $this->__loadClass($this->parserOptions->languageInterface, LanguageInterface::class);
158 158
 
159
-		if($this->parserOptions->parserExtensionInterface){
159
+		if ($this->parserOptions->parserExtensionInterface) {
160 160
 			$this->parserExtensionInterface =
161 161
 				$this->__loadClass($this->parserOptions->parserExtensionInterface, ParserExtensionInterface::class, $this->parserOptions);
162 162
 		}
163 163
 
164 164
 		$module_info = $this->baseModuleInterface->getInfo();
165
-		foreach($module_info->modules as $module){
165
+		foreach ($module_info->modules as $module) {
166 166
 			$this->moduleInterface = $this->__loadClass($module, ModuleInterface::class);
167 167
 
168 168
 			$tagmap = $this->moduleInterface->getTags();
169
-			foreach($tagmap->tags as $tag){
169
+			foreach ($tagmap->tags as $tag) {
170 170
 				$this->tagmap[$tag] = $module;
171 171
 			}
172 172
 
@@ -178,15 +178,15 @@  discard block
 block discarded – undo
178 178
 		$this->parserOptions->eol_token  = $module_info->eol_token;
179 179
 		$this->parserOptions->singletags = implode('|', $this->singletags);
180 180
 
181
-		if(is_array($this->parserOptions->allowed_tags) && !empty($this->parserOptions->allowed_tags)){
182
-			foreach($this->parserOptions->allowed_tags as $tag){
183
-				if(array_key_exists($tag, $this->tagmap)){
181
+		if (is_array($this->parserOptions->allowed_tags) && !empty($this->parserOptions->allowed_tags)) {
182
+			foreach ($this->parserOptions->allowed_tags as $tag) {
183
+				if (array_key_exists($tag, $this->tagmap)) {
184 184
 					$this->allowed_tags[] = $tag;
185 185
 				}
186 186
 			}
187 187
 		}
188
-		else{
189
-			if($this->parserOptions->allow_all){
188
+		else {
189
+			if ($this->parserOptions->allow_all) {
190 190
 				$this->allowed_tags = array_keys($this->tagmap);
191 191
 			}
192 192
 		}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 *
198 198
 	 * @return array
199 199
 	 */
200
-	public function getTagmap(){
200
+	public function getTagmap() {
201 201
 		ksort($this->tagmap);
202 202
 		return $this->tagmap;
203 203
 	}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @return array
209 209
 	 */
210
-	public function getAllowed(){
210
+	public function getAllowed() {
211 211
 		sort($this->allowed_tags);
212 212
 		return $this->allowed_tags;
213 213
 	}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 *
218 218
 	 * @return array
219 219
 	 */
220
-	public function getNoparse(){
220
+	public function getNoparse() {
221 221
 		sort($this->noparse_tags);
222 222
 		return $this->noparse_tags;
223 223
 	}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 *
228 228
 	 * @return array
229 229
 	 */
230
-	public function getSingle(){
230
+	public function getSingle() {
231 231
 		sort($this->singletags);
232 232
 		return $this->singletags;
233 233
 	}
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 *
240 240
 	 * @return string
241 241
 	 */
242
-	public function parse($bbcode){
243
-		if($this->parserOptions->sanitize){
242
+	public function parse($bbcode) {
243
+		if ($this->parserOptions->sanitize) {
244 244
 			$bbcode = $this->baseModuleInterface->sanitize($bbcode);
245 245
 		}
246 246
 
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
 	 * @return string
265 265
 	 * @throws \chillerlan\bbcode\BBCodeException
266 266
 	 */
267
-	protected function __parse($bbcode){
267
+	protected function __parse($bbcode) {
268 268
 		static $callback_count = 0;
269 269
 		$callback = false;
270 270
 		$preg_error = PREG_NO_ERROR;
271 271
 
272
-		if(is_array($bbcode) && isset($bbcode['tag'], $bbcode['attributes'], $bbcode['content'])){
272
+		if (is_array($bbcode) && isset($bbcode['tag'], $bbcode['attributes'], $bbcode['content'])) {
273 273
 			$tag = strtolower($bbcode['tag']);
274 274
 			$attributes = $this->getAttributes($bbcode['attributes']);
275 275
 			$content = $bbcode['content'];
@@ -277,30 +277,30 @@  discard block
 block discarded – undo
277 277
 			$callback = true;
278 278
 			$callback_count++;
279 279
 		}
280
-		else if(is_string($bbcode) && !empty($bbcode)){
280
+		else if (is_string($bbcode) && !empty($bbcode)) {
281 281
 			$tag = null;
282 282
 			$attributes = [];
283 283
 			$content = $bbcode;
284 284
 		}
285
-		else{
285
+		else {
286 286
 			return '';
287 287
 		}
288 288
 
289
-		if($callback_count < (int)$this->parserOptions->nesting_limit && !in_array($tag, $this->noparse_tags)){
289
+		if ($callback_count < (int)$this->parserOptions->nesting_limit && !in_array($tag, $this->noparse_tags)) {
290 290
 			$pattern = '#\[(?<tag>\w+)(?<attributes>(?:\s|=)[^]]*)?](?<content>(?:[^[]|\[(?!/?\1((?:\s|=)[^]]*)?])|(?R))*)\[/\1]#';
291 291
 			$content = preg_replace_callback($pattern, __METHOD__, $content);
292 292
 			$preg_error = preg_last_error();
293 293
 		}
294 294
 
295 295
 		// still testing...
296
-		if($preg_error !== PREG_NO_ERROR){
296
+		if ($preg_error !== PREG_NO_ERROR) {
297 297
 			// @codeCoverageIgnoreStart
298 298
 			$message = sprintf($this->languageInterface->parserExceptionCallback(), $tag, self::PREG_ERROR[$preg_error], $preg_error);
299 299
 			throw new BBCodeException($message);
300 300
 			// @codeCoverageIgnoreEnd
301 301
 		}
302 302
 
303
-		if($callback && isset($this->tagmap[$tag]) && in_array($tag, $this->allowed_tags)){
303
+		if ($callback && isset($this->tagmap[$tag]) && in_array($tag, $this->allowed_tags)) {
304 304
 			$this->BBTemp->tag               = $tag;
305 305
 			$this->BBTemp->attributes        = $attributes;
306 306
 			$this->BBTemp->content           = $content;
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 * @return array
327 327
 	 * @throws \chillerlan\bbcode\BBCodeException
328 328
 	 */
329
-	protected function getAttributes($attributes){
329
+	protected function getAttributes($attributes) {
330 330
 		$attr = [];
331 331
 		$pattern = '#(?<name>^|\w+)\=(\'?)(?<value>[^\']*?)\2(?: |$)#';
332 332
 
333
-		if(preg_match_all($pattern, $attributes, $matches, PREG_SET_ORDER) > 0){
334
-			foreach($matches as $attribute){
333
+		if (preg_match_all($pattern, $attributes, $matches, PREG_SET_ORDER) > 0) {
334
+			foreach ($matches as $attribute) {
335 335
 				$name = empty($attribute['name']) ? $this->parserOptions->bbtag_placeholder : strtolower(trim($attribute['name']));
336 336
 
337 337
 				$value = trim($attribute['value']);
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
 		$preg_error = preg_last_error();
345 345
 
346
-		if($preg_error !== PREG_NO_ERROR){
346
+		if ($preg_error !== PREG_NO_ERROR) {
347 347
 			// @codeCoverageIgnoreStart
348 348
 			$message = sprintf($this->languageInterface->parserExceptionMatchall(), self::PREG_ERROR[$preg_error], $preg_error);
349 349
 			throw new BBCodeException($message);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -184,8 +184,7 @@  discard block
 block discarded – undo
184 184
 					$this->allowed_tags[] = $tag;
185 185
 				}
186 186
 			}
187
-		}
188
-		else{
187
+		} else{
189 188
 			if($this->parserOptions->allow_all){
190 189
 				$this->allowed_tags = array_keys($this->tagmap);
191 190
 			}
@@ -276,13 +275,11 @@  discard block
 block discarded – undo
276 275
 
277 276
 			$callback = true;
278 277
 			$callback_count++;
279
-		}
280
-		else if(is_string($bbcode) && !empty($bbcode)){
278
+		} else if(is_string($bbcode) && !empty($bbcode)){
281 279
 			$tag = null;
282 280
 			$attributes = [];
283 281
 			$content = $bbcode;
284
-		}
285
-		else{
282
+		} else{
286 283
 			return '';
287 284
 		}
288 285
 
Please login to merge, or discard this patch.
examples/MyAwesomeParserExtension.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@
 block discarded – undo
33 33
 
34 34
 		$search = [
35 35
 			"\t", // lets convert all tabs into 4 spaces
36
-		    '{__BASE_URL__}', // assume we use a special token for our base url
36
+			'{__BASE_URL__}', // assume we use a special token for our base url
37 37
 		];
38 38
 
39 39
 		$replace = [
40 40
 			'    ',
41
-		    'https://your.base/url/'
41
+			'https://your.base/url/'
42 42
 		];
43 43
 
44 44
 		return str_replace($search, $replace, $bbcode);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 /**
18 18
  * A tiny custom preparser as ground to start from
19 19
  */
20
-class MyAwesomeParserExtension implements ParserExtensionInterface{
20
+class MyAwesomeParserExtension implements ParserExtensionInterface {
21 21
 
22 22
 	/**
23 23
 	 * Pre-parser
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @return string preparsed bbcode
31 31
 	 */
32
-	public function pre($bbcode){
32
+	public function pre($bbcode) {
33 33
 
34 34
 		$search = [
35 35
 			"\t", // lets convert all tabs into 4 spaces
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @return string postparsed bbcode
63 63
 	 */
64
-	public function post($bbcode){
64
+	public function post($bbcode) {
65 65
 		return $bbcode;
66 66
 	}
67 67
 
Please login to merge, or discard this patch.
examples/MyModules/MyAwesomeBaseModule.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * The base module implements the basic functionality for each module (custom HTML5)
20 20
  */
21
-class MyAwesomeBaseModule extends BaseModule implements BaseModuleInterface{
21
+class MyAwesomeBaseModule extends BaseModule implements BaseModuleInterface {
22 22
 
23 23
 	/**
24 24
 	 * Holds an array of FQN strings to the current base module's children
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @return string
47 47
 	 */
48
-	public function sanitize($content){
49
-		return htmlspecialchars($content, ENT_NOQUOTES|ENT_HTML5, 'UTF-8', false);
48
+	public function sanitize($content) {
49
+		return htmlspecialchars($content, ENT_NOQUOTES | ENT_HTML5, 'UTF-8', false);
50 50
 	}
51 51
 
52 52
 }
Please login to merge, or discard this patch.
examples/MyModules/MyAwesomeModule.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Transforms several simple text tags into HTML5 (custom)
20 20
  */
21
-class MyAwesomeModule extends MyAwesomeBaseModule implements ModuleInterface{
21
+class MyAwesomeModule extends MyAwesomeBaseModule implements ModuleInterface {
22 22
 
23 23
 	/**
24 24
 	 * An array of tags the module is able to process
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 * @see \chillerlan\bbcode\Modules\BaseModuleInterface::transform()
36 36
 	 * @internal
37 37
 	 */
38
-	public function _transform(){
39
-		if(empty($this->content)){
38
+	public function _transform() {
39
+		if (empty($this->content)) {
40 40
 			return '';
41 41
 		}
42 42
 
Please login to merge, or discard this patch.
examples/example_html.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * @filesource   example.php
4
- * @created      19.09.2015
5
- * @author       Smiley <[email protected]>
6
- * @copyright    2015 Smiley
7
- * @license      MIT
8
- */
3
+	 * @filesource   example.php
4
+	 * @created      19.09.2015
5
+	 * @author       Smiley <[email protected]>
6
+	 * @copyright    2015 Smiley
7
+	 * @license      MIT
8
+	 */
9 9
 
10 10
 require_once '../vendor/autoload.php';
11 11
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 
57 57
 echo $content.PHP_EOL;
58 58
 
59
-echo '<!-- bbcode: '.round((microtime(true)-$timer), 5).'s -->'.PHP_EOL;
59
+echo '<!-- bbcode: '.round((microtime(true) - $timer), 5).'s -->'.PHP_EOL;
60 60
 
61 61
 ?>
62 62
 <!-- let's assume you use a common js framework in your project -->
Please login to merge, or discard this patch.
examples/example_markdown.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,4 +44,4 @@
 block discarded – undo
44 44
 
45 45
 echo $content.PHP_EOL;
46 46
 
47
-echo PHP_EOL.'bbcode: '.round((microtime(true)-$timer), 6).'s';
47
+echo PHP_EOL.'bbcode: '.round((microtime(true) - $timer), 6).'s';
Please login to merge, or discard this patch.
src/BBCodeException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,6 +17,6 @@
 block discarded – undo
17 17
 /**
18 18
  * Placeholder
19 19
  */
20
-class BBCodeException extends Exception{
20
+class BBCodeException extends Exception {
21 21
 
22 22
 }
Please login to merge, or discard this patch.