<?php
/**
 * Header Class
 *
 * @package errigal
 * @since 1.1.0
 */

namespace Errigal\Header;

defined( 'ABSPATH' ) || exit;

use Errigal\Constant\{
	Errigal_Header_Class as Header_Class,
	Errigal_Header_Hook as Header_Hook,
};
use Errigal\Shared\{
	Errigal_Utility as Utility,
	Errigal_Validator as Validator,
};

/**
 * This class is in charge of providing header settings and functions.
 *
 * @since 1.1.0
 */
class Errigal_Header {
	/**
	 * Gets site header classes.
	 *
	 * @since 1.1.0
	 *
	 * @return string[]
	 */
	public static function get_site_header_classes() {
		/**
		 * Filters site header classes.
		 *
		 * @since 1.1.0
		 *
		 * @param string[] $classes Site header class names.
		 */
		$classes = apply_filters(
			Header_Hook::SITE_HEADER_CLASSES,
			array(
				Header_Class::SITE_HEADER,
			)
		);

		return Utility::sanitise_classes( $classes );
	}

	/**
	 * Gets post header classes.
	 *
	 * @since 1.1.0
	 *
	 * @return string[]
	 */
	public static function get_post_header_classes() {
		/**
		 * Filters post header class.
		 *
		 * @since 1.1.0
		 *
		 * @param string[] $classes Post header class names.
		 */
		$classes = apply_filters(
			Header_Hook::POST_HEADER_CLASSES,
			array(
				Header_Class::POST_HEADER,
			)
		);

		return Utility::sanitise_classes( $classes );
	}

	/**
	 * Determines whether page header is accessible only to screen readers.
	 *
	 * @since 1.1.0
	 *
	 * @return bool
	 */
	public static function is_screen_reader_only_page_header() {
		/**
		 * Filters can show.
		 *
		 * @since 1.1.0
		 *
		 * @param bool $is_screen_reader_only_page_header Whether page header is accessible only to screen readers.
		 */
		$is_screen_reader_only_page_header = apply_filters(
			Header_Hook::IS_SCREEN_READER_ONLY_PAGE_HEADER,
			is_front_page()
		);

		return Validator::is_true( $is_screen_reader_only_page_header );
	}
}
