<?php
/**
 * Zenvy Breadcrumb
 *
 * @package Zenvy
 */

/**
 * Class for breadcrumb.
 *
 * @access public
 */
class Zenvy_Breadcrumb {

	/**
	 * Instance
	 *
	 * @access private
	 * @var object
	 */
	private static $instance;

	/**
	 * Returns the instance.
	 *
	 * @access public
	 * @return object
	 */
	public static function get_instance() {
		if ( ! isset( self::$instance ) ) {
			self::$instance = new self();
		}

		return self::$instance;
	}

	/**
	 * Constructor method.
	 *
	 * @access private
	 * @return void
	 */
	private function __construct() {

		// Include trial breadcrumb.
		require ZENVY_THEME_DIR . 'inc/classes/Zenvy_Breadcrumb_Trail.php';
	}

	/**
	 * Get the breadcrumb trail output.
	 *
	 * @return mixed
	 */
	public static function get_breadcrumb() {

		$defaults = [
			'show_browse' => false,
			'echo'        => true,
		];

		$args = apply_filters( 'zenvy_breadcrumb_trail_args', $defaults );

		$breadcrumb = apply_filters( 'zenvy_breadcrumb_trail_object', null, $args );

		if ( ! is_object( $breadcrumb ) ) {
			$breadcrumb = new Zenvy_Breadcrumb_Trail( $args );
		}

		return $breadcrumb->trail();
	}
}

Zenvy_Breadcrumb::get_instance();
