ServiceProvider.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. /*
  8. * This file is part of the bytedance.
  9. *
  10. * (c) alim <alim@bulutbazar.com>
  11. *
  12. * This source file is subject to the MIT license that is bundled
  13. * with this source code in the file LICENSE.
  14. */
  15. namespace ByteDance\MiniProgram\Auth;
  16. use ByteDance\MiniProgram\Encryptor;
  17. use Pimple\Container;
  18. use Pimple\ServiceProviderInterface;
  19. /**
  20. * Class ServiceProvider.
  21. *
  22. * @author alim <alim@bulutbazar.com>
  23. */
  24. class ServiceProvider implements ServiceProviderInterface
  25. {
  26. /**
  27. * {@inheritdoc}.
  28. */
  29. public function register(Container $app)
  30. {
  31. !isset($app['access_token']) && $app['access_token'] = function ($app) {
  32. return new AccessToken($app);
  33. };
  34. !isset($app['auth']) && $app['auth'] = function ($app) {
  35. return new Client($app);
  36. };
  37. !isset($app['encryptor']) && $app['encryptor'] = function ($app) {
  38. return new Encryptor();
  39. };
  40. }
  41. }