woocommerce-paypal-payments/modules/ppcp-admin-notices/services.php

47 lines
1.6 KiB
PHP
Raw Normal View History

<?php
2020-09-01 10:24:10 +03:00
/**
* The services of the admin notice module.
*
2020-09-11 14:11:10 +03:00
* @package WooCommerce\PayPalCommerce\Button
2020-09-01 10:24:10 +03:00
*/
declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\AdminNotices;
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
2020-09-11 14:11:10 +03:00
use WooCommerce\PayPalCommerce\AdminNotices\Renderer\Renderer;
use WooCommerce\PayPalCommerce\AdminNotices\Renderer\RendererInterface;
use WooCommerce\PayPalCommerce\AdminNotices\Repository\Repository;
use WooCommerce\PayPalCommerce\AdminNotices\Repository\RepositoryInterface;
use WooCommerce\PayPalCommerce\AdminNotices\Endpoint\MuteMessageEndpoint;
2020-09-01 10:24:10 +03:00
return array(
'admin-notices.url' => static function ( ContainerInterface $container ): string {
$path = realpath( __FILE__ );
if ( false === $path ) {
return '';
}
return plugins_url(
'/modules/ppcp-admin-notices/',
dirname( $path, 3 ) . '/woocommerce-paypal-payments.php'
);
2020-09-01 10:24:10 +03:00
},
'admin-notices.renderer' => static function ( ContainerInterface $container ): RendererInterface {
return new Renderer(
$container->get( 'admin-notices.repository' ),
$container->get( 'admin-notices.url' ),
$container->get( 'ppcp.asset-version' )
);
},
'admin-notices.repository' => static function ( ContainerInterface $container ): RepositoryInterface {
2020-09-01 10:24:10 +03:00
return new Repository();
},
'admin-notices.mute-message-endpoint' => static function ( ContainerInterface $container ): MuteMessageEndpoint {
return new MuteMessageEndpoint(
$container->get( 'button.request-data' ),
$container->get( 'admin-notices.repository' )
);
},
2020-09-01 10:24:10 +03:00
);