Browse Source

Syntax adjustments #488

Tobias Reich 8 years ago
parent
commit
aba1629f31
1 changed files with 8 additions and 6 deletions
  1. 8 6
      php/helpers/getExtension.php

+ 8 - 6
php/helpers/getExtension.php

@@ -1,18 +1,20 @@
 <?php
 
-# Returns the extension of the filename (path or URI) or an empty string
+/**
+ * Returns the extension of the filename (path or URI) or an empty string.
+ * @return string Extension of the filename starting with a dot.
+ */
 function getExtension($filename, $isURI = false) {
 
-    # If $filename is an URI, get only the path component
-    if ($isURI)
-        $filename = parse_url($filename, PHP_URL_PATH);
+	// If $filename is an URI, get only the path component
+	if ($isURI===true) $filename = parse_url($filename, PHP_URL_PATH);
 
 	$extension = pathinfo($filename, PATHINFO_EXTENSION);
 
-    if (!empty($extension))
-        $extension = '.' . $extension;
+	if (empty($extension)===false) $extension = '.' . $extension;
 
 	return $extension;
+
 }
 
 ?>