Passed
Push — development ( e8788a...7cb7af )
by Peter
01:51
created
app/controller/actions/CheckLicenseAction.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,13 +40,13 @@
 block discarded – undo
40 40
             $license = $config->get('bfx.accounts.'.$account, null);
41 41
             $knownAccount = !is_null($license);
42 42
             $license = $license ?: $config->get('bfx.accounts.default');
43
-            $expires = date('Ymd', time() + 1*MONTH);                       // extend license for 30 days
43
+            $expires = date('Ymd', time() + 1 * MONTH); // extend license for 30 days
44 44
             $reply = $account.'|'.$license.'|A|'.$expires.'|mt4tfv|ok';
45 45
         }
46 46
         else {
47
-            $reply = 'ERROR: '.($account=="" ? 'Missing':'Invalid').' account number.|no';
47
+            $reply = 'ERROR: '.($account == "" ? 'Missing' : 'Invalid').' account number.|no';
48 48
         }
49
-        $knownAccount || Logger::log('reply: '.$reply, L_INFO);             // log requests for unknown accounts
49
+        $knownAccount || Logger::log('reply: '.$reply, L_INFO); // log requests for unknown accounts
50 50
 
51 51
         echo $reply;
52 52
         return null;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@
 block discarded – undo
42 42
             $license = $license ?: $config->get('bfx.accounts.default');
43 43
             $expires = date('Ymd', time() + 1*MONTH);                       // extend license for 30 days
44 44
             $reply = $account.'|'.$license.'|A|'.$expires.'|mt4tfv|ok';
45
-        }
46
-        else {
45
+        } else {
47 46
             $reply = 'ERROR: '.($account=="" ? 'Missing':'Invalid').' account number.|no';
48 47
         }
49 48
         $knownAccount || Logger::log('reply: '.$reply, L_INFO);             // log requests for unknown accounts
Please login to merge, or discard this patch.
app/init.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@
 block discarded – undo
8 8
 
9 9
 
10 10
 // class loader
11
-require(($appRoot=dirname(__DIR__)).'/vendor/autoload.php');
11
+require(($appRoot = dirname(__DIR__)).'/vendor/autoload.php');
12 12
 
13 13
 
14 14
 // php.ini settings
15 15
 error_reporting(E_ALL & ~E_DEPRECATED);
16 16
 
17
-PHP::ini_set('display_errors',     (string)(int)CLI             );
18
-PHP::ini_set('html_errors',        '0'                          );
19
-PHP::ini_set('error_log',          $appRoot.'/log/php-error.log');
20
-PHP::ini_set('log_errors',         '1'                          );
21
-PHP::ini_set('log_errors_max_len', '0'                          );
22
-PHP::ini_set('default_charset',    'UTF-8'                      );
17
+PHP::ini_set('display_errors', (string) (int) CLI);
18
+PHP::ini_set('html_errors', '0');
19
+PHP::ini_set('error_log', $appRoot.'/log/php-error.log');
20
+PHP::ini_set('log_errors', '1');
21
+PHP::ini_set('log_errors_max_len', '0');
22
+PHP::ini_set('default_charset', 'UTF-8');
23 23
 
24 24
 
25 25
 // create a new application
Please login to merge, or discard this patch.
bin/logwatch.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 
36 36
 set_time_limit(0);
37
-$quiet = false;                                             // e.g. for CRON
37
+$quiet = false; // e.g. for CRON
38 38
 
39 39
 
40 40
 // --- Parse and validate command line arguments ----------------------------------------------------------------------------
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 $args = array_slice($_SERVER['argv'], 1);
45 45
 
46 46
 foreach ($args as $i => $arg) {
47
-    if ($arg == '-h') { help(); exit(0);                           }
47
+    if ($arg == '-h') { help(); exit(0); }
48 48
     if ($arg == '-q') { $quiet = true; unset($args[$i]); continue; }
49 49
 
50 50
     $msg = "invalid argument: $arg";
@@ -60,24 +60,24 @@  discard block
 block discarded – undo
60 60
 
61 61
 // define the location of the error log
62 62
 $errorLog = ini_get('error_log');
63
-if (empty($errorLog) || $errorLog=='syslog') {              // errors are logged elsewhere
63
+if (empty($errorLog) || $errorLog == 'syslog') {              // errors are logged elsewhere
64 64
     if (!$quiet) {
65 65
         if (empty($errorLog)) $where = 'STDERR';
66
-        else                  $where = WINDOWS ? 'event log':'syslog';
66
+        else                  $where = WINDOWS ? 'event log' : 'syslog';
67 67
         echof("errors are logged elsewhere ($where)");
68 68
     }
69 69
     exit(0);
70 70
 }
71 71
 
72 72
 // check log file for existence and process it
73
-if (!is_file    ($errorLog)) { $quiet || echof('error log empty: '       .$errorLog); exit(0); }
73
+if (!is_file($errorLog)) { $quiet || echof('error log empty: '.$errorLog); exit(0); }
74 74
 if (!is_writable($errorLog)) {          stderr('cannot access log file: '.$errorLog); exit(1); }
75 75
 $errorLog = realpath($errorLog);
76 76
 
77 77
 // rename the file; we don't want to lock it cause doing so could block the main app
78 78
 $tempName = tempnam(dirname($errorLog), basename($errorLog).'.');
79 79
 if (!rename($errorLog, $tempName)) {
80
-    stderr('cannot rename log file: '  .$errorLog);
80
+    stderr('cannot rename log file: '.$errorLog);
81 81
     exit(1);
82 82
 }
83 83
 
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 $hFile = fopen($tempName, 'rb');
87 87
 $line  = $entry = '';
88 88
 $i = 0;
89
-while (($line=fgets($hFile)) !== false) {
89
+while (($line = fgets($hFile)) !== false) {
90 90
     $i++;
91
-    $line = trim($line, "\r\n");                // PHP doesn't correctly handle EOL_NETSCAPE which is error_log() standard on Windows
91
+    $line = trim($line, "\r\n"); // PHP doesn't correctly handle EOL_NETSCAPE which is error_log() standard on Windows
92 92
     if (strStartsWith($line, '[')) {            // lines starting with a bracket "[" are considered the start of an entry
93 93
         processEntry($entry);
94 94
         $entry = '';
95 95
     }
96 96
     $entry .= $line.NL;
97 97
 }
98
-processEntry($entry);                           // process the last entry (if any)
98
+processEntry($entry); // process the last entry (if any)
99 99
 
100 100
 // delete the processed file
101 101
 fclose($hFile);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     if (!strlen($entry)) return;
122 122
 
123 123
     /** @var Config $config */
124
-    $config = Application::getDi()['config'];                       // @phpstan-ignore offsetAccess.notFound
124
+    $config = Application::getDi()['config']; // @phpstan-ignore offsetAccess.notFound
125 125
     $receivers = [];
126 126
 
127 127
     foreach (explode(',', $config->get('log.mail.receiver', '')) as $receiver) {
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     }                                                               // without receivers mail is sent to the system user
134 134
     !$receivers && $receivers[] = strtolower(get_current_user().'@localhost');
135 135
 
136
-    $subject = (string)strtok($entry, "\r\n");                      // that's CR or LF, not CRLF
136
+    $subject = (string) strtok($entry, "\r\n"); // that's CR or LF, not CRLF
137 137
     $message = $entry;
138 138
     $sender  = null;
139 139
     $headers = [];
Please login to merge, or discard this patch.
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,8 +49,11 @@  discard block
 block discarded – undo
49 49
 
50 50
     $msg = "invalid argument: $arg";
51 51
 
52
-    if ($quiet) stderr($msg);
53
-    else        help($msg);
52
+    if ($quiet) {
53
+        stderr($msg);
54
+    } else {
55
+        help($msg);
56
+    }
54 57
     exit(1);
55 58
 }
56 59
 
@@ -62,8 +65,11 @@  discard block
 block discarded – undo
62 65
 $errorLog = ini_get('error_log');
63 66
 if (empty($errorLog) || $errorLog=='syslog') {              // errors are logged elsewhere
64 67
     if (!$quiet) {
65
-        if (empty($errorLog)) $where = 'STDERR';
66
-        else                  $where = WINDOWS ? 'event log':'syslog';
68
+        if (empty($errorLog)) {
69
+            $where = 'STDERR';
70
+        } else {
71
+            $where = WINDOWS ? 'event log':'syslog';
72
+        }
67 73
         echof("errors are logged elsewhere ($where)");
68 74
     }
69 75
     exit(0);
@@ -118,7 +124,9 @@  discard block
 block discarded – undo
118 124
 function processEntry($entry) {
119 125
     Assert::string($entry);
120 126
     $entry = trim($entry);
121
-    if (!strlen($entry)) return;
127
+    if (!strlen($entry)) {
128
+        return;
129
+    }
122 130
 
123 131
     /** @var Config $config */
124 132
     $config = Application::getDi()['config'];                       // @phpstan-ignore offsetAccess.notFound
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -164,5 +164,5 @@
 block discarded – undo
164 164
            -h   This help screen.
165 165
 
166 166
 
167
-HELP;
167
+help;
168 168
 }
Please login to merge, or discard this patch.