| 1 |
<?php |
| 2 |
/** |
| 3 |
* Registers asset related functionality in the container. |
| 4 |
* |
| 5 |
* @package SolidWP\Performance |
| 6 |
*/ |
| 7 |
|
| 8 |
declare( strict_types=1 ); |
| 9 |
|
| 10 |
namespace SolidWP\Performance\Assets; |
| 11 |
|
| 12 |
use SolidWP\Performance\Contracts\Service_Provider; |
| 13 |
use SolidWP\Performance\Core; |
| 14 |
|
| 15 |
/** |
| 16 |
* Registers asset related functionality in the container. |
| 17 |
* |
| 18 |
* @package SolidWP\Performance |
| 19 |
*/ |
| 20 |
final class Provider extends Service_Provider { |
| 21 |
|
| 22 |
/** |
| 23 |
* @inheritDoc |
| 24 |
*/ |
| 25 |
public function register(): void { |
| 26 |
$this->container->when( Asset::class ) |
| 27 |
->needs( '$plugin_url' ) |
| 28 |
->give( static fn( $c ) => $c->get( Core::PLUGIN_URL ) ); |
| 29 |
$this->container->when( Asset::class ) |
| 30 |
->needs( '$plugin_dir' ) |
| 31 |
->give( static fn( $c ) => $c->get( Core::PLUGIN_DIR ) ); |
| 32 |
|
| 33 |
$this->container->singleton( Asset::class, Asset::class ); |
| 34 |
} |
| 35 |
} |
| 36 |
|