ManagerFactory.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Thomas Müller <thomas.mueller@tmit.eu>
  8. * @author Vincent Petry <pvince81@owncloud.com>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OC\Comments;
  26. use OCP\Comments\ICommentsManager;
  27. use OCP\Comments\ICommentsManagerFactory;
  28. use OCP\IServerContainer;
  29. class ManagerFactory implements ICommentsManagerFactory {
  30. /**
  31. * Server container
  32. *
  33. * @var IServerContainer
  34. */
  35. private $serverContainer;
  36. /**
  37. * Constructor for the comments manager factory
  38. *
  39. * @param IServerContainer $serverContainer server container
  40. */
  41. public function __construct(IServerContainer $serverContainer) {
  42. $this->serverContainer = $serverContainer;
  43. }
  44. /**
  45. * creates and returns an instance of the ICommentsManager
  46. *
  47. * @return ICommentsManager
  48. * @since 9.0.0
  49. */
  50. public function getManager() {
  51. return new Manager(
  52. $this->serverContainer->getDatabaseConnection(),
  53. $this->serverContainer->getLogger(),
  54. $this->serverContainer->getConfig(),
  55. $this->serverContainer->getEventDispatcher()
  56. );
  57. }
  58. }