| 1 |
<?php |
| 2 |
declare(strict_types=1); |
| 3 |
|
| 4 |
namespace Imagify\Webp; |
| 5 |
|
| 6 |
use Imagify\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; |
| 7 |
use Imagify\Webp\RewriteRules\Display as RewriteRules; |
| 8 |
|
| 9 |
/** |
| 10 |
* Service provider for WebP rewrite rules |
| 11 |
*/ |
| 12 |
class ServiceProvider extends AbstractServiceProvider { |
| 13 |
/** |
| 14 |
* Services provided by this provider |
| 15 |
* |
| 16 |
* @var array |
| 17 |
*/ |
| 18 |
protected $provides = [ |
| 19 |
'webp_display', |
| 20 |
'webp_rewrite_rules', |
| 21 |
]; |
| 22 |
|
| 23 |
/** |
| 24 |
* Subscribers provided by this provider |
| 25 |
* |
| 26 |
* @var array |
| 27 |
*/ |
| 28 |
public $subscribers = [ |
| 29 |
'webp_display', |
| 30 |
'webp_rewrite_rules', |
| 31 |
]; |
| 32 |
|
| 33 |
/** |
| 34 |
* Registers the provided classes |
| 35 |
* |
| 36 |
* @return void |
| 37 |
*/ |
| 38 |
public function register() { |
| 39 |
$this->getContainer()->share( 'webp_display', Display::class ); |
| 40 |
$this->getContainer()->share( 'webp_rewrite_rules', RewriteRules::class ); |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Returns the subscribers array |
| 45 |
* |
| 46 |
* @return array |
| 47 |
*/ |
| 48 |
public function get_subscribers() { |
| 49 |
return $this->subscribers; |
| 50 |
} |
| 51 |
} |
| 52 |
|