HEX
Server: Apache
System: Linux webm004.cluster121.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64
User: grainesdfo (155059)
PHP: 5.4.45
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/grainesdfo/www/wp-content/plugins/backwpup/src/Frontend/ServiceProvider.php
<?php
declare(strict_types=1);

namespace WPMedia\BackWPup\Frontend;

use WPMedia\BackWPup\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider;
use WPMedia\BackWPup\Frontend\API\Rest as FrontendApiRest;
use WPMedia\BackWPup\Frontend\API\Subscriber as FrontendApiSubscriber;
use WPMedia\BackWPup\Adapters\BackWPupHelpersAdapter;

/**
 * Service provider for Storage providers
 */
class ServiceProvider extends AbstractServiceProvider {
	/**
	 * Service provided by this provider
	 *
	 * @var array
	 */
	protected $provides = [
		'frontend_api_subscriber',
		'frontend_api_rest',
	];

	/**
	 * Subscribers provided by this provider
	 *
	 * @var array
	 */
	public $subscribers = [
		'frontend_api_subscriber',
	];

	/**
	 * Check if the service provider provides a specific service.
	 *
	 * @param string $id The id of the service.
	 *
	 * @return bool
	 */
	public function provides( string $id ): bool {
		return in_array( $id, $this->provides, true );
	}

	/**
	 * Registers items with the container
	 *
	 * @return void
	 */
	public function register(): void {
		$this->getContainer()->addShared( 'frontend_api_rest', FrontendApiRest::class )
			->addArguments(
				[
					'backwpup_helpers_adapter' => $this->getContainer()->get( 'backwpup_helpers_adapter' ),
				]
				);

		$this->getContainer()->addShared( 'frontend_api_subscriber', FrontendApiSubscriber::class )
			->addArgument( 'frontend_api_rest' );
	}

	/**
	 * Returns the subscribers array
	 *
	 * @return array
	 */
	public function get_subscribers() {
		return $this->subscribers;
	}
}