You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

icontainer.php 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Thomas Müller
  6. * @copyright 2013 Thomas Müller deepdiver@owncloud.com
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. /**
  23. * Public interface of ownCloud for apps to use.
  24. * Container interface
  25. *
  26. */
  27. // use OCP namespace for all classes that are considered public.
  28. // This means that they should be used by apps instead of the internal ownCloud classes
  29. namespace OCP;
  30. /**
  31. * Class IContainer
  32. *
  33. * IContainer is the basic interface to be used for any internal dependency injection mechanism
  34. *
  35. * @package OCP
  36. */
  37. interface IContainer {
  38. /**
  39. * Look up a service for a given name in the container.
  40. *
  41. * @param string $name
  42. * @return mixed
  43. */
  44. function query($name);
  45. /**
  46. * A value is stored in the container with it's corresponding name
  47. *
  48. * @param string $name
  49. * @param mixed $value
  50. * @return void
  51. */
  52. function registerParameter($name, $value);
  53. /**
  54. * A service is registered in the container where a closure is passed in which will actually
  55. * create the service on demand.
  56. * In case the parameter $shared is set to true (the default usage) the once created service will remain in
  57. * memory and be reused on subsequent calls.
  58. * In case the parameter is false the service will be recreated on every call.
  59. *
  60. * @param string $name
  61. * @param \Closure $closure
  62. * @param bool $shared
  63. * @return void
  64. */
  65. function registerService($name, \Closure $closure, $shared = true);
  66. }