PHP 8.2.31
Preview: ResourceStorages.php Size: 1.45 KB
//home/nshryvcy/radiantskinclinics.org/wp-content/plugins/woocommerce/packages/blueprint/src/ResourceStorages.php

<?php

namespace Automattic\WooCommerce\Blueprint;

use Automattic\WooCommerce\Blueprint\ResourceStorages\ResourceStorage;

/**
 * Class ResourceStorages
 */
class ResourceStorages {
	/**
	 * Storage collection.
	 *
	 * @var ResourceStorages[]
	 */
	protected array $storages = array();

	/**
	 * Add a downloader.
	 *
	 * @param ResourceStorage $downloader The downloader to add.
	 *
	 * @return void
	 */
	public function add_storage( ResourceStorage $downloader ) {
		$supported_resource = $downloader->get_supported_resource();
		if ( ! isset( $this->storages[ $supported_resource ] ) ) {
			$this->storages[ $supported_resource ] = array();
		}
		$this->storages[ $supported_resource ][] = $downloader;
	}

	/**
	 * Check if the resource is supported.
	 *
	 * @param string $resource_type The resource type to check.
	 *
	 * @return bool
	 */
	public function is_supported_resource( $resource_type ) {
		return isset( $this->storages[ $resource_type ] );
	}

	/**
	 * Download the resource.
	 *
	 * @param string $slug The slug of the resource to download.
	 * @param string $resource_type The resource type to download.
	 *
	 * @return false|string
	 */
	public function download( $slug, $resource_type ) {
		if ( ! isset( $this->storages[ $resource_type ] ) ) {
			return false;
		}
		$storages = $this->storages[ $resource_type ];
		foreach ( $storages as $storage ) {
			$found = $storage->download( $slug );
			if ( $found ) {
				return $found;
			}
		}

		return false;
	}
}

Directory Contents

Dirs: 8 × Files: 15

Name Size Perms Modified Actions
Cli DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
docs DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Exporters DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Importers DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Schemas DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
Steps DIR
- drwxr-xr-x 2026-05-29 02:43:21
Edit Download
474 B lrw-r--r-- 2025-05-12 21:07:28
Edit Download
1.81 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
6.05 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
1.78 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
4.30 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
2.34 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
4.46 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
4.07 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
1.45 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
680 B lrw-r--r-- 2025-05-12 21:07:28
Edit Download
3.56 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
3.13 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
1.51 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
9.72 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download
4.39 KB lrw-r--r-- 2025-05-12 21:07:28
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).