AccessiblePrivateMethods.php
5 months ago
OrderAttributionMeta.php
1 year ago
RestApiCache.php
4 months ago
ScriptDebug.php
2 years ago
ScriptDebug.php
33 lines
| 1 | <?php |
| 2 | declare( strict_types=1 ); |
| 3 | |
| 4 | namespace Automattic\WooCommerce\Internal\Traits; |
| 5 | |
| 6 | use Automattic\Jetpack\Constants; |
| 7 | |
| 8 | /** |
| 9 | * Trait ScriptDebug |
| 10 | * |
| 11 | * @since 8.5.0 |
| 12 | */ |
| 13 | trait ScriptDebug { |
| 14 | |
| 15 | /** |
| 16 | * Get the script suffix based on the SCRIPT_DEBUG constant. |
| 17 | * |
| 18 | * @return string |
| 19 | */ |
| 20 | protected function get_script_suffix(): string { |
| 21 | return $this->is_script_debug_enabled() ? '' : '.min'; |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Check if SCRIPT_DEBUG is enabled. |
| 26 | * |
| 27 | * @return bool |
| 28 | */ |
| 29 | protected function is_script_debug_enabled(): bool { |
| 30 | return Constants::is_true( 'SCRIPT_DEBUG' ); |
| 31 | } |
| 32 | } |
| 33 |