DependencyInjection.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\Core\DependencyInjection;
  3. /**
  4. * Class DependencyInjection
  5. * @package ThurData\Servers\KerioEmail\Core\DependencyInjection
  6. */
  7. class DependencyInjection
  8. {
  9. /**
  10. * @param null $className
  11. * @param null $methodName
  12. * @param bool $canClone
  13. * @return mixed
  14. */
  15. public static function get($className = null, $methodName = null, $canClone = true)
  16. {
  17. logModuleCall(
  18. 'kerioEmail',
  19. __FUNCTION__,
  20. 'Debug Get',
  21. 'Debug Get',
  22. $className
  23. );
  24. if($methodName)
  25. {
  26. return Container::getInstance()->call("$className@$methodName");
  27. }
  28. return Container::getInstance()->make($className);
  29. }
  30. /**
  31. * @param null $className
  32. * @param null $methodName
  33. * @param bool $canClone
  34. * @return mixed
  35. */
  36. public static function create($className = null, $methodName = null, $canClone = true)
  37. {
  38. logModuleCall(
  39. 'kerioEmail',
  40. __FUNCTION__,
  41. 'Debug Create',
  42. 'Debug Create',
  43. $className
  44. );
  45. if($methodName)
  46. {
  47. return Container::getInstance()->call("$className@$methodName");
  48. }
  49. return Container::getInstance()->make($className);
  50. }
  51. /**
  52. * @param null $className
  53. * @param null $methodName
  54. * @return mixed
  55. */
  56. public static function call($className = null, $methodName = null)
  57. {
  58. logModuleCall(
  59. 'kerioEmail',
  60. __FUNCTION__,
  61. 'Debug Call',
  62. 'Debug Call',
  63. $className
  64. );
  65. if($methodName)
  66. {
  67. return Container::getInstance()->call("$className@$methodName");
  68. }
  69. return Container::getInstance()->make($className);
  70. }
  71. }