<?php

namespace WP_science\ThirdParty\Plugins\Optimization;

use WP_science\Event_Management\Subscriber_Interface;

class scienceLazyLoad implements Subscriber_Interface {
	/**
	 * Return an array of events that this subscriber wants to listen to.
	 *
	 * @return array
	 */
	public static function get_subscribed_events(): array {
		if ( ! defined( 'science_LL_VERSION' ) ) {
			return [];
		}

		return [
			'science_delay_js_exclusions' => 'exclude_science_lazyload_script',
		];
	}

	/**
	 * Excludes science lazyload script from delay js.
	 *
	 * @param array $excluded List of excluded files.
	 *
	 * @return array
	 */
	public function exclude_science_lazyload_script( $excluded ): array {
		$excluded[] = 'science-lazy-load/assets/js/\d\d\.\d/lazyload.min.js';
		return $excluded;
	}
}
