Test Failed
Push — master ( 9ad798...8afcbf )
by
unknown
11:57
created
lib/GLogger.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param mixed $name
32 32
 	 */
33 33
 	public function __construct($name) {
34
-        $this->logger = self::$parentLogger->withName($name);
34
+		$this->logger = self::$parentLogger->withName($name);
35 35
 
36 36
 		// keep an output puffer in case we do debug logging
37 37
 		if ($this->logger->isHandling(Logger::DEBUG)) {
@@ -53,82 +53,82 @@  discard block
 block discarded – undo
53 53
 	 */
54 54
 	public static function configure($configuration = null) {
55 55
 
56
-        // Load configuration from ini-file if a file path (string) is given
57
-        if (is_string($configuration)) {
58
-            $configuration = parse_ini_file($configuration);
59
-            if (!is_array($configuration))
60
-                throw new \Exception('Invalid GLogger configuration file');
61
-        } elseif (!is_array($configuration)) {
62
-            throw new \Exception('GLogger configuration should be either a string with path to the configuration file, or a configuration array');
63
-        }
56
+		// Load configuration from ini-file if a file path (string) is given
57
+		if (is_string($configuration)) {
58
+			$configuration = parse_ini_file($configuration);
59
+			if (!is_array($configuration))
60
+				throw new \Exception('Invalid GLogger configuration file');
61
+		} elseif (!is_array($configuration)) {
62
+			throw new \Exception('GLogger configuration should be either a string with path to the configuration file, or a configuration array');
63
+		}
64 64
 
65
-        // Log level
66
-        if (!isset($configuration['level']))
67
-            $configuration['level'] = 'INFO';
68
-        elseif (!is_string($configuration['level'])) {
69
-            throw new \Exception('GLogger configuration parameter "level" is not a string');
70
-        }
65
+		// Log level
66
+		if (!isset($configuration['level']))
67
+			$configuration['level'] = 'INFO';
68
+		elseif (!is_string($configuration['level'])) {
69
+			throw new \Exception('GLogger configuration parameter "level" is not a string');
70
+		}
71 71
 
72
-        $configuration['level'] = strtoupper($configuration['level']);
73
-        $allLogLevels = Logger::getLevels();
72
+		$configuration['level'] = strtoupper($configuration['level']);
73
+		$allLogLevels = Logger::getLevels();
74 74
 
75
-        if (!isset($allLogLevels[$configuration['level']]))
76
-            throw new \Exception('GLogger configuration parameter "level" is not known');
75
+		if (!isset($allLogLevels[$configuration['level']]))
76
+			throw new \Exception('GLogger configuration parameter "level" is not known');
77 77
 
78
-        $logLevel = $allLogLevels[$configuration['level']];
78
+		$logLevel = $allLogLevels[$configuration['level']];
79 79
 
80
-        // Parent logger class
81
-        static::$parentLogger = new Logger('');
80
+		// Parent logger class
81
+		static::$parentLogger = new Logger('');
82 82
 
83
-        // Without configuration parameter 'file' all log messages will go to error_log()
84
-        if (isset($configuration['file'])) {
85
-            if (!is_string($configuration['file']))
86
-                throw new \Exception('GLogger configuration parameter "file" is not a string');
83
+		// Without configuration parameter 'file' all log messages will go to error_log()
84
+		if (isset($configuration['file'])) {
85
+			if (!is_string($configuration['file']))
86
+				throw new \Exception('GLogger configuration parameter "file" is not a string');
87 87
 
88
-            $stream = new StreamHandler($configuration['file'], $logLevel);
89
-        } else {
90
-            $stream = new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $logLevel);
91
-        }
88
+			$stream = new StreamHandler($configuration['file'], $logLevel);
89
+		} else {
90
+			$stream = new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $logLevel);
91
+		}
92 92
 
93
-        // Log messages formatting
94
-        $lineFormat = null;
93
+		// Log messages formatting
94
+		$lineFormat = null;
95 95
 
96
-        if (isset($configuration['lineFormat'])
97
-            && is_string($configuration['lineFormat']))
98
-            $lineFormat = stripcslashes($configuration['lineFormat']); // stripcslashes to recognize "\n"
96
+		if (isset($configuration['lineFormat'])
97
+			&& is_string($configuration['lineFormat']))
98
+			$lineFormat = stripcslashes($configuration['lineFormat']); // stripcslashes to recognize "\n"
99 99
 
100
-        $timeFormat = null;
100
+		$timeFormat = null;
101 101
 
102
-        if (isset($configuration['timeFormat'])
103
-            && is_string($configuration['timeFormat']))
104
-            $timeFormat = $configuration['timeFormat'];
102
+		if (isset($configuration['timeFormat'])
103
+			&& is_string($configuration['timeFormat']))
104
+			$timeFormat = $configuration['timeFormat'];
105 105
 
106
-        if ($lineFormat
107
-            || $timeFormat) {
106
+		if ($lineFormat
107
+			|| $timeFormat) {
108 108
 
109
-            $formatter = new LineFormatter($lineFormat, $timeFormat, true, true);
110
-            $stream->setFormatter($formatter);
111
-        }
109
+			$formatter = new LineFormatter($lineFormat, $timeFormat, true, true);
110
+			$stream->setFormatter($formatter);
111
+		}
112 112
 
113
-        static::$parentLogger->pushHandler($stream);
113
+		static::$parentLogger->pushHandler($stream);
114 114
 
115
-        // Add processor id (pid) to log messages
116
-        static::$parentLogger->pushProcessor(new ProcessIdProcessor());
115
+		// Add processor id (pid) to log messages
116
+		static::$parentLogger->pushProcessor(new ProcessIdProcessor());
117 117
 	}
118 118
 
119 119
 	/**
120 120
 	 * Destroy configurations for logger definitions.
121 121
 	 */
122 122
 	public function resetConfiguration() {
123
-        if (static::$parentLogger) {
124
-            static::$parentLogger->reset();
125
-            static::$parentLogger = null;
126
-        }
123
+		if (static::$parentLogger) {
124
+			static::$parentLogger->reset();
125
+			static::$parentLogger = null;
126
+		}
127 127
 	}
128 128
 
129 129
 	public function getGPSR3Logger() {
130
-        return $this->logger;
131
-    }
130
+		return $this->logger;
131
+	}
132 132
 
133 133
 	/**
134 134
 	 * Returns a GLogger by name. If it does not exist, it will be created.
Please login to merge, or discard this 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.
lib/MonologWrapper.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,20 +9,20 @@
 block discarded – undo
9 9
 
10 10
 class MonologWrapper extends \Monolog\Logger {
11 11
 
12
-    /**
13
-     * Trace information
14
-     */
15
-    public const TRACE = 70;
12
+	/**
13
+	 * Trace information
14
+	 */
15
+	public const TRACE = 70;
16 16
 
17
-    protected static $levels = [
18
-        self::TRACE     => 'TRACE',
19
-        self::DEBUG     => 'DEBUG',
20
-        self::INFO      => 'INFO',
21
-        self::NOTICE    => 'NOTICE',
22
-        self::WARNING   => 'WARNING',
23
-        self::ERROR     => 'ERROR',
24
-        self::CRITICAL  => 'CRITICAL',
25
-        self::ALERT     => 'ALERT',
26
-        self::EMERGENCY => 'EMERGENCY',
27
-    ];
17
+	protected static $levels = [
18
+		self::TRACE     => 'TRACE',
19
+		self::DEBUG     => 'DEBUG',
20
+		self::INFO      => 'INFO',
21
+		self::NOTICE    => 'NOTICE',
22
+		self::WARNING   => 'WARNING',
23
+		self::ERROR     => 'ERROR',
24
+		self::CRITICAL  => 'CRITICAL',
25
+		self::ALERT     => 'ALERT',
26
+		self::EMERGENCY => 'EMERGENCY',
27
+	];
28 28
 }
Please login to merge, or discard this patch.