Completed
Branch master (96e8d2)
by judicael
07:21 queued 03:32
created
bundles/lib/Response/Mock.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,17 +32,17 @@
 block discarded – undo
32 32
  */
33 33
 class Mock implements ResponseInterface
34 34
 {
35
-    /**
36
-     * translate the content
37
-     * @see \Venus\lib\Response\ResponseInterface::translate()
38
-     *
39
-     * @access public
40
-     * @param  mixed $mContent content to translate
41
-     * @return mixed
42
-     */
43
-    public static function translate($mContent)
44
-    {
45
-        return $mContent;
46
-    }
35
+	/**
36
+	 * translate the content
37
+	 * @see \Venus\lib\Response\ResponseInterface::translate()
38
+	 *
39
+	 * @access public
40
+	 * @param  mixed $mContent content to translate
41
+	 * @return mixed
42
+	 */
43
+	public static function translate($mContent)
44
+	{
45
+		return $mContent;
46
+	}
47 47
 
48 48
 }
Please login to merge, or discard this patch.
bundles/lib/Request/Request.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@
 block discarded – undo
9 9
 
10 10
 class Request implements RequestInterface
11 11
 {
12
-    /**
13
-     * get parameter
14
-     * @param string $name
15
-     * @param string $default
16
-     * @return string
17
-     */
18
-    public function get(string $name, string $default = null) : string
19
-    {
20
-        if (isset($_POST[$name]) && $_POST[$name] != '') {
21
-            return $_POST[$name];
22
-        } else if ($default !== null) {
23
-            return $default;
24
-        }
25
-    }
12
+	/**
13
+	 * get parameter
14
+	 * @param string $name
15
+	 * @param string $default
16
+	 * @return string
17
+	 */
18
+	public function get(string $name, string $default = null) : string
19
+	{
20
+		if (isset($_POST[$name]) && $_POST[$name] != '') {
21
+			return $_POST[$name];
22
+		} else if ($default !== null) {
23
+			return $default;
24
+		}
25
+	}
26 26
 }
Please login to merge, or discard this patch.
bundles/lib/Request/Query.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@
 block discarded – undo
9 9
 
10 10
 class Query implements RequestInterface
11 11
 {
12
-    /**
13
-     * get parameter
14
-     * @param string $name
15
-     * @param string $default
16
-     * @return string
17
-     */
18
-    public function get(string $name, string $default = null) : string
19
-    {
20
-        if (isset($_GET[$name]) && $_GET[$name] != '') {
21
-            return $_GET[$name];
22
-        } else if ($default !== null) {
23
-            return $default;
24
-        }
25
-    }
12
+	/**
13
+	 * get parameter
14
+	 * @param string $name
15
+	 * @param string $default
16
+	 * @return string
17
+	 */
18
+	public function get(string $name, string $default = null) : string
19
+	{
20
+		if (isset($_GET[$name]) && $_GET[$name] != '') {
21
+			return $_GET[$name];
22
+		} else if ($default !== null) {
23
+			return $default;
24
+		}
25
+	}
26 26
 }
Please login to merge, or discard this patch.
bundles/lib/Request/Server.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@
 block discarded – undo
9 9
 
10 10
 class Server implements RequestInterface
11 11
 {
12
-    /**
13
-     * get parameter
14
-     * @param string $name
15
-     * @param string $default
16
-     * @return string
17
-     */
18
-    public function get(string $name, string $default = null) : string
19
-    {
20
-        if (isset($_SERVER[$name]) && $_SERVER[$name] != '') {
21
-            return $_SERVER[$name];
22
-        } else if ($default !== null) {
23
-            return $default;
24
-        }
25
-    }
12
+	/**
13
+	 * get parameter
14
+	 * @param string $name
15
+	 * @param string $default
16
+	 * @return string
17
+	 */
18
+	public function get(string $name, string $default = null) : string
19
+	{
20
+		if (isset($_SERVER[$name]) && $_SERVER[$name] != '') {
21
+			return $_SERVER[$name];
22
+		} else if ($default !== null) {
23
+			return $default;
24
+		}
25
+	}
26 26
 }
Please login to merge, or discard this patch.
bundles/lib/Request/Cookies.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@
 block discarded – undo
9 9
 
10 10
 class Cookies implements RequestInterface
11 11
 {
12
-    /**
13
-     * get parameter
14
-     * @param string $name
15
-     * @param string $default
16
-     * @return string
17
-     */
18
-    public function get(string $name, string $default = null) : string
19
-    {
20
-        if (isset($_COOKIE[$name]) && $_COOKIE[$name] != '') {
21
-            return $_COOKIE[$name];
22
-        } else if ($default !== null) {
23
-            return $default;
24
-        }
25
-    }
12
+	/**
13
+	 * get parameter
14
+	 * @param string $name
15
+	 * @param string $default
16
+	 * @return string
17
+	 */
18
+	public function get(string $name, string $default = null) : string
19
+	{
20
+		if (isset($_COOKIE[$name]) && $_COOKIE[$name] != '') {
21
+			return $_COOKIE[$name];
22
+		} else if ($default !== null) {
23
+			return $default;
24
+		}
25
+	}
26 26
 }
Please login to merge, or discard this patch.
bundles/lib/Debug.php 3 patches
Indentation   +413 added lines, -413 removed lines patch added patch discarded remove patch
@@ -34,419 +34,419 @@
 block discarded – undo
34 34
  */
35 35
 class Debug extends AbstractLogger
36 36
 {
37
-    /**
38
-     * variable to activate or not the debug
39
-     * @var boolean
40
-     */
41
-    private static $_bActivateDebug = false;
42
-
43
-    /**
44
-     * variable to activate or not the error
45
-     * @var boolean
46
-     */
47
-    private static $_bActivateError = false;
48
-
49
-    /**
50
-     * variable to activate or not the exception
51
-     * @var boolean
52
-     */
53
-    private static $_bActivateException = false;
54
-
55
-    /**
56
-     * variable to activate or not the debug
57
-     * @var boolean
58
-     */
59
-    private static $_sFileLog = null;
60
-
61
-    /**
62
-     * first or not activation
63
-     * @var boolean
64
-     */
65
-    private static $_bFirstActivation = true;
66
-
67
-    /**
68
-     * kind of report log
69
-     * @var string error_log|screen|all
70
-     */
71
-    private static $_sKindOfReportLog = 'error_log';
72
-
73
-    /**
74
-     * instance of logger
75
-     * @var \Venus\lib\Debug
76
-     */
77
-    private static $_oInstance;
37
+	/**
38
+	 * variable to activate or not the debug
39
+	 * @var boolean
40
+	 */
41
+	private static $_bActivateDebug = false;
42
+
43
+	/**
44
+	 * variable to activate or not the error
45
+	 * @var boolean
46
+	 */
47
+	private static $_bActivateError = false;
48
+
49
+	/**
50
+	 * variable to activate or not the exception
51
+	 * @var boolean
52
+	 */
53
+	private static $_bActivateException = false;
54
+
55
+	/**
56
+	 * variable to activate or not the debug
57
+	 * @var boolean
58
+	 */
59
+	private static $_sFileLog = null;
60
+
61
+	/**
62
+	 * first or not activation
63
+	 * @var boolean
64
+	 */
65
+	private static $_bFirstActivation = true;
66
+
67
+	/**
68
+	 * kind of report log
69
+	 * @var string error_log|screen|all
70
+	 */
71
+	private static $_sKindOfReportLog = 'error_log';
72
+
73
+	/**
74
+	 * instance of logger
75
+	 * @var \Venus\lib\Debug
76
+	 */
77
+	private static $_oInstance;
78 78
  
79
-    /**
80
-     * Send back the isntance or create it
81
-     * 
82
-     * @access public
83
-     * @return \Venus\lib\Debug
84
-     */
85
-    public static function getInstance() : Debug
86
-    {    
87
-        if (!(self::$_oInstance instanceof self)) { self::$_oInstance = new self(); }
79
+	/**
80
+	 * Send back the isntance or create it
81
+	 * 
82
+	 * @access public
83
+	 * @return \Venus\lib\Debug
84
+	 */
85
+	public static function getInstance() : Debug
86
+	{    
87
+		if (!(self::$_oInstance instanceof self)) { self::$_oInstance = new self(); }
88 88
  
89
-        return self::$_oInstance;
90
-    }
91
-
92
-    /**
93
-     * activate debug
94
-     *
95
-     * @access public
96
-     * @return void
97
-     */
98
-    public static function activateDebug()
99
-    {
100
-        if (self::$_bFirstActivation === true) {
101
-
102
-            self::_setFileNameInErrorFile();
103
-            self::$_bFirstActivation = false;
104
-        }
105
-
106
-        self::_initLogFile();
107
-        self::$_bActivateDebug = true;
108
-        self::activateError(E_ALL);
109
-        self::activateException(E_ALL);
110
-    }
111
-
112
-    /**
113
-     * activate debug
114
-     *
115
-     * @access public
116
-     * @return void
117
-     */
118
-    public static function deactivateDebug()
119
-    {
120
-        self::$_bActivateDebug = false;
121
-    }
122
-
123
-    /**
124
-     * check if debug is activate or not
125
-     *
126
-     * @access public
127
-     * @return boolean
128
-     */
129
-    public static function isDebug() : bool
130
-    {
131
-        return self::$_bActivateDebug;
132
-    }
133
-
134
-    /**
135
-     * activate error reporting
136
-     *
137
-     * @access public
138
-     * @param  int $iLevel level of error
139
-     * @return void
140
-     */
141
-    public static function activateError($iLevel)
142
-    {
143
-        if (self::$_bFirstActivation === true) {
144
-
145
-            self::_setFileNameInErrorFile();
146
-            self::$_bFirstActivation = false;
147
-        }
148
-
149
-        self::_initLogFile();
150
-        self::$_bActivateError = true;
151
-
152
-        error_reporting($iLevel);
153
-
154
-        set_error_handler(function ($iErrNo, $sErrStr, $sErrFile, $iErrLine)
155
-        {
156
-            $aContext = array('file' => $sErrFile, 'line' => $iErrLine);
157
-
158
-            $sType = self::getTranslateErrorCode($iErrNo);
159
-
160
-            self::getInstance()->$sType($sErrStr, $aContext);
161
-
162
-            return true;
163
-        }, $iLevel);
164
-
165
-        register_shutdown_function(function()
166
-        {
167
-            if (null !== ($aLastError = error_get_last())) {
168
-
169
-                $aContext = array('file' => $aLastError['file'], 'line' => $aLastError['line']);
170
-
171
-                $sType = self::getTranslateErrorCode($aLastError['type']);
172
-
173
-                self::getInstance()->$sType($aLastError['message'], $aContext);
174
-            }
175
-        });
176
-    }
177
-
178
-    /**
179
-     * activate error reporting
180
-     *
181
-     * @access public
182
-     * @return void
183
-    */
184
-    public static function deactivateError()
185
-    {
186
-        self::$_bActivateError = false;
187
-    }
188
-
189
-    /**
190
-     * check if error reporting is activate or not
191
-     *
192
-     * @access public
193
-     * @return boolean
194
-     */
195
-    public static function isError() : bool
196
-    {
197
-        return self::$_bActivateError;
198
-    }
199
-
200
-
201
-    /**
202
-     * activate Exception
203
-     *
204
-     * @access public
205
-     * @param  int $iLevel level of error
206
-     * @return void
207
-     */
208
-    public static function activateException(int $iLevel)
209
-    {
210
-        if (self::$_bFirstActivation === true) {
211
-
212
-            self::_setFileNameInErrorFile();
213
-            self::$_bFirstActivation = false;
214
-        }
215
-
216
-        self::_initLogFile();
217
-        self::$_bActivateException = true;
218
-
219
-        set_exception_handler(function (\Exception $oException)
220
-        {
221
-            $aContext = array('file' => $oException->getFile(), 'line' => $oException->getLine());
222
-            self::getInstance()->critical($oException->getMessage(), $aContext);
223
-        });
224
-    }
225
-
226
-    /**
227
-     * activate Exception
228
-     *
229
-     * @access public
230
-     * @return void
231
-     */
232
-    public static function deactivateException()
233
-    {
234
-        self::$_bActivateException = false;
235
-    }
236
-
237
-    /**
238
-     * check if Exception is activate or not
239
-     *
240
-     * @access public
241
-     * @return boolean
242
-     */
243
-    public static function isException() : bool
244
-    {
245
-        return self::$_bActivateException;
246
-    }
247
-
248
-    /**
249
-     * set the kind of report Log
250
-     *
251
-     * @access public
252
-     * @param  string $sKindOfReportLog
253
-     * @return void
254
-     */
255
-    public static function setKindOfReportLog(string $sKindOfReportLog)
256
-    {
257
-        if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; }
258
-        else { self::$_sKindOfReportLog = 'error_log'; }
259
-    }
260
-
261
-    /**
262
-     * get the kind of report Log
263
-     *
264
-     * @access public
265
-     * @return string
266
-     */
267
-    public static function getKindOfReportLog() : string
268
-    {
269
-        return self::$_sKindOfReportLog;
270
-    }
271
-
272
-    /**
273
-     * get the code by LogLevel adapt to the PSR-3
274
-     *
275
-     * @access public
276
-     * @param  int $iCode
277
-     * @return string
278
-     */
279
-    public static function getTranslateErrorCode(int $iCode) : string
280
-    {
281
-        if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; }
282
-        else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; }
283
-        else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; }
284
-        else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; }
285
-        else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; }
286
-        else return LogLevel::DEBUG;
287
-    }
288
-
289
-    /**
290
-     * System is unusable.
291
-     *
292
-     * @param string $message
293
-     * @param array $context
294
-     * @return null
295
-     */
296
-    public function emergency($message, array $context = array())
297
-    {
298
-        $this->log(LogLevel::EMERGENCY, $message, $context);
299
-    }
300
-
301
-    /**
302
-     * Action must be taken immediately.
303
-     *
304
-     * Example: Entire website down, database unavailable, etc. This should
305
-     * trigger the SMS alerts and wake you up.
306
-     *
307
-     * @param string $message
308
-     * @param array $context
309
-     * @return null
310
-    */
311
-    public function alert($message, array $context = array())
312
-    {
313
-        $this->log(LogLevel::ALERT, $message, $context);
314
-    }
315
-
316
-    /**
317
-     * Critical conditions.
318
-     *
319
-     * Example: Application component unavailable, unexpected exception.
320
-     *
321
-     * @param string $message
322
-     * @param array $context
323
-     * @return null
324
-    */
325
-    public function critical($message, array $context = array())
326
-    {
327
-        $this->log(LogLevel::CRITICAL, $message, $context);
328
-    }
329
-
330
-    /**
331
-     * Runtime errors that do not require immediate action but should typically
332
-     * be logged and monitored.
333
-     *
334
-     * @param string $message
335
-     * @param array $context
336
-     * @return null
337
-    */
338
-    public function error($message, array $context = array())
339
-    {
340
-        $this->log(LogLevel::ERROR, $message, $context);
341
-    }
342
-
343
-    /**
344
-     * Exceptional occurrences that are not errors.
345
-     *
346
-     * Example: Use of deprecated APIs, poor use of an API, undesirable things
347
-     * that are not necessarily wrong.
348
-     *
349
-     * @param string $message
350
-     * @param array $context
351
-     * @return null
352
-    */
353
-    public function warning($message, array $context = array())
354
-    {
355
-        $this->log(LogLevel::WARNING, $message, $context);
356
-    }
357
-
358
-    /**
359
-     * Normal but significant events.
360
-     *
361
-     * @param string $message
362
-     * @param array $context
363
-     * @return null
364
-    */
365
-    public function notice($message, array $context = array())
366
-    {
367
-        $this->log(LogLevel::NOTICE, $message, $context);
368
-    }
369
-
370
-    /**
371
-     * Interesting events.
372
-     *
373
-     * Example: User logs in, SQL logs.
374
-     *
375
-     * @param string $message
376
-     * @param array $context
377
-     * @return null
378
-    */
379
-    public function info($message, array $context = array())
380
-    {
381
-        $this->log(LogLevel::INFO, $message, $context);
382
-    }
383
-
384
-    /**
385
-     * Detailed debug information.
386
-     *
387
-     * @param string $message
388
-     * @param array $context
389
-     * @return null
390
-    */
391
-    public function debug($message, array $context = array())
392
-    {
393
-        $this->log(LogLevel::DEBUG, $message, $context);
394
-    }
395
-
396
-    /**
397
-     * set the name of the called
398
-     *
399
-     * @access public
400
-     * @return void
401
-     */
402
-    private static function _setFileNameInErrorFile()
403
-    {
404
-        /**
405
-         * We see if it's a cli call or a web call
406
-         */
407
-
408
-        if (defined('BASH_CALLED')) {
409
-
410
-            error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan'));
411
-        }
412
-        else {
413
-
414
-            if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
415
-                error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan'));
416
-            }
417
-        }
418
-    }
419
-
420
-    /**
421
-     * init the log file (error_log)
422
-     *
423
-     * @access private
424
-     * @return void
425
-     */
426
-    private static function _initLogFile()
427
-    {
428
-        self::$_sFileLog = str_replace(DIRECTORY_SEPARATOR.'bundles'.DIRECTORY_SEPARATOR.'lib', '', __DIR__).DIRECTORY_SEPARATOR.
429
-            "data".DIRECTORY_SEPARATOR."log".DIRECTORY_SEPARATOR."php-error.log";
430
-
431
-        ini_set("log_errors", 1);
432
-        ini_set("error_log", self::$_sFileLog);
433
-
434
-        if (file_exists(self::$_sFileLog) === false) { file_put_contents(self::$_sFileLog, ''); }
435
-    }
436
-
437
-    /**
438
-     * constructor in private for the singleton
439
-     *
440
-     * @access private
441
-     * @return \Venus\lib\Debug
442
-     */
443
-    private function __construct() {}
444
-
445
-    /**
446
-     * not allowed to clone a object
447
-     *
448
-     * @access private
449
-     * @return \Venus\lib\Debug
450
-     */
451
-    private function __clone() {}
89
+		return self::$_oInstance;
90
+	}
91
+
92
+	/**
93
+	 * activate debug
94
+	 *
95
+	 * @access public
96
+	 * @return void
97
+	 */
98
+	public static function activateDebug()
99
+	{
100
+		if (self::$_bFirstActivation === true) {
101
+
102
+			self::_setFileNameInErrorFile();
103
+			self::$_bFirstActivation = false;
104
+		}
105
+
106
+		self::_initLogFile();
107
+		self::$_bActivateDebug = true;
108
+		self::activateError(E_ALL);
109
+		self::activateException(E_ALL);
110
+	}
111
+
112
+	/**
113
+	 * activate debug
114
+	 *
115
+	 * @access public
116
+	 * @return void
117
+	 */
118
+	public static function deactivateDebug()
119
+	{
120
+		self::$_bActivateDebug = false;
121
+	}
122
+
123
+	/**
124
+	 * check if debug is activate or not
125
+	 *
126
+	 * @access public
127
+	 * @return boolean
128
+	 */
129
+	public static function isDebug() : bool
130
+	{
131
+		return self::$_bActivateDebug;
132
+	}
133
+
134
+	/**
135
+	 * activate error reporting
136
+	 *
137
+	 * @access public
138
+	 * @param  int $iLevel level of error
139
+	 * @return void
140
+	 */
141
+	public static function activateError($iLevel)
142
+	{
143
+		if (self::$_bFirstActivation === true) {
144
+
145
+			self::_setFileNameInErrorFile();
146
+			self::$_bFirstActivation = false;
147
+		}
148
+
149
+		self::_initLogFile();
150
+		self::$_bActivateError = true;
151
+
152
+		error_reporting($iLevel);
153
+
154
+		set_error_handler(function ($iErrNo, $sErrStr, $sErrFile, $iErrLine)
155
+		{
156
+			$aContext = array('file' => $sErrFile, 'line' => $iErrLine);
157
+
158
+			$sType = self::getTranslateErrorCode($iErrNo);
159
+
160
+			self::getInstance()->$sType($sErrStr, $aContext);
161
+
162
+			return true;
163
+		}, $iLevel);
164
+
165
+		register_shutdown_function(function()
166
+		{
167
+			if (null !== ($aLastError = error_get_last())) {
168
+
169
+				$aContext = array('file' => $aLastError['file'], 'line' => $aLastError['line']);
170
+
171
+				$sType = self::getTranslateErrorCode($aLastError['type']);
172
+
173
+				self::getInstance()->$sType($aLastError['message'], $aContext);
174
+			}
175
+		});
176
+	}
177
+
178
+	/**
179
+	 * activate error reporting
180
+	 *
181
+	 * @access public
182
+	 * @return void
183
+	 */
184
+	public static function deactivateError()
185
+	{
186
+		self::$_bActivateError = false;
187
+	}
188
+
189
+	/**
190
+	 * check if error reporting is activate or not
191
+	 *
192
+	 * @access public
193
+	 * @return boolean
194
+	 */
195
+	public static function isError() : bool
196
+	{
197
+		return self::$_bActivateError;
198
+	}
199
+
200
+
201
+	/**
202
+	 * activate Exception
203
+	 *
204
+	 * @access public
205
+	 * @param  int $iLevel level of error
206
+	 * @return void
207
+	 */
208
+	public static function activateException(int $iLevel)
209
+	{
210
+		if (self::$_bFirstActivation === true) {
211
+
212
+			self::_setFileNameInErrorFile();
213
+			self::$_bFirstActivation = false;
214
+		}
215
+
216
+		self::_initLogFile();
217
+		self::$_bActivateException = true;
218
+
219
+		set_exception_handler(function (\Exception $oException)
220
+		{
221
+			$aContext = array('file' => $oException->getFile(), 'line' => $oException->getLine());
222
+			self::getInstance()->critical($oException->getMessage(), $aContext);
223
+		});
224
+	}
225
+
226
+	/**
227
+	 * activate Exception
228
+	 *
229
+	 * @access public
230
+	 * @return void
231
+	 */
232
+	public static function deactivateException()
233
+	{
234
+		self::$_bActivateException = false;
235
+	}
236
+
237
+	/**
238
+	 * check if Exception is activate or not
239
+	 *
240
+	 * @access public
241
+	 * @return boolean
242
+	 */
243
+	public static function isException() : bool
244
+	{
245
+		return self::$_bActivateException;
246
+	}
247
+
248
+	/**
249
+	 * set the kind of report Log
250
+	 *
251
+	 * @access public
252
+	 * @param  string $sKindOfReportLog
253
+	 * @return void
254
+	 */
255
+	public static function setKindOfReportLog(string $sKindOfReportLog)
256
+	{
257
+		if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; }
258
+		else { self::$_sKindOfReportLog = 'error_log'; }
259
+	}
260
+
261
+	/**
262
+	 * get the kind of report Log
263
+	 *
264
+	 * @access public
265
+	 * @return string
266
+	 */
267
+	public static function getKindOfReportLog() : string
268
+	{
269
+		return self::$_sKindOfReportLog;
270
+	}
271
+
272
+	/**
273
+	 * get the code by LogLevel adapt to the PSR-3
274
+	 *
275
+	 * @access public
276
+	 * @param  int $iCode
277
+	 * @return string
278
+	 */
279
+	public static function getTranslateErrorCode(int $iCode) : string
280
+	{
281
+		if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; }
282
+		else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; }
283
+		else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; }
284
+		else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; }
285
+		else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; }
286
+		else return LogLevel::DEBUG;
287
+	}
288
+
289
+	/**
290
+	 * System is unusable.
291
+	 *
292
+	 * @param string $message
293
+	 * @param array $context
294
+	 * @return null
295
+	 */
296
+	public function emergency($message, array $context = array())
297
+	{
298
+		$this->log(LogLevel::EMERGENCY, $message, $context);
299
+	}
300
+
301
+	/**
302
+	 * Action must be taken immediately.
303
+	 *
304
+	 * Example: Entire website down, database unavailable, etc. This should
305
+	 * trigger the SMS alerts and wake you up.
306
+	 *
307
+	 * @param string $message
308
+	 * @param array $context
309
+	 * @return null
310
+	 */
311
+	public function alert($message, array $context = array())
312
+	{
313
+		$this->log(LogLevel::ALERT, $message, $context);
314
+	}
315
+
316
+	/**
317
+	 * Critical conditions.
318
+	 *
319
+	 * Example: Application component unavailable, unexpected exception.
320
+	 *
321
+	 * @param string $message
322
+	 * @param array $context
323
+	 * @return null
324
+	 */
325
+	public function critical($message, array $context = array())
326
+	{
327
+		$this->log(LogLevel::CRITICAL, $message, $context);
328
+	}
329
+
330
+	/**
331
+	 * Runtime errors that do not require immediate action but should typically
332
+	 * be logged and monitored.
333
+	 *
334
+	 * @param string $message
335
+	 * @param array $context
336
+	 * @return null
337
+	 */
338
+	public function error($message, array $context = array())
339
+	{
340
+		$this->log(LogLevel::ERROR, $message, $context);
341
+	}
342
+
343
+	/**
344
+	 * Exceptional occurrences that are not errors.
345
+	 *
346
+	 * Example: Use of deprecated APIs, poor use of an API, undesirable things
347
+	 * that are not necessarily wrong.
348
+	 *
349
+	 * @param string $message
350
+	 * @param array $context
351
+	 * @return null
352
+	 */
353
+	public function warning($message, array $context = array())
354
+	{
355
+		$this->log(LogLevel::WARNING, $message, $context);
356
+	}
357
+
358
+	/**
359
+	 * Normal but significant events.
360
+	 *
361
+	 * @param string $message
362
+	 * @param array $context
363
+	 * @return null
364
+	 */
365
+	public function notice($message, array $context = array())
366
+	{
367
+		$this->log(LogLevel::NOTICE, $message, $context);
368
+	}
369
+
370
+	/**
371
+	 * Interesting events.
372
+	 *
373
+	 * Example: User logs in, SQL logs.
374
+	 *
375
+	 * @param string $message
376
+	 * @param array $context
377
+	 * @return null
378
+	 */
379
+	public function info($message, array $context = array())
380
+	{
381
+		$this->log(LogLevel::INFO, $message, $context);
382
+	}
383
+
384
+	/**
385
+	 * Detailed debug information.
386
+	 *
387
+	 * @param string $message
388
+	 * @param array $context
389
+	 * @return null
390
+	 */
391
+	public function debug($message, array $context = array())
392
+	{
393
+		$this->log(LogLevel::DEBUG, $message, $context);
394
+	}
395
+
396
+	/**
397
+	 * set the name of the called
398
+	 *
399
+	 * @access public
400
+	 * @return void
401
+	 */
402
+	private static function _setFileNameInErrorFile()
403
+	{
404
+		/**
405
+		 * We see if it's a cli call or a web call
406
+		 */
407
+
408
+		if (defined('BASH_CALLED')) {
409
+
410
+			error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan'));
411
+		}
412
+		else {
413
+
414
+			if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
415
+				error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan'));
416
+			}
417
+		}
418
+	}
419
+
420
+	/**
421
+	 * init the log file (error_log)
422
+	 *
423
+	 * @access private
424
+	 * @return void
425
+	 */
426
+	private static function _initLogFile()
427
+	{
428
+		self::$_sFileLog = str_replace(DIRECTORY_SEPARATOR.'bundles'.DIRECTORY_SEPARATOR.'lib', '', __DIR__).DIRECTORY_SEPARATOR.
429
+			"data".DIRECTORY_SEPARATOR."log".DIRECTORY_SEPARATOR."php-error.log";
430
+
431
+		ini_set("log_errors", 1);
432
+		ini_set("error_log", self::$_sFileLog);
433
+
434
+		if (file_exists(self::$_sFileLog) === false) { file_put_contents(self::$_sFileLog, ''); }
435
+	}
436
+
437
+	/**
438
+	 * constructor in private for the singleton
439
+	 *
440
+	 * @access private
441
+	 * @return \Venus\lib\Debug
442
+	 */
443
+	private function __construct() {}
444
+
445
+	/**
446
+	 * not allowed to clone a object
447
+	 *
448
+	 * @access private
449
+	 * @return \Venus\lib\Debug
450
+	 */
451
+	private function __clone() {}
452 452
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
         error_reporting($iLevel);
153 153
 
154
-        set_error_handler(function ($iErrNo, $sErrStr, $sErrFile, $iErrLine)
154
+        set_error_handler(function($iErrNo, $sErrStr, $sErrFile, $iErrLine)
155 155
         {
156 156
             $aContext = array('file' => $sErrFile, 'line' => $iErrLine);
157 157
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         self::_initLogFile();
217 217
         self::$_bActivateException = true;
218 218
 
219
-        set_exception_handler(function (\Exception $oException)
219
+        set_exception_handler(function(\Exception $oException)
220 220
         {
221 221
             $aContext = array('file' => $oException->getFile(), 'line' => $oException->getLine());
222 222
             self::getInstance()->critical($oException->getMessage(), $aContext);
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
         else {
413 413
 
414 414
             if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
415
-                error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan'));
415
+                error_log(Bash::setColor('############### '.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].' ###############', 'cyan'));
416 416
             }
417 417
         }
418 418
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -254,8 +254,7 @@  discard block
 block discarded – undo
254 254
      */
255 255
     public static function setKindOfReportLog(string $sKindOfReportLog)
256 256
     {
257
-        if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; }
258
-        else { self::$_sKindOfReportLog = 'error_log'; }
257
+        if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; } else { self::$_sKindOfReportLog = 'error_log'; }
259 258
     }
260 259
 
261 260
     /**
@@ -278,12 +277,9 @@  discard block
 block discarded – undo
278 277
      */
279 278
     public static function getTranslateErrorCode(int $iCode) : string
280 279
     {
281
-        if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; }
282
-        else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; }
283
-        else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; }
284
-        else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; }
285
-        else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; }
286
-        else return LogLevel::DEBUG;
280
+        if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; } else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; } else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; } else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; } else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; } else {
281
+        	return LogLevel::DEBUG;
282
+        }
287 283
     }
288 284
 
289 285
     /**
@@ -408,8 +404,7 @@  discard block
 block discarded – undo
408 404
         if (defined('BASH_CALLED')) {
409 405
 
410 406
             error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan'));
411
-        }
412
-        else {
407
+        } else {
413 408
 
414 409
             if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) {
415 410
                 error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan'));
Please login to merge, or discard this patch.
bundles/lib/Bash.php 2 patches
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -28,126 +28,126 @@
 block discarded – undo
28 28
  */
29 29
 class Bash
30 30
 {
31
-    /**
32
-     * color of the text in the bash
33
-     *
34
-     * @access public
35
-     * @var    array
36
-     */
37
-    public static $_aColorCodes = array(
38
-        'default' => 39,
39
-        'black' => 30,
40
-        'red' => 31,
41
-        'green' => 32,
42
-        'yellow' => 33,
43
-        'blue' => 34,
44
-        'magenta' => 35,
45
-        'cyan' => 36,
46
-        'light gray' => 37,
47
-        'dark gray' => 90,
48
-        'light red' => 91,
49
-        'light green' => 92,
50
-        'light yellow' => 93,
51
-        'light blue' => 94,
52
-        'light magenta' => 95,
53
-        'light cyan' => 96,
54
-        'white' => 97
55
-    );
31
+	/**
32
+	 * color of the text in the bash
33
+	 *
34
+	 * @access public
35
+	 * @var    array
36
+	 */
37
+	public static $_aColorCodes = array(
38
+		'default' => 39,
39
+		'black' => 30,
40
+		'red' => 31,
41
+		'green' => 32,
42
+		'yellow' => 33,
43
+		'blue' => 34,
44
+		'magenta' => 35,
45
+		'cyan' => 36,
46
+		'light gray' => 37,
47
+		'dark gray' => 90,
48
+		'light red' => 91,
49
+		'light green' => 92,
50
+		'light yellow' => 93,
51
+		'light blue' => 94,
52
+		'light magenta' => 95,
53
+		'light cyan' => 96,
54
+		'white' => 97
55
+	);
56 56
 
57
-    /**
58
-     * color of the background in the bash
59
-     *
60
-     * @access public
61
-     * @var    array
62
-     */
63
-    public static $_aBackgroundCodes = array(
64
-        'default' => 49,
65
-        'black' => 40,
66
-        'red' => 41,
67
-        'green' => 42,
68
-        'yellow' => 43,
69
-        'blue' => 44,
70
-        'magenta' => 45,
71
-        'cyan' => 46,
72
-        'light gray' => 47,
73
-        'dark gray' => 100,
74
-        'light red' => 101,
75
-        'light green' => 102,
76
-        'light yellow' => 103,
77
-        'light blue' => 104,
78
-        'light magenta' => 105,
79
-        'light cyan' => 106,
80
-        'white' => 107
81
-    );
57
+	/**
58
+	 * color of the background in the bash
59
+	 *
60
+	 * @access public
61
+	 * @var    array
62
+	 */
63
+	public static $_aBackgroundCodes = array(
64
+		'default' => 49,
65
+		'black' => 40,
66
+		'red' => 41,
67
+		'green' => 42,
68
+		'yellow' => 43,
69
+		'blue' => 44,
70
+		'magenta' => 45,
71
+		'cyan' => 46,
72
+		'light gray' => 47,
73
+		'dark gray' => 100,
74
+		'light red' => 101,
75
+		'light green' => 102,
76
+		'light yellow' => 103,
77
+		'light blue' => 104,
78
+		'light magenta' => 105,
79
+		'light cyan' => 106,
80
+		'white' => 107
81
+	);
82 82
 
83
-    /**
84
-     * color of the decoration code in the bash
85
-     *
86
-     * @access public
87
-     * @var    array
88
-     */
89
-    public static $_aDecorationCodes = array(
90
-        'bold' => '1',
91
-        'dim' => '2',
92
-        'underline' => '4',
93
-        'blink' => '5',
94
-        'reverse' => '7',
95
-        'hidden' => '8'
96
-    );
83
+	/**
84
+	 * color of the decoration code in the bash
85
+	 *
86
+	 * @access public
87
+	 * @var    array
88
+	 */
89
+	public static $_aDecorationCodes = array(
90
+		'bold' => '1',
91
+		'dim' => '2',
92
+		'underline' => '4',
93
+		'blink' => '5',
94
+		'reverse' => '7',
95
+		'hidden' => '8'
96
+	);
97 97
 
98
-    /**
99
-     * set a decoration of the text
100
-     *
101
-     * @access public
102
-     * @param  string $sContent content to around by the style
103
-     * @param  string $sStyleName the name of the style
104
-     * @return string
105
-     */
106
-    public static function setDecoration(string $sContent, string $sStyleName) : string
107
-    {
108
-        return self::_applyCode($sContent, self::$_aBackgroundCodes[$sStyleName]);
109
-    }
98
+	/**
99
+	 * set a decoration of the text
100
+	 *
101
+	 * @access public
102
+	 * @param  string $sContent content to around by the style
103
+	 * @param  string $sStyleName the name of the style
104
+	 * @return string
105
+	 */
106
+	public static function setDecoration(string $sContent, string $sStyleName) : string
107
+	{
108
+		return self::_applyCode($sContent, self::$_aBackgroundCodes[$sStyleName]);
109
+	}
110 110
 
111
-    /**
112
-     * set a color of the background
113
-     *
114
-     * @access public
115
-     * @param  string $sContent content to around by the style
116
-     * @param  string $sColorName the name of the color
117
-     * @return string
118
-     */
119
-    public static function setBackground(string $sContent, string $sColorName) : string
120
-    {
121
-        if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'black'; }
111
+	/**
112
+	 * set a color of the background
113
+	 *
114
+	 * @access public
115
+	 * @param  string $sContent content to around by the style
116
+	 * @param  string $sColorName the name of the color
117
+	 * @return string
118
+	 */
119
+	public static function setBackground(string $sContent, string $sColorName) : string
120
+	{
121
+		if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'black'; }
122 122
 
123
-        return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]);
124
-    }
123
+		return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]);
124
+	}
125 125
 
126
-    /**
127
-     * set a color of the text
128
-     *
129
-     * @access public
130
-     * @param  string $sContent content to around by the style
131
-     * @param  string $sColorName the name of the color
132
-     * @return string
133
-     */
134
-    public static function setColor(string $sContent, string $sColorName) : string
135
-    {
136
-        if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'white'; }
126
+	/**
127
+	 * set a color of the text
128
+	 *
129
+	 * @access public
130
+	 * @param  string $sContent content to around by the style
131
+	 * @param  string $sColorName the name of the color
132
+	 * @return string
133
+	 */
134
+	public static function setColor(string $sContent, string $sColorName) : string
135
+	{
136
+		if (!isset(self::$_aBackgroundCodes[$sColorName])) { $sColorName = 'white'; }
137 137
 
138
-        return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]);
139
-    }
138
+		return self::_applyCode($sContent, self::$_aBackgroundCodes[$sColorName]);
139
+	}
140 140
 
141
-    /**
142
-     * around the text by a color
143
-     *
144
-     * @access private
145
-     * @param  string $sContent content to around by the style
146
-     * @param  string $sCode the name of the code (color or decoration)
147
-     * @return string
148
-     */
149
-    private static function _applyCode(string $sContent, string $sCode) : string
150
-    {
151
-        return "\033[" . $sCode . "m" . $sContent . "\033[0m\n";
152
-    }
141
+	/**
142
+	 * around the text by a color
143
+	 *
144
+	 * @access private
145
+	 * @param  string $sContent content to around by the style
146
+	 * @param  string $sCode the name of the code (color or decoration)
147
+	 * @return string
148
+	 */
149
+	private static function _applyCode(string $sContent, string $sCode) : string
150
+	{
151
+		return "\033[" . $sCode . "m" . $sContent . "\033[0m\n";
152
+	}
153 153
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,6 +148,6 @@
 block discarded – undo
148 148
      */
149 149
     private static function _applyCode(string $sContent, string $sCode) : string
150 150
     {
151
-        return "\033[" . $sCode . "m" . $sContent . "\033[0m\n";
151
+        return "\033[".$sCode."m".$sContent."\033[0m\n";
152 152
     }
153 153
 }
Please login to merge, or discard this patch.
bundles/core/Mother.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@
 block discarded – undo
129 129
 	 * @param  mixed $mOffset
130 130
 	 * @return boolean
131 131
 	 */
132
-    public function offsetExists($mOffset)
132
+	public function offsetExists($mOffset)
133 133
 	{
134 134
 		return $this->__isset($mOffset);
135 135
 	}
Please login to merge, or discard this patch.