ServiceLocatorAwareTrait.php 936 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Zend Framework (http://framework.zend.com/)
  4. *
  5. * @link http://github.com/zendframework/zf2 for the canonical source repository
  6. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  7. * @license http://framework.zend.com/license/new-bsd New BSD License
  8. */
  9. namespace Zend\ServiceManager;
  10. trait ServiceLocatorAwareTrait
  11. {
  12. /**
  13. * @var ServiceLocatorInterface
  14. */
  15. protected $serviceLocator = null;
  16. /**
  17. * Set service locator
  18. *
  19. * @param ServiceLocatorInterface $serviceLocator
  20. * @return mixed
  21. */
  22. public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
  23. {
  24. $this->serviceLocator = $serviceLocator;
  25. return $this;
  26. }
  27. /**
  28. * Get service locator
  29. *
  30. * @return ServiceLocatorInterface
  31. */
  32. public function getServiceLocator()
  33. {
  34. return $this->serviceLocator;
  35. }
  36. }