HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/studis.kauko.lt/wp-content/plugins/the-events-calendar/common/src/Common/Controller.php
<?php
/**
 * TEC Common Controller - For all new sub-controllers.
 *
 * @since 6.5.4
 *
 * @package TEC\Common;
 */

namespace TEC\Common;

use TEC\Common\Contracts\Provider\Controller as Controller_Contract;
use TEC\Common\Json_Packer\Json_Packer;
use TEC\Common\Lists\Country as Country_List;
use TEC\Common\REST\Controller as REST_Controller;

/**
 * Class Controller
 *
 * @since 6.5.4
 */
class Controller extends Controller_Contract {

	/**
	 * Registers the filters and actions hooks added by the controller.
	 *
	 * @since 6.5.4
	 *
	 * @return void
	 */
	protected function do_register(): void {
		$this->container->singleton( Template::class );
		$this->container->singleton( Country_List::class );
		$this->container->singleton( Json_Packer::class );

		$this->container->register( Hooks::class );
		$this->container->register( Key_Value_Cache\Controller::class );

		// Load controllers after all common libs are loaded and initial hooks are in place.
		add_action( 'tribe_common_loaded', [ $this, 'load_controllers' ] );
	}

	/**
	 * Load controllers after all common libs are loaded and initial hooks are in place.
	 *
	 * @since 6.9.0
	 *
	 * @return void
	 */
	public function load_controllers(): void {
		$this->container->register( AI\Controller::class );
		$this->container->register( REST_Controller::class );
	}

	/**
	 * Removes the filters and actions hooks added by the controller.
	 *
	 * @since 6.5.4
	 *
	 * @return void Filters and actions hooks added by the controller are be removed.
	 */
	public function unregister(): void {
		$this->container->get( Hooks::class )->unregister();
		$this->container->get( Key_Value_Cache\Controller::class )->unregister();
		$this->container->get( REST_Controller::class )->unregister();
	}
}