PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 2.17.0
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v2.17.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
57 lines 1.3 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 SureCartCore\ServiceProviders\ServiceProviderInterface;
7
8 /**
9 * Handles the request service
10 */
11 class RequestServiceProvider implements ServiceProviderInterface {
12 /**
13 * {@inheritDoc}
14 *
15 * @param \Pimple\Container $container Service Container.
16 */
17 public function register( $container ) {
18 $app = $container[ SURECART_APPLICATION_KEY ];
19
20 $container['requests'] = function () {
21 return new RequestService( ApiToken::get() );
22 };
23 $container['requests.unauthed'] = function () {
24 return new RequestService( '', '/v1', null, false );
25 };
26
27 $app->alias( 'requests', 'requests' );
28 $app->alias( 'unAuthorizedRequests', 'requests.unauthed' );
29
30 $app->alias(
31 'request',
32 function () use ( $app ) {
33 return call_user_func_array( [ $app->requests(), 'makeRequest' ], func_get_args() );
34 }
35 );
36
37 $app->alias(
38 'unAuthorizedRequest',
39 function () use ( $app ) {
40 return call_user_func_array( [ $app->unAuthorizedRequests(), 'makeRequest' ], func_get_args() );
41 }
42 );
43 }
44
45 /**
46 * {@inheritDoc}
47 *
48 * @param \Pimple\Container $container Service Container.
49 *
50 * @return void
51 *
52 * phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter
53 */
54 public function bootstrap( $container ) {
55 }
56 }
57