@@ -24,8 +24,7 @@ |
||
| 24 | 24 | $dateString = $date->format('Y-m-d H:i:s'); |
| 25 | 25 | |
| 26 | 26 | return $dateString; |
| 27 | - } |
|
| 28 | - else { |
|
| 27 | + } else { |
|
| 29 | 28 | return $input; |
| 30 | 29 | } |
| 31 | 30 | } |
| 32 | 31 | \ No newline at end of file |
@@ -22,8 +22,7 @@ discard block |
||
| 22 | 22 | && (get_class($input) === DateTime::class || get_class($input) === DateTimeImmutable::class) |
| 23 | 23 | ) { |
| 24 | 24 | $then = $input; |
| 25 | - } |
|
| 26 | - else { |
|
| 25 | + } else { |
|
| 27 | 26 | $then = new DateTime($input); |
| 28 | 27 | } |
| 29 | 28 | |
@@ -48,29 +47,21 @@ discard block |
||
| 48 | 47 | if ($secs <= 10) { |
| 49 | 48 | $output = "just now"; |
| 50 | 49 | $pluralise = false; |
| 51 | - } |
|
| 52 | - elseif ($secs > 10 && $secs < $minuteCut) { |
|
| 50 | + } elseif ($secs > 10 && $secs < $minuteCut) { |
|
| 53 | 51 | $output = round($secs / $second) . " second"; |
| 54 | - } |
|
| 55 | - elseif ($secs >= $minuteCut && $secs < $hourCut) { |
|
| 52 | + } elseif ($secs >= $minuteCut && $secs < $hourCut) { |
|
| 56 | 53 | $output = round($secs / $minute) . " minute"; |
| 57 | - } |
|
| 58 | - elseif ($secs >= $hourCut && $secs < $dayCut) { |
|
| 54 | + } elseif ($secs >= $hourCut && $secs < $dayCut) { |
|
| 59 | 55 | $output = round($secs / $hour) . " hour"; |
| 60 | - } |
|
| 61 | - elseif ($secs >= $dayCut && $secs < $weekCut) { |
|
| 56 | + } elseif ($secs >= $dayCut && $secs < $weekCut) { |
|
| 62 | 57 | $output = round($secs / $day) . " day"; |
| 63 | - } |
|
| 64 | - elseif ($secs >= $weekCut && $secs < $monthCut) { |
|
| 58 | + } elseif ($secs >= $weekCut && $secs < $monthCut) { |
|
| 65 | 59 | $output = round($secs / $week) . " week"; |
| 66 | - } |
|
| 67 | - elseif ($secs >= $monthCut && $secs < $yearCut) { |
|
| 60 | + } elseif ($secs >= $monthCut && $secs < $yearCut) { |
|
| 68 | 61 | $output = round($secs / $month) . " month"; |
| 69 | - } |
|
| 70 | - elseif ($secs >= $yearCut && $secs < $year * 10) { |
|
| 62 | + } elseif ($secs >= $yearCut && $secs < $year * 10) { |
|
| 71 | 63 | $output = round($secs / $year) . " year"; |
| 72 | - } |
|
| 73 | - else { |
|
| 64 | + } else { |
|
| 74 | 65 | $output = "a long time ago"; |
| 75 | 66 | $pluralise = false; |
| 76 | 67 | } |
@@ -75,8 +75,7 @@ |
||
| 75 | 75 | ob_end_clean(); |
| 76 | 76 | |
| 77 | 77 | $message = str_replace('$2$', $textErrorData, $message); |
| 78 | - } |
|
| 79 | - else { |
|
| 78 | + } else { |
|
| 80 | 79 | $message = str_replace('$2$', "", $message); |
| 81 | 80 | } |
| 82 | 81 | |
@@ -295,8 +295,7 @@ |
||
| 295 | 295 | if (!$proxyIsInPrivateRange) { |
| 296 | 296 | $proxyReverseDns = $this->getRdnsProvider()->getReverseDNS($proxyAddress); |
| 297 | 297 | $proxyLocation = $this->getLocationProvider()->getIpLocation($proxyAddress); |
| 298 | - } |
|
| 299 | - else { |
|
| 298 | + } else { |
|
| 300 | 299 | // this is going to fail, so why bother trying? |
| 301 | 300 | $proxyReverseDns = false; |
| 302 | 301 | $proxyLocation = false; |
@@ -52,7 +52,8 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return int |
| 54 | 54 | */ |
| 55 | - $sortKey = function(DataObject $item) { |
|
| 55 | + $sortKey = function(DataObject $item) |
|
| 56 | + { |
|
| 56 | 57 | if ($item instanceof Log) { |
| 57 | 58 | return $item->getTimestamp()->getTimestamp(); |
| 58 | 59 | } |
@@ -296,8 +297,7 @@ discard block |
||
| 296 | 297 | // some old templates have been completely deleted and lost to the depths of time. |
| 297 | 298 | if ($welcomeTemplate === false) { |
| 298 | 299 | return "Welcome template #{$objectId}"; |
| 299 | - } |
|
| 300 | - else { |
|
| 300 | + } else { |
|
| 301 | 301 | $userCode = htmlentities($welcomeTemplate->getUserCode(), ENT_COMPAT, 'UTF-8'); |
| 302 | 302 | |
| 303 | 303 | return "<a href=\"{$baseurl}/internal.php/welcomeTemplates/view?template={$objectId}\">{$userCode}</a>"; |
@@ -66,8 +66,7 @@ |
||
| 66 | 66 | $this->cache[$username] = false; |
| 67 | 67 | |
| 68 | 68 | return false; |
| 69 | - } |
|
| 70 | - else { |
|
| 69 | + } else { |
|
| 71 | 70 | $this->cache[$username] = $result; |
| 72 | 71 | |
| 73 | 72 | return $result['line']; |
@@ -234,11 +234,9 @@ |
||
| 234 | 234 | |
| 235 | 235 | if ($method == 'GET') { |
| 236 | 236 | $data = $this->httpHelper->get($this->mediawikiWebServiceEndpoint, $apiParams); |
| 237 | - } |
|
| 238 | - elseif ($method == 'POST') { |
|
| 237 | + } elseif ($method == 'POST') { |
|
| 239 | 238 | $data = $this->httpHelper->post($this->mediawikiWebServiceEndpoint, $apiParams); |
| 240 | - } |
|
| 241 | - else { |
|
| 239 | + } else { |
|
| 242 | 240 | throw new ApplicationLogicException('Unsupported HTTP Method'); |
| 243 | 241 | } |
| 244 | 242 | |
@@ -52,7 +52,8 @@ discard block |
||
| 52 | 52 | return $this; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function statusIn($statuses) { |
|
| 55 | + public function statusIn($statuses) |
|
| 56 | + { |
|
| 56 | 57 | $this->inClause('status', $statuses); |
| 57 | 58 | |
| 58 | 59 | return $this; |
@@ -77,14 +78,16 @@ discard block |
||
| 77 | 78 | * |
| 78 | 79 | * @return $this |
| 79 | 80 | */ |
| 80 | - public function lastActiveBefore(DateTime $instant){ |
|
| 81 | + public function lastActiveBefore(DateTime $instant) |
|
| 82 | + { |
|
| 81 | 83 | $this->whereClause .= ' AND origin.lastactive < ?'; |
| 82 | 84 | $this->parameterList[] = $instant->format("Y-m-d H:i:s"); |
| 83 | 85 | |
| 84 | 86 | return $this; |
| 85 | 87 | } |
| 86 | 88 | |
| 87 | - public function getRoleMap(&$roleMap){ |
|
| 89 | + public function getRoleMap(&$roleMap) |
|
| 90 | + { |
|
| 88 | 91 | $query = <<<SQL |
| 89 | 92 | SELECT /* UserSearchHelper/roleMap */ |
| 90 | 93 | r.user user |
@@ -77,13 +77,15 @@ discard block |
||
| 77 | 77 | * @param string $column The required column |
| 78 | 78 | * @return array |
| 79 | 79 | */ |
| 80 | - public function fetchColumn($column){ |
|
| 80 | + public function fetchColumn($column) |
|
| 81 | + { |
|
| 81 | 82 | $statement = $this->getData(array($column)); |
| 82 | 83 | |
| 83 | 84 | return $statement->fetchAll(PDO::FETCH_COLUMN); |
| 84 | 85 | } |
| 85 | 86 | |
| 86 | - public function fetchMap($column){ |
|
| 87 | + public function fetchMap($column) |
|
| 88 | + { |
|
| 87 | 89 | $statement = $this->getData(array('id', $column)); |
| 88 | 90 | |
| 89 | 91 | $data = $statement->fetchAll(PDO::FETCH_ASSOC); |
@@ -192,12 +194,14 @@ discard block |
||
| 192 | 194 | return $query; |
| 193 | 195 | } |
| 194 | 196 | |
| 195 | - public function inIds($idList) { |
|
| 197 | + public function inIds($idList) |
|
| 198 | + { |
|
| 196 | 199 | $this->inClause('id', $idList); |
| 197 | 200 | return $this; |
| 198 | 201 | } |
| 199 | 202 | |
| 200 | - protected function inClause($column, $values) { |
|
| 203 | + protected function inClause($column, $values) |
|
| 204 | + { |
|
| 201 | 205 | if (count($values) === 0) { |
| 202 | 206 | return; |
| 203 | 207 | } |