PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / trunk
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution vtrunk
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / Cache_Delivery / Manager_Collection.php

Manager_Collection.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution trunk, at src/Performance/Cache_Delivery/Manager_Collection.php

52 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * A collection of Cache Delivery managers, indexed by their cache delivery type.
4 *
5 * @package SolidWP\Performance
6 */
7
8 declare( strict_types=1 );
9
10 namespace SolidWP\Performance\Cache_Delivery;
11
12 use SolidWP\Performance\Cache_Delivery\Htaccess\Manager as HtaccessManager;
13 use SolidWP\Performance\Cache_Delivery\Nginx\Manager as NginxManager;
14
15 /**
16 * A collection of Cache Delivery managers, indexed by their cache delivery type.
17 *
18 * @see Cache_Delivery_Type::all()
19 * @see Provider::register_manager_collection()
20 *
21 * @package SolidWP\Performance
22 */
23 final class Manager_Collection {
24
25 /**
26 * The manager instances indexed by their cache delivery type.
27 *
28 * @var array<string, HtaccessManager|NginxManager>
29 */
30 private array $managers;
31
32 /**
33 * @param array<string, HtaccessManager|NginxManager> $managers The manager instances.
34 */
35 public function __construct( array $managers ) {
36 $this->managers = $managers;
37 }
38
39 /**
40 * Get a manager by type.
41 *
42 * @see Cache_Delivery_Type::all()
43 *
44 * @param string $type The manager instance to get.
45 *
46 * @return HtaccessManager|NginxManager|null
47 */
48 public function get( string $type ) {
49 return $this->managers[ $type ] ?? null;
50 }
51 }
52