Test Failed
Push — master ( 9ad798...8afcbf )
by
unknown
11:57
created
lib/GLogger.php 1 patch
Braces   +23 added lines, -14 removed lines patch added patch discarded remove patch
@@ -56,15 +56,18 @@  discard block
 block discarded – undo
56 56
         // Load configuration from ini-file if a file path (string) is given
57 57
         if (is_string($configuration)) {
58 58
             $configuration = parse_ini_file($configuration);
59
-            if (!is_array($configuration))
60
-                throw new \Exception('Invalid GLogger configuration file');
61
-        } elseif (!is_array($configuration)) {
59
+            if (!is_array($configuration)) {
60
+                            throw new \Exception('Invalid GLogger configuration file');
61
+            }
62
+        }
63
+        elseif (!is_array($configuration)) {
62 64
             throw new \Exception('GLogger configuration should be either a string with path to the configuration file, or a configuration array');
63 65
         }
64 66
 
65 67
         // Log level
66
-        if (!isset($configuration['level']))
67
-            $configuration['level'] = 'INFO';
68
+        if (!isset($configuration['level'])) {
69
+                    $configuration['level'] = 'INFO';
70
+        }
68 71
         elseif (!is_string($configuration['level'])) {
69 72
             throw new \Exception('GLogger configuration parameter "level" is not a string');
70 73
         }
@@ -72,8 +75,9 @@  discard block
 block discarded – undo
72 75
         $configuration['level'] = strtoupper($configuration['level']);
73 76
         $allLogLevels = Logger::getLevels();
74 77
 
75
-        if (!isset($allLogLevels[$configuration['level']]))
76
-            throw new \Exception('GLogger configuration parameter "level" is not known');
78
+        if (!isset($allLogLevels[$configuration['level']])) {
79
+                    throw new \Exception('GLogger configuration parameter "level" is not known');
80
+        }
77 81
 
78 82
         $logLevel = $allLogLevels[$configuration['level']];
79 83
 
@@ -82,11 +86,13 @@  discard block
 block discarded – undo
82 86
 
83 87
         // Without configuration parameter 'file' all log messages will go to error_log()
84 88
         if (isset($configuration['file'])) {
85
-            if (!is_string($configuration['file']))
86
-                throw new \Exception('GLogger configuration parameter "file" is not a string');
89
+            if (!is_string($configuration['file'])) {
90
+                            throw new \Exception('GLogger configuration parameter "file" is not a string');
91
+            }
87 92
 
88 93
             $stream = new StreamHandler($configuration['file'], $logLevel);
89
-        } else {
94
+        }
95
+        else {
90 96
             $stream = new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $logLevel);
91 97
         }
92 98
 
@@ -94,14 +100,17 @@  discard block
 block discarded – undo
94 100
         $lineFormat = null;
95 101
 
96 102
         if (isset($configuration['lineFormat'])
97
-            && is_string($configuration['lineFormat']))
98
-            $lineFormat = stripcslashes($configuration['lineFormat']); // stripcslashes to recognize "\n"
103
+            && is_string($configuration['lineFormat'])) {
104
+                    $lineFormat = stripcslashes($configuration['lineFormat']);
105
+        }
106
+        // stripcslashes to recognize "\n"
99 107
 
100 108
         $timeFormat = null;
101 109
 
102 110
         if (isset($configuration['timeFormat'])
103
-            && is_string($configuration['timeFormat']))
104
-            $timeFormat = $configuration['timeFormat'];
111
+            && is_string($configuration['timeFormat'])) {
112
+                    $timeFormat = $configuration['timeFormat'];
113
+        }
105 114
 
106 115
         if ($lineFormat
107 116
             || $timeFormat) {
Please login to merge, or discard this patch.