Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/wp-rocket/inc/Engine/Support/ServiceProvider.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
declare(strict_types=1);
3
+
4
+
namespace WP_Rocket\Engine\Support;
5
+
6
+
use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider;
7
+
use WP_Rocket_Mobile_Detect;
8
+
9
+
class ServiceProvider extends AbstractServiceProvider {
10
+
/**
11
+
* Array of services provided by this service provider
12
+
*
13
+
* @var array
14
+
*/
15
+
protected $provides = [
16
+
'support_data',
17
+
'support_rest',
18
+
'support_meta',
19
+
'support_subscriber',
20
+
'mobile_detect',
21
+
];
22
+
23
+
/**
24
+
* Check if the service provider provides a specific service.
25
+
*
26
+
* @param string $id The id of the service.
27
+
*
28
+
* @return bool
29
+
*/
30
+
public function provides( string $id ): bool {
31
+
return in_array( $id, $this->provides, true );
32
+
}
33
+
34
+
/**
35
+
* Registers the services in the container
36
+
*
37
+
* @return void
38
+
*/
39
+
public function register(): void {
40
+
$this->getContainer()->add( 'mobile_detect', WP_Rocket_Mobile_Detect::class );
41
+
42
+
$this->getContainer()->add( 'support_data', Data::class )
43
+
->addArgument( 'options' );
44
+
$this->getContainer()->add( 'support_rest', Rest::class )
45
+
->addArguments(
46
+
[
47
+
'support_data',
48
+
'options',
49
+
]
50
+
);
51
+
$this->getContainer()->add( 'support_meta', Meta::class )
52
+
->addArguments(
53
+
[
54
+
'mobile_detect',
55
+
'options',
56
+
]
57
+
);
58
+
$this->getContainer()->addShared( 'support_subscriber', Subscriber::class )
59
+
->addArguments(
60
+
[
61
+
'support_rest',
62
+
'support_meta',
63
+
]
64
+
);
65
+
}
66
+
}
67
+