<?php

namespace GravityKit\GravityExport;

use GravityKit\GravityExport\Addon\GravityExportAddon;

/**
 * Base class for implementing features.
 * @since $ver$
 */
abstract class Feature {
	/**
	 * @var array
	 */
	protected static $instantiated = [];

	/**
	 * The plugin add on.
	 * @since $ver$
	 * @var GravityExportAddon
	 */
	protected $addon;

	/**
	 * Creates the feature instance.
	 * @since $ver$
	 */
	public function __construct( GravityExportAddon $addon ) {
		if ( in_array( get_class( $this ), self::$instantiated, true ) ) {
			return;
		}

		$this->addon = $addon;
		$this->init();

		self::$instantiated[] = get_class( $this );
	}

	/**
	 * Initializes the feature.
	 * @since $ver$
	 */
	protected function init(): void {
	}
}
