JezK
Edit File: AccelerateWpImageOptimization.php
<?php /** * Copyright (с) Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2023 All Rights Reserved */ namespace WP_Rocket\Cli; use Exception; use WP_CLI; /** * AccelerateWp Image optimization */ class AccelerateWpImageOptimization { use AccelerateWpCliTrait; /** * Image optimization activate. * * @param array $args Positional arguments. * @param array $assoc_args Associative arguments. * * @return void * @throws Exception Something went wrong. */ private function enable( $args = [], $assoc_args = [] ) { // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed try { $validated = $this->validate_cli_args( $assoc_args ); do_action( 'rocket_image_optimization_accelerate_wp_cli_enable', $validated['unique_id'] ); WP_CLI::success( 'Enabled.' ); } catch ( Exception $e ) { $code = $e->getCode() > 0 ? $e->getCode() : 1; WP_CLI::error( $e->getMessage(), $code ); } } /** * Image optimization deactivate. * * @param array $args Positional arguments. * @param array $assoc_args Associative arguments. * * @return void * @throws Exception Something went wrong. */ private function disable( $args = [], $assoc_args = [] ) { // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed try { do_action( 'rocket_image_optimization_accelerate_wp_cli_disable' ); WP_CLI::success( 'Disabled.' ); } catch ( Exception $e ) { $code = $e->getCode() > 0 ? $e->getCode() : 1; WP_CLI::error( $e->getMessage(), $code ); } } }