[] - Classes that handle all Jetpack Boost features. */ const FEATURES = array( Critical_CSS::class, Cloud_CSS::class, Image_Size_Analysis::class, Minify_JS::class, Minify_CSS::class, Render_Blocking_JS::class, Image_Guide::class, Image_CDN::class, Performance_History::class, Page_Cache::class, Speculation_Rules::class, ); /** * @var class-string[] - Classes that handle all Jetpack Boost subfeatures. */ const SUB_FEATURES = array( Minify_Common::class, Liar::class, Quality_Settings::class, Cache_Preload::class, ); /** * Get all features and subfeatures. * * @return class-string[] */ public static function get_all_features() { return array_merge( self::FEATURES, self::SUB_FEATURES ); } /** * Get the subfeatures of a feature. * * @param Feature $feature The feature to get the subfeatures of. * @return class-string[] The subfeatures of the feature. */ public static function get_sub_features_of( Feature $feature ) { /** * @var class-string[] */ $subfeatures = array(); $feature_class = get_class( $feature ); foreach ( self::SUB_FEATURES as $subfeature ) { if ( in_array( $feature_class, $subfeature::get_parent_features(), true ) ) { $subfeatures[] = $subfeature; } } return $subfeatures; } }