@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $timeline = []; |
| 96 | 96 | $startObj = new DateTime($start); |
| 97 | 97 | $endObj = new DateTime($end); |
| 98 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
| 98 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
| 99 | 99 | $grandSum = 0; |
| 100 | 100 | |
| 101 | 101 | // Generate array of date labels |
@@ -105,17 +105,17 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | foreach ($data as $entry) { |
| 107 | 107 | if (!isset($totals[$entry['tool']])) { |
| 108 | - $totals[$entry['tool']] = (int) $entry['count']; |
|
| 108 | + $totals[$entry['tool']] = (int)$entry['count']; |
|
| 109 | 109 | |
| 110 | 110 | // Create arrays for each tool, filled with zeros for each date in the timeline |
| 111 | 111 | $timeline[$entry['tool']] = array_fill(0, $numDays, 0); |
| 112 | 112 | } else { |
| 113 | - $totals[$entry['tool']] += (int) $entry['count']; |
|
| 113 | + $totals[$entry['tool']] += (int)$entry['count']; |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $date = new DateTime($entry['date']); |
| 117 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
| 118 | - $timeline[$entry['tool']][$dateIndex] = (int) $entry['count']; |
|
| 117 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
| 118 | + $timeline[$entry['tool']][$dateIndex] = (int)$entry['count']; |
|
| 119 | 119 | |
| 120 | 120 | $grandSum += $entry['count']; |
| 121 | 121 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $timeline = []; |
| 153 | 153 | $startObj = new DateTime($start); |
| 154 | 154 | $endObj = new DateTime($end); |
| 155 | - $numDays = (int) $endObj->diff($startObj)->format("%a"); |
|
| 155 | + $numDays = (int)$endObj->diff($startObj)->format("%a"); |
|
| 156 | 156 | $grandSum = 0; |
| 157 | 157 | |
| 158 | 158 | // Generate array of date labels |
@@ -162,17 +162,17 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | foreach ($data as $entry) { |
| 164 | 164 | if (!isset($totals[$entry['endpoint']])) { |
| 165 | - $totals[$entry['endpoint']] = (int) $entry['count']; |
|
| 165 | + $totals[$entry['endpoint']] = (int)$entry['count']; |
|
| 166 | 166 | |
| 167 | 167 | // Create arrays for each endpoint, filled with zeros for each date in the timeline |
| 168 | 168 | $timeline[$entry['endpoint']] = array_fill(0, $numDays, 0); |
| 169 | 169 | } else { |
| 170 | - $totals[$entry['endpoint']] += (int) $entry['count']; |
|
| 170 | + $totals[$entry['endpoint']] += (int)$entry['count']; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $date = new DateTime($entry['date']); |
| 174 | - $dateIndex = (int) $date->diff($startObj)->format("%a"); |
|
| 175 | - $timeline[$entry['endpoint']][$dateIndex] = (int) $entry['count']; |
|
| 174 | + $dateIndex = (int)$date->diff($startObj)->format("%a"); |
|
| 175 | + $timeline[$entry['endpoint']][$dateIndex] = (int)$entry['count']; |
|
| 176 | 176 | |
| 177 | 177 | $grandSum += $entry['count']; |
| 178 | 178 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | $conn = $this->container->get('doctrine')->getManager('default')->getConnection(); |
| 222 | - $date = date('Y-m-d'); |
|
| 222 | + $date = date('Y-m-d'); |
|
| 223 | 223 | |
| 224 | 224 | // Increment count in timeline |
| 225 | 225 | $existsSql = "SELECT 1 FROM usage_timeline |
@@ -136,8 +136,8 @@ |
||
| 136 | 136 | $titles = []; |
| 137 | 137 | |
| 138 | 138 | while ($row = $sth->fetch()) { |
| 139 | - $titles[] = $namespaces[$row['page_namespace']] . |
|
| 140 | - ':' .$row['page_title']; |
|
| 139 | + $titles[] = $namespaces[$row['page_namespace']]. |
|
| 140 | + ':'.$row['page_title']; |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Chunking... it's possible to make a URI too long |
@@ -347,7 +347,7 @@ |
||
| 347 | 347 | ]; |
| 348 | 348 | |
| 349 | 349 | if ($pages->getNumResults() === $pages->resultsPerPage()) { |
| 350 | - $ret['continue'] = $this->offset + 1; |
|
| 350 | + $ret['continue'] = $this->offset+1; |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | return $this->getFormattedApiResponse($ret); |
@@ -197,7 +197,7 @@ |
||
| 197 | 197 | |
| 198 | 198 | // Number the quotes, since they somehow have significance. |
| 199 | 199 | foreach ($quotes as $index => $quote) { |
| 200 | - $numberedQuotes[(string)($index + 1)] = $quote; |
|
| 200 | + $numberedQuotes[(string)($index+1)] = $quote; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return new JsonResponse($numberedQuotes, Response::HTTP_OK); |
@@ -149,7 +149,7 @@ |
||
| 149 | 149 | $this->setUpAdminStats(); |
| 150 | 150 | |
| 151 | 151 | // Maximum 31 days. |
| 152 | - $days = min((int) $days, 31); |
|
| 152 | + $days = min((int)$days, 31); |
|
| 153 | 153 | $start = date('Y-m-d', strtotime("-$days days")); |
| 154 | 154 | $end = date('Y-m-d'); |
| 155 | 155 | |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | use Symfony\Component\HttpFoundation\Request; |
| 5 | 5 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types = 1); |
|
| 2 | +declare(strict_types=1); |
|
| 3 | 3 | |
| 4 | 4 | use Symfony\Component\Debug\Debug; |
| 5 | 5 | use Symfony\Component\HttpFoundation\Request; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | // Feel free to remove this, extend it, or make something more sophisticated. |
| 14 | 14 | if (isset($_SERVER['HTTP_CLIENT_IP']) |
| 15 | 15 | || isset($_SERVER['HTTP_X_FORWARDED_FOR']) |
| 16 | - || !( in_array(@$_SERVER['REMOTE_ADDR'], [ '127.0.0.1', 'fe80::1', '::1' ]) || 'cli-server' === php_sapi_name() ) |
|
| 16 | + || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || 'cli-server' === php_sapi_name()) |
|
| 17 | 17 | ) { |
| 18 | 18 | header('HTTP/1.0 403 Forbidden'); |
| 19 | 19 | exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | $params = $this->convertLegacyParams($params); |
| 505 | 505 | |
| 506 | 506 | // Remove blank values. |
| 507 | - return array_filter($params, function ($param) { |
|
| 507 | + return array_filter($params, function($param) { |
|
| 508 | 508 | // 'namespace' or 'username' could be '0'. |
| 509 | 509 | return null !== $param && '' !== $param; |
| 510 | 510 | }); |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | $response->setStatusCode(Response::HTTP_OK); |
| 656 | 656 | |
| 657 | 657 | $elapsedTime = round( |
| 658 | - microtime(true) - $this->request->server->get('REQUEST_TIME_FLOAT'), |
|
| 658 | + microtime(true)-$this->request->server->get('REQUEST_TIME_FLOAT'), |
|
| 659 | 659 | 3 |
| 660 | 660 | ); |
| 661 | 661 | |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | $conn = $this->container->get('doctrine') |
| 683 | 683 | ->getManager('default') |
| 684 | 684 | ->getConnection(); |
| 685 | - $date = date('Y-m-d'); |
|
| 685 | + $date = date('Y-m-d'); |
|
| 686 | 686 | |
| 687 | 687 | // Increment count in timeline |
| 688 | 688 | $existsSql = "SELECT 1 FROM usage_api_timeline |
@@ -128,7 +128,7 @@ |
||
| 128 | 128 | // 'Category:', which sometimes is used cross-wiki (because it still works). |
| 129 | 129 | $normalized = false; |
| 130 | 130 | $nsName = $this->project->getNamespaces()[14].':'; |
| 131 | - $this->categories = array_map(function ($category) use ($nsName, &$normalized) { |
|
| 131 | + $this->categories = array_map(function($category) use ($nsName, &$normalized) { |
|
| 132 | 132 | if (0 === strpos($category, $nsName) || 0 === strpos($category, 'Category:')) { |
| 133 | 133 | $normalized = true; |
| 134 | 134 | } |