WebsiteManagement.php 884 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Store\Model;
  7. use Magento\Store\Api\WebsiteManagementInterface;
  8. use Magento\Store\Model\ResourceModel\Website\CollectionFactory;
  9. /**
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class WebsiteManagement implements WebsiteManagementInterface
  14. {
  15. /**
  16. * @var CollectionFactory
  17. */
  18. protected $websitesFactory;
  19. /**
  20. * @param CollectionFactory $websitesFactory
  21. */
  22. public function __construct(CollectionFactory $websitesFactory)
  23. {
  24. $this->websitesFactory = $websitesFactory;
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function getCount()
  30. {
  31. $websites = $this->websitesFactory->create();
  32. /** @var \Magento\Store\Model\ResourceModel\Website\Collection $websites */
  33. return $websites->getSize();
  34. }
  35. }