StaticInstanceInterface.php 1008 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\base;
  8. /**
  9. * StaticInstanceInterface is the interface for providing static instances to classes,
  10. * which can be used to obtain class meta information that can not be expressed in static methods.
  11. * For example: adjustments made by DI or behaviors reveal only at object level, but might be needed
  12. * at class (static) level as well.
  13. *
  14. * To implement the [[instance()]] method you may use [[StaticInstanceTrait]].
  15. *
  16. * @author Paul Klimov <klimov.paul@gmail.com>
  17. * @since 2.0.13
  18. * @see StaticInstanceTrait
  19. */
  20. interface StaticInstanceInterface
  21. {
  22. /**
  23. * Returns static class instance, which can be used to obtain meta information.
  24. * @param bool $refresh whether to re-create static instance even, if it is already cached.
  25. * @return static class instance.
  26. */
  27. public static function instance($refresh = false);
  28. }