$model * @param int $post_id * @param string $subtree_id * @return array */ protected function analyze( array $model, int $post_id, string $subtree_id ): array { $result = Design_Mutator::edit( $model, static function ( array &$settings, array $element ): array { $changes = array(); foreach ( array_keys( $settings ) as $key ) { $key = (string) $key; if ( ! str_ends_with( $key, '_tablet' ) && ! str_ends_with( $key, '_mobile' ) ) { continue; } $base = (string) preg_replace( '/_(tablet|mobile)$/', '', $key ); if ( ! array_key_exists( $base, $settings ) ) { continue; } if ( $settings[ $base ] === $settings[ $key ] ) { $changes = array_merge( $changes, Design_Mutator::clear( $settings, $key ) ); } } return $changes; } ); if ( is_wp_error( $result ) ) { return $result; } return Design_Mutator::report( $result, __( 'Removed responsive overrides that only repeated the desktop value.', 'acrossai-abilities-manager' ), __( 'Every responsive override in scope differs from its desktop value, so nothing was redundant and nothing was changed.', 'acrossai-abilities-manager' ) ); } }