Skip to content

Commit

Permalink
update instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabrisrp committed Oct 15, 2024
1 parent 29a14c4 commit 9d6d0c8
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions inc/Engine/Support/ServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php
declare(strict_types=1);

namespace WP_Rocket\Engine\Support;

use WP_Rocket_Mobile_Detect;
use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider;
use WP_Rocket\Engine\Support\Data;
use WP_Rocket\Engine\Support\Rest;
use WP_Rocket\Engine\Support\Subscriber;

class ServiceProvider extends AbstractServiceProvider {
/**
Expand All @@ -15,8 +14,10 @@ class ServiceProvider extends AbstractServiceProvider {
*/
protected $provides = [
'support_data',
'rest_support',
'support_rest',
'support_meta',
'support_subscriber',
'mobile_detect',
];

/**
Expand All @@ -38,12 +39,18 @@ public function provides( string $id ): bool {
public function register(): void {
$options = $this->getContainer()->get( 'options' );

$this->getContainer()->add( 'mobile_detect', WP_Rocket_Mobile_Detect::class );

$this->getContainer()->add( 'support_data', Data::class )
->addArgument( $options );
$this->getContainer()->add( 'rest_support', Rest::class )
$this->getContainer()->add( 'support_rest', Rest::class )
->addArgument( $this->getContainer()->get( 'support_data' ) )
->addArgument( $options );
$this->getContainer()->add( 'support_meta', Meta::class )
->addArgument( $this->getContainer()->get( 'mobile_detect' ) )
->addArgument( $options );
$this->getContainer()->addShared( 'support_subscriber', Subscriber::class )
->addArgument( $this->getContainer()->get( 'rest_support' ) );
->addArgument( $this->getContainer()->get( 'support_rest' ) )
->addArgument( $this->getContainer()->get( 'support_meta' ) );
}
}

0 comments on commit 9d6d0c8

Please sign in to comment.