Skip to content

Commit

Permalink
fix checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
diosmosis committed Oct 24, 2023
1 parent ee49691 commit 59f65a6
Showing 1 changed file with 37 additions and 36 deletions.
73 changes: 37 additions & 36 deletions classes/WpMatomo/Admin/SystemReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -666,19 +666,19 @@ private function get_matomo_info() {
$rows = $this->add_diagnostic_results( $rows, $report->getOptionalDiagnosticResults() );

try {
$cli_multi = new CliMulti();
$cli_multi = new CliMulti();
$suports_async = $cli_multi->supportsAsync();

$rows[] = [
'name' => esc_html__( 'Supports Async Archiving', 'matomo' ),
'value' => $suports_async,
'name' => esc_html__( 'Supports Async Archiving', 'matomo' ),
'value' => $suports_async,
'comment' => '',
];
} catch (\Exception $e) {
} catch ( \Exception $e ) {
$rows[] = [
'name' => esc_html__( 'Supports Async Archiving', 'matomo' ),
'value' => 'Could not check if async archiving is supported.',
'comment' => $e->getMessage(),
'name' => esc_html__( 'Supports Async Archiving', 'matomo' ),
'value' => 'Could not check if async archiving is supported.',
'comment' => $e->getMessage(),
'is_error' => true,
];
}
Expand Down Expand Up @@ -710,11 +710,11 @@ private function get_matomo_info() {
'comment' => '',
];
}
} catch (\Exception $e) {
} catch ( \Exception $e ) {
$rows[] = [
'name' => 'Location provider ID',
'value' => 'Failed to get the configured Location Provider.',
'comment' => $e->getMessage(),
'name' => 'Location provider ID',
'value' => 'Failed to get the configured Location Provider.',
'comment' => $e->getMessage(),
'is_error' => true,
];
}
Expand All @@ -738,29 +738,29 @@ private function get_matomo_info() {
}

try {
$incompatible_plugins = Plugin\Manager::getInstance()->getIncompatiblePlugins(Version::VERSION);
if (!empty($incompatible_plugins)) {
$incompatible_plugins = Plugin\Manager::getInstance()->getIncompatiblePlugins( Version::VERSION );
if ( ! empty( $incompatible_plugins ) ) {
$rows[] = [
'section' => esc_html__('Incompatible Matomo plugins', 'matomo'),
'section' => esc_html__( 'Incompatible Matomo plugins', 'matomo' ),
];
foreach ($incompatible_plugins as $plugin) {
foreach ( $incompatible_plugins as $plugin ) {
$rows[] = [
'name' => 'Plugin has missing dependencies',
'value' => $plugin->getPluginName(),
'name' => 'Plugin has missing dependencies',
'value' => $plugin->getPluginName(),
'is_error' => true,
'comment' => sprintf(esc_html__('%s If the plugin requires a different Matomo version you may need to update it. If you no longer use it consider uninstalling it.', 'matomo'), $plugin->getMissingDependenciesAsString(Version::VERSION)),
'comment' => sprintf( esc_html__( '%s If the plugin requires a different Matomo version you may need to update it. If you no longer use it consider uninstalling it.', 'matomo' ), $plugin->getMissingDependenciesAsString( Version::VERSION ) ),
];
}
}
} catch (\Exception $e) {
} catch ( \Exception $e ) {
$rows[] = [
'section' => esc_html__('Incompatible Matomo plugins', 'matomo'),
'section' => esc_html__( 'Incompatible Matomo plugins', 'matomo' ),
];
$rows[] = [
'name' => 'Incompatible Matomo plugin check',
'value' => 'Failed to check for incompatible Matomo plugins.',
'name' => 'Incompatible Matomo plugin check',
'value' => 'Failed to check for incompatible Matomo plugins.',
'is_error' => true,
'comment' => $e->getMessage(),
'comment' => $e->getMessage(),
];
}
}
Expand Down Expand Up @@ -788,16 +788,16 @@ private function get_matomo_info() {

try {
$matomo_url = SettingsPiwik::getPiwikUrl();
$rows[] = [
'name' => 'Matomo URL',
$rows[] = [
'name' => 'Matomo URL',
'comment' => $matomo_url,
'value' => !empty($matomo_url),
'value' => ! empty( $matomo_url ),
];
} catch (\Exception $e) {
} catch ( \Exception $e ) {
$rows[] = [
'name' => 'Matomo URL',
'comment' => $e->getMessage(),
'value' => 'Failed to fetch the Matomo URL.',
'name' => 'Matomo URL',
'comment' => $e->getMessage(),
'value' => 'Failed to fetch the Matomo URL.',
'is_error' => true,
];
}
Expand Down Expand Up @@ -1017,9 +1017,9 @@ private function convert_time_to_date( $time, $in_blog_timezone, $print_diff = f
if ( $print_diff && class_exists( '\Piwik\Metrics\Formatter' ) ) {
try {
$formatter = new \Piwik\Metrics\Formatter();
$date .= ' (' . $formatter->getPrettyTimeFromSeconds($time - time(), true, false) . ')';
} catch (\Exception $e) {
// ignore
$date .= ' (' . $formatter->getPrettyTimeFromSeconds( $time - time(), true, false ) . ')';
} catch ( \Exception $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
// empty
}
}

Expand Down Expand Up @@ -1062,9 +1062,10 @@ private function add_diagnostic_results( $rows, $results ) {
}

private function get_wordpress_info() {
$is_multi_site = is_multisite();
$num_blogs = 1;
$is_network_enabled = false;
$is_multi_site = is_multisite();
$num_blogs = 1;
$is_network_enabled = false;

if ( $is_multi_site ) {
if ( function_exists( 'get_blog_count' ) ) {
$num_blogs = get_blog_count();
Expand Down

0 comments on commit 59f65a6

Please sign in to comment.