Skip to content

Commit 8f04339

Browse files
committed
TBF
1 parent 24dbc5e commit 8f04339

5 files changed

Lines changed: 7 additions & 11 deletions

File tree

lib/MC/Google/Visualization.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -535,11 +535,7 @@ public function getRowValues(array $row, array $meta): string
535535
if (1 === preg_match('#^num:(\d+)(.*)$#i', $format, $matches)) {
536536
$digits = (int) $matches[1];
537537
$extras = str_split($matches[2]);
538-
if (2 === count($extras)) {
539-
$formatted = number_format($val, $digits, $extras[0], $extras[1]);
540-
} else {
541-
$formatted = number_format($val, $digits);
542-
}
538+
$formatted = 2 === count($extras) ? number_format($val, $digits, $extras[0], $extras[1]) : number_format($val, $digits);
543539
} elseif ('dollars' === $format) {
544540
$formatted = '$'.number_format($val, 2);
545541
} elseif ('percent' === $format) {
@@ -979,7 +975,7 @@ protected function generateSQL(array &$meta): string
979975
}
980976

981977
$pivotSql = 'SELECT '.implode(', ', $pivotFields).' FROM '.$meta['table'];
982-
if (count($pivotJoins) > 0) {
978+
if ([] !== $pivotJoins) {
983979
$pivotSql .= ' '.implode(' ', $pivotJoins);
984980
}
985981
$pivotSql .= ' GROUP BY '.implode(', ', $pivotGroup);
@@ -1075,7 +1071,7 @@ protected function generateSQL(array &$meta): string
10751071
$wheres[] = $meta['global_where'];
10761072
}
10771073

1078-
if (count($wheres) > 0) {
1074+
if ([] !== $wheres) {
10791075
$sql .= ' WHERE '.implode(' AND ', $wheres);
10801076
}
10811077

lib/MC/Parser/Def/Literal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(string $search, bool $caseless = false, bool $fullwo
3535
*/
3636
public function _parse(string $str, int $loc): array
3737
{
38-
$match = !$this->caseless ? strpos($str, $this->search, $loc) : stripos($str, $this->search, $loc);
38+
$match = $this->caseless ? stripos($str, $this->search, $loc) : strpos($str, $this->search, $loc);
3939

4040
if ($match !== $loc) {
4141
throw new ParseError('Expected: '.$this->search, $str, $loc);

lib/MC/Parser/Token/Group.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getNameValues(): array
6868

6969
public function hasChildren(): bool
7070
{
71-
return count($this->subtoks) > 0;
71+
return [] !== $this->subtoks;
7272
}
7373

7474
/**

tests/ExampleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testQueryJoins(): void
142142
$output = $vis->handleRequest(false, $parameters);
143143

144144
// hack, different PHP version have different float rounding
145-
$output = preg_replace('/69\.22149730656[0-9]+/', '69.22149730656', $output);
145+
$output = preg_replace('/69\.22149730656\d+/', '69.22149730656', $output);
146146
assert(is_string($output));
147147

148148
// file_put_contents(__DIR__.'/result3.js', $output);

tests/VisualizationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function testCallback(): void
147147
'req_callback' => [
148148
'fields' => ['field'],
149149
'type' => 'text',
150-
'callback' => [__CLASS__, 'callbackTest'],
150+
'callback' => [self::class, 'callbackTest'],
151151
],
152152
],
153153
]);

0 commit comments

Comments
 (0)