Passed
Push — master ( a13744...a0b838 )
by Florent
02:41
created
src/Controllers/PostsController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
                     // Check if comments exists for this post
68 68
                     $cmts = $this->app->get('commentsdir') . $permlink . '.comments';
69
-                    if ((! file_exists($cmts)) || (file_exists($cmts)) && (time() - filemtime($cmts) > 120)) {
69
+                    if ((!file_exists($cmts)) || (file_exists($cmts)) && (time() - filemtime($cmts) > 120)) {
70 70
                         $api = new HiveCondenser($apiConfig);
71 71
                         $replies = $api->getContentReplies($article['author'], $permlink);
72 72
                         $result = json_encode($replies, JSON_PRETTY_PRINT);
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $posts = [];
111 111
         $result = [];
112 112
 
113
-        if (! isset($tag)) {
113
+        if (!isset($tag)) {
114 114
             $result = [];
115 115
         } else {
116 116
             $matches = [];
Please login to merge, or discard this patch.
src/Controllers/CommonController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
         $file = $this->app->get('blogfile');
50 50
 
51 51
         // if the JSON file doesn't exist or if it's old, take it from API
52
-        if (! file_exists($file) || (time() - filemtime($file) > 120)) {
52
+        if (!file_exists($file) || (time() - filemtime($file) > 120)) {
53 53
             // Prepare API call according to displayed posts type
54 54
             $displayType = $settings['displayType']['type'];
55 55
             if ($displayType === 'author') {
Please login to merge, or discard this patch.
src/Controllers/WalletController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         /*
56 56
          *  Get Hive engine tokens from account
57 57
          */
58
-        if ((! file_exists($heFile)) || ($current_time - filemtime($heFile) > $cache_interval)) {
58
+        if ((!file_exists($heFile)) || ($current_time - filemtime($heFile) > $cache_interval)) {
59 59
             $config = [
60 60
                 'debug' => false,
61 61
                 'heNode' => 'api.hive-engine.com/rpc',
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
         ];
81 81
         $api = new HiveCondenser($apiConfig);
82 82
 
83
-        if ((! file_exists($accountFile)) || ($current_time - filemtime($accountFile) > $cache_interval)) {
83
+        if ((!file_exists($accountFile)) || ($current_time - filemtime($accountFile) > $cache_interval)) {
84 84
             $result = json_encode($api->getAccounts($settings['author']), JSON_PRETTY_PRINT);
85 85
             file_put_contents($accountFile, $result);
86 86
         }
87 87
 
88
-        if ((! file_exists($bcFile)) || ($current_time - filemtime($bcFile) > 600)) {
88
+        if ((!file_exists($bcFile)) || ($current_time - filemtime($bcFile) > 600)) {
89 89
             $result = json_encode($api->getDynamicGlobalProperties(), JSON_PRETTY_PRINT);
90 90
             file_put_contents($bcFile, $result);
91 91
         }
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
          */
98 98
         $bcVars = json_decode(file_get_contents($bcFile), true);
99 99
         $vests = [];
100
-        $vests['tvfh'] = (float) $bcVars['total_vesting_fund_hive'];
101
-        $vests['tvs'] = (float) $bcVars['total_vesting_shares'];
100
+        $vests['tvfh'] = (float)$bcVars['total_vesting_fund_hive'];
101
+        $vests['tvs'] = (float)$bcVars['total_vesting_shares'];
102 102
         $vests['totalVests'] = $vests['tvfh'] / $vests['tvs'];
103
-        $vests['userHP'] = round((float) $account[0]['vesting_shares'] * $vests['totalVests'], 3);
104
-        $vests['delegHP'] = round((float) $account[0]['delegated_vesting_shares'] * $vests['totalVests'], 3);
103
+        $vests['userHP'] = round((float)$account[0]['vesting_shares'] * $vests['totalVests'], 3);
104
+        $vests['delegHP'] = round((float)$account[0]['delegated_vesting_shares'] * $vests['totalVests'], 3);
105 105
 
106 106
         /*
107 107
          * Just render the view with vars
Please login to merge, or discard this patch.
src/Controllers/HomeController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -222,7 +222,7 @@
 block discarded – undo
222 222
         $file = $this->app->get('blogfile');
223 223
         $articles = json_decode(file_get_contents($file), true);
224 224
 
225
-        if($tag !== null) {
225
+        if ($tag !== null) {
226 226
             foreach ($articles as $article) {
227 227
                 $metadata = json_decode($article['json_metadata'], true);
228 228
                 $tags = implode(',', $metadata['tags']);
Please login to merge, or discard this patch.
src/start.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 $container->set('themesdir', __DIR__ . '/../public/themes/');
45 45
 
46 46
 // Rename config.sample.json to config.json
47
-$confDir =  __DIR__ . '/../config/';
47
+$confDir = __DIR__ . '/../config/';
48 48
 if ((file_exists($confDir . 'config.sample.json')) && (!file_exists($confDir . 'config.json'))) {
49 49
     copy($confDir . 'config.sample.json', $confDir . 'config.json');
50 50
 }
51 51
 
52 52
 // Set settings array in container for use in all routes
53
-$container->set('settings', static function () {
53
+$container->set('settings', static function() {
54 54
     $config = file_get_contents(__DIR__ . '/../config/config.json');
55 55
     return json_decode($config, true);
56 56
 });
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 //AppFactory::setContainer($container);
109 109
 
110 110
 // Set Twig engine for templating
111
-$container->set('view', static function () {
111
+$container->set('view', static function() {
112 112
     $settings = json_decode(file_get_contents(__DIR__ . '/../config/config.json'), true);
113 113
     $tpls = [
114 114
         __DIR__ . '/../resources/views/',
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 });
134 134
 
135 135
 //Set Session engine
136
-$container->set('session', static function () {
136
+$container->set('session', static function() {
137 137
     return new Helper();
138 138
 });
139 139
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 $app->post('/login', HomeController::class . ':loginPost')->setName('login-post');
191 191
 
192 192
 // Admin routes
193
-$app->group('/admin', static function (RouteCollectorProxy $group): void {
193
+$app->group('/admin', static function(RouteCollectorProxy $group): void {
194 194
     $group->get('', AdminController::class . ':adminIndex')->setName('admin');
195 195
 
196 196
     $group->get('/settings', AdminController::class . ':adminSettings')->setName('admin-settings');
Please login to merge, or discard this patch.
src/Controllers/AdminController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         $passwd = $cred[$author];
52 52
 
53 53
         /* If sessons keys are not set */
54
-        if (! isset($session['sh_author']) || (! isset($session['sh_sign']))) {
54
+        if (!isset($session['sh_author']) || (!isset($session['sh_sign']))) {
55 55
             header('Location: /login');
56 56
             die;
57 57
         }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
         $cache_interval = 300;
88 88
 
89 89
         $current_time = time();
90
-        if ((! file_exists($accountFile)) || ($current_time - filemtime($accountFile) > $cache_interval)) {
90
+        if ((!file_exists($accountFile)) || ($current_time - filemtime($accountFile) > $cache_interval)) {
91 91
             $result = json_encode($api->getAccounts($settings['author']), JSON_PRETTY_PRINT);
92 92
             file_put_contents($accountFile, $result);
93 93
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $cache_interval = 300;
128 128
 
129 129
         $current_time = time();
130
-        if ((! file_exists($accountFile)) || ($current_time - filemtime($accountFile) > $cache_interval)) {
130
+        if ((!file_exists($accountFile)) || ($current_time - filemtime($accountFile) > $cache_interval)) {
131 131
             $result = json_encode($api->getAccounts($settings['author']), JSON_PRETTY_PRINT);
132 132
             file_put_contents($accountFile, $result);
133 133
         }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
         $settings = $this->app->get('settings');
208 208
 
209 209
         foreach ($data as $key => $value) {
210
-            if(mb_strpos($key, "-") !== false){
210
+            if (mb_strpos($key, "-") !== false) {
211 211
                 $pieces = explode("-", $key);
212 212
                 if (array_key_exists($pieces[1], $settings[$pieces[0]])) {
213 213
                     $settings[$pieces[0]][$pieces[1]] = $value;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -203,7 +203,9 @@
 block discarded – undo
203 203
         $data = $request->getParsedBody();
204 204
         if (isset($data['redirect'])) {
205 205
             $redirect = $data['redirect'];
206
-        } else $redirect = '/admin/';
206
+        } else {
207
+            $redirect = '/admin/';
208
+        }
207 209
         $settings = $this->app->get('settings');
208 210
 
209 211
         foreach ($data as $key => $value) {
Please login to merge, or discard this patch.