PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 4.1.0
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v4.1.0
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / src / Request / RequestServiceProvider.php
RequestServiceProvider.php
66 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SureCart\Request;
4
5 use SureCart\Models\ApiToken;
6 use SureCart\Support\Errors\ErrorsService;
7 use SureCartCore\ServiceProviders\ServiceProviderInterface;
8
9 /**
10 * Handles the request service
11 */
12 class RequestServiceProvider implements ServiceProviderInterface {
13 /**
14 * {@inheritDoc}
15 *
16 * @param \Pimple\Container $container Service Container.
17 */
18 public function register( $container ) {
19 $app = $container[ SURECART_APPLICATION_KEY ];
20
21 $container['requests'] = function () use ( $container ) {
22 return new RequestService( $container, ApiToken::get(), '/v1', true );
23 };
24 $container['requests.cache'] = $container->protect(
25 function ( $endpoint, $args, $account_cache_key ) {
26 return new RequestCacheService( $endpoint, $args, $account_cache_key );
27 }
28 );
29 $container['requests.errors'] = function () {
30 return new ErrorsService();
31 };
32 $container['requests.unauthed'] = function () use ( $container ) {
33 return new RequestService( $container, '', '/v1', false );
34 };
35
36 $app->alias( 'requests', 'requests' );
37 $app->alias( 'unAuthorizedRequests', 'requests.unauthed' );
38
39 $app->alias(
40 'request',
41 function () use ( $app ) {
42 return call_user_func_array( [ $app->requests(), 'makeRequest' ], func_get_args() );
43 }
44 );
45
46 $app->alias(
47 'unAuthorizedRequest',
48 function () use ( $app ) {
49 return call_user_func_array( [ $app->unAuthorizedRequests(), 'makeRequest' ], func_get_args() );
50 }
51 );
52 }
53
54 /**
55 * {@inheritDoc}
56 *
57 * @param \Pimple\Container $container Service Container.
58 *
59 * @return void
60 *
61 * phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter
62 */
63 public function bootstrap( $container ) {
64 }
65 }
66