ServiceItem.php 616 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Holds the PhpMyAdmin\Di\ServiceItem class
  5. *
  6. * @package PhpMyAdmin\Di
  7. */
  8. namespace PhpMyAdmin\Di;
  9. /**
  10. * Service manager
  11. *
  12. * @package PhpMyAdmin\Di
  13. */
  14. class ServiceItem extends ReflectorItem
  15. {
  16. /** @var mixed */
  17. protected $instance;
  18. /**
  19. * Get the instance of the service
  20. *
  21. * @param array $params Parameters
  22. * @return mixed
  23. */
  24. public function get(array $params = array())
  25. {
  26. if (!isset($this->instance)) {
  27. $this->instance = $this->invoke();
  28. }
  29. return $this->instance;
  30. }
  31. }