@@ -653,7 +653,7 @@ |
||
| 653 | 653 | ], |
| 654 | 654 | ], // EXISTS OR |
| 655 | 655 | ], |
| 656 | - ]; // global OR |
|
| 656 | + ]; // global OR |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | /** |
@@ -62,10 +62,10 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | public function ObjectUriProvider() { |
| 64 | 64 | return [ |
| 65 | - ['1234.ics', '.ics', '1234'], // ok, cut .ics |
|
| 66 | - ['5678AF.vcf', '.vcf', '5678AF'], // ok, cut .vcf |
|
| 67 | - ['123400.vcf', '.ics', '123400.vcf'], // different extension, return as is |
|
| 68 | - ['1234.ics', '.vcf', '1234.ics'], // different extension, return as is |
|
| 65 | + ['1234.ics', '.ics', '1234'], // ok, cut .ics |
|
| 66 | + ['5678AF.vcf', '.vcf', '5678AF'], // ok, cut .vcf |
|
| 67 | + ['123400.vcf', '.ics', '123400.vcf'], // different extension, return as is |
|
| 68 | + ['1234.ics', '.vcf', '1234.ics'], // different extension, return as is |
|
| 69 | 69 | ]; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -56,15 +56,18 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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) { |